Browse Source

Added implicit conversion from object[] to TensorShape

tags/v0.12
Eli Belash 6 years ago
parent
commit
f70f0a9807
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      src/TensorFlowNET.Core/Tensors/TensorShape.cs

+ 2
- 0
src/TensorFlowNET.Core/Tensors/TensorShape.cs View File

@@ -232,6 +232,8 @@ namespace Tensorflow
public static implicit operator TensorShape(Shape shape) => new TensorShape((int[]) shape.Dimensions.Clone());
public static implicit operator Shape(TensorShape shape) => new Shape((int[]) shape.dims.Clone());
public static implicit operator TensorShape(object[] dims) => new TensorShape(dims);

public static implicit operator int[](TensorShape shape) => (int[])shape.dims.Clone(); //we clone to avoid any changes
public static implicit operator TensorShape(int[] dims) => new TensorShape(dims);



Loading…
Cancel
Save