Browse Source

TensorShape of variable. #138

tags/v0.1.0-Tensor
Oceania2018 6 years ago
parent
commit
b209fac566
2 changed files with 6 additions and 0 deletions
  1. +5
    -0
      src/TensorFlowNET.Core/Tensors/tensor_util.cs
  2. +1
    -0
      src/TensorFlowNET.Core/Variables/RefVariable.cs

+ 5
- 0
src/TensorFlowNET.Core/Tensors/tensor_util.cs View File

@@ -89,6 +89,11 @@ namespace Tensorflow
return shape;
}

public static TensorShape to_shape(long[] dims)
{
return new TensorShape(dims.Select(x => (int)x).ToArray());
}

public static TensorShape as_shape(this IShape shape, int[] dims)
{
return new TensorShape(dims);


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

@@ -18,6 +18,7 @@ namespace Tensorflow
public Operation initializer => _initializer_op;
public Operation op => _variable.op;
public TF_DataType dtype => _variable.dtype;
public TensorShape shape => tensor_util.to_shape(_variable.shape);

public string name => _variable.name;



Loading…
Cancel
Save