Skip to content

Commit ea5d35e

Browse files
committed
control_flow_ops._GroupControlDeps
1 parent 1fb41de commit ea5d35e

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ namespace Tensorflow
66
{
77
public class control_flow_ops
88
{
9-
public static Operation group(Operation[] inputs)
9+
public static Operation group(List<Operation> inputs, string name = "")
10+
{
11+
using(var namescope = new ops.name_scope<Operation>(name, "group_deps", inputs))
12+
{
13+
// Sorts *inputs according to their devices.
14+
15+
return _GroupControlDeps("", name);
16+
}
17+
}
18+
19+
private static Operation _GroupControlDeps(string dev, string name = "")
1020
{
1121
return null;
1222
}

src/TensorFlowNET.Core/Variables/tf.variable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static partial class tf
99
public static Operation global_variables_initializer()
1010
{
1111
var g = variables.global_variables();
12-
return variables.variables_initializer(g as RefVariable[]);
12+
return variables.variables_initializer(g.ToArray());
1313
}
1414
}
1515
}

src/TensorFlowNET.Core/Variables/variables.py.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ public static object trainable_variables()
2727
/// special tokens filters by prefix.
2828
/// </param>
2929
/// <returns>A list of `Variable` objects.</returns>
30-
public static object global_variables(string scope = "")
30+
public static List<RefVariable> global_variables(string scope = "")
3131
{
32-
return ops.get_collection(ops.GraphKeys.GLOBAL_VARIABLES, scope);
32+
var result = ops.get_collection(ops.GraphKeys.GLOBAL_VARIABLES, scope);
33+
34+
return result as List<RefVariable>;
3335
}
3436

3537
/// <summary>
@@ -40,7 +42,7 @@ public static object global_variables(string scope = "")
4042
/// <returns>An Op that run the initializers of all the specified variables.</returns>
4143
public static Operation variables_initializer(RefVariable[] var_list, string name = "init")
4244
{
43-
return control_flow_ops.group(var_list.Select(x => x.initializer).ToArray());
45+
return control_flow_ops.group(var_list.Select(x => x.initializer).ToList());
4446
}
4547
}
4648
}

0 commit comments

Comments
 (0)