From f70f0a9807f4daa8141576f3f99628089ad0db65 Mon Sep 17 00:00:00 2001 From: Eli Belash Date: Mon, 9 Sep 2019 12:43:39 +0300 Subject: [PATCH] Added implicit conversion from object[] to TensorShape --- src/TensorFlowNET.Core/Tensors/TensorShape.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/TensorFlowNET.Core/Tensors/TensorShape.cs b/src/TensorFlowNET.Core/Tensors/TensorShape.cs index 402ce3d8..fe8d391e 100644 --- a/src/TensorFlowNET.Core/Tensors/TensorShape.cs +++ b/src/TensorFlowNET.Core/Tensors/TensorShape.cs @@ -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);