Browse Source

MakeNdarray exception when shape is empty.

tags/v0.12
Oceania2018 6 years ago
parent
commit
b962e6ff11
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/TensorFlowNET.Core/Tensors/tensor_util.cs

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

@@ -57,7 +57,7 @@ namespace Tensorflow
public static NDArray MakeNdarray(TensorProto tensor)
{
var shape = tensor.TensorShape.Dim.Select(x => (int)x.Size).ToArray();
int num_elements = np.prod(shape);
int num_elements = shape.Length == 0 ? NDArray.Scalar(1) : np.prod(shape);
var tensor_dtype = tensor.Dtype.as_numpy_dtype();

if (tensor.TensorContent.Length > 0)


Loading…
Cancel
Save