Browse Source

control_flow_ops._GroupControlDeps

tags/v0.1.0-Tensor
Oceania2018 6 years ago
parent
commit
ea5d35e219
3 changed files with 17 additions and 5 deletions
  1. +11
    -1
      src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs
  2. +1
    -1
      src/TensorFlowNET.Core/Variables/tf.variable.cs
  3. +5
    -3
      src/TensorFlowNET.Core/Variables/variables.py.cs

+ 11
- 1
src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs View File

@@ -6,7 +6,17 @@ namespace Tensorflow
{
public class control_flow_ops
{
public static Operation group(Operation[] inputs)
public static Operation group(List<Operation> inputs, string name = "")
{
using(var namescope = new ops.name_scope<Operation>(name, "group_deps", inputs))
{
// Sorts *inputs according to their devices.

return _GroupControlDeps("", name);
}
}

private static Operation _GroupControlDeps(string dev, string name = "")
{
return null;
}


+ 1
- 1
src/TensorFlowNET.Core/Variables/tf.variable.cs View File

@@ -9,7 +9,7 @@ namespace Tensorflow
public static Operation global_variables_initializer()
{
var g = variables.global_variables();
return variables.variables_initializer(g as RefVariable[]);
return variables.variables_initializer(g.ToArray());
}
}
}

+ 5
- 3
src/TensorFlowNET.Core/Variables/variables.py.cs View File

@@ -27,9 +27,11 @@ namespace Tensorflow
/// special tokens filters by prefix.
/// </param>
/// <returns>A list of `Variable` objects.</returns>
public static object global_variables(string scope = "")
public static List<RefVariable> global_variables(string scope = "")
{
return ops.get_collection(ops.GraphKeys.GLOBAL_VARIABLES, scope);
var result = ops.get_collection(ops.GraphKeys.GLOBAL_VARIABLES, scope);

return result as List<RefVariable>;
}

/// <summary>
@@ -40,7 +42,7 @@ namespace Tensorflow
/// <returns>An Op that run the initializers of all the specified variables.</returns>
public static Operation variables_initializer(RefVariable[] var_list, string name = "init")
{
return control_flow_ops.group(var_list.Select(x => x.initializer).ToArray());
return control_flow_ops.group(var_list.Select(x => x.initializer).ToList());
}
}
}

Loading…
Cancel
Save