Browse Source

added tf.name_scope api.

tags/v0.8.0
haiping008 6 years ago
parent
commit
31d38bf944
5 changed files with 17 additions and 3 deletions
  1. +1
    -1
      README.md
  2. +11
    -0
      src/TensorFlowNET.Core/Framework/tf.ops.cs
  3. +1
    -1
      src/TensorFlowNET.Core/Variables/RefVariable.Operators.cs
  4. +1
    -1
      src/TensorFlowNET.Core/Variables/VariableV1.cs
  5. +3
    -0
      src/TensorFlowNET.Core/ops.name_scope.cs

+ 1
- 1
README.md View File

@@ -26,7 +26,7 @@ Install TensorFlow.NET through NuGet.
PM> Install-Package TensorFlow.NET
```

If you are using Linux or Mac OS, please download the pre-compiled dll [here](tensorflow.so) and place it in the working folder. This is only need for Linux and Mac OS, and already packed into NuGet for Windows.
If you are using Linux or Mac OS, please download the pre-compiled dll [here](tensorflowlib) and place it in the working folder. This is only need for Linux and Mac OS, and already packed into NuGet for Windows.

Import tensorflow.net.



+ 11
- 0
src/TensorFlowNET.Core/Framework/tf.ops.cs View File

@@ -8,5 +8,16 @@ namespace Tensorflow
{
public static object get_collection(string key, string scope = "") => get_default_graph()
.get_collection(key, scope: scope);

/// <summary>
/// Returns a context manager that creates hierarchical names for operations.
/// </summary>
/// <param name="name">The name argument that is passed to the op function.</param>
/// <param name="default_name">The default name to use if the name argument is None.</param>
/// <param name="values">The list of Tensor arguments that are passed to the op function.</param>
/// <returns>The scope name.</returns>
public static ops.name_scope name_scope(string name,
string default_name = "",
object values = null) => new ops.name_scope(name, default_name, values);
}
}

+ 1
- 1
src/TensorFlowNET.Core/Variables/RefVariable.Operators.cs View File

@@ -17,7 +17,7 @@ namespace Tensorflow
private static Tensor op_helper<T>(string default_name, RefVariable x, T y)
{
var tensor1 = x.value();
return Python.with<ops.name_scope, Tensor>(new ops.name_scope(null, default_name, new object[] { tensor1, y }), scope => {
return with<ops.name_scope, Tensor>(new ops.name_scope(null, default_name, new { tensor1, y }), scope => {
var tensor2 = ops.convert_to_tensor(y, tensor1.dtype.as_base_dtype(), "y");
return gen_math_ops.add(tensor1, tensor2, scope);
});


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

@@ -14,7 +14,7 @@ namespace Tensorflow
/// the variable are fixed. The value can be changed using one of the assign methods.
/// https://tensorflow.org/guide/variables
/// </summary>
public class VariableV1
public class VariableV1 : Python
{
public VariableV1(object initial_value = null,
bool trainable = true,


+ 3
- 0
src/TensorFlowNET.Core/ops.name_scope.cs View File

@@ -7,6 +7,9 @@ namespace Tensorflow
{
public partial class ops
{
/// <summary>
/// Returns a context manager that creates hierarchical names for operations.
/// </summary>
public class name_scope : IPython
{
public string _name;


Loading…
Cancel
Save