From 9849829d416481a7b4ec03701965aca0a55d54c0 Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Thu, 15 Jul 2021 23:39:19 -0500 Subject: [PATCH] convert_to_eager_tensor --- src/TensorFlowNET.Core/Tensors/Tensor.Value.cs | 2 +- src/TensorFlowNET.Core/Tensors/constant_op.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/TensorFlowNET.Core/Tensors/Tensor.Value.cs b/src/TensorFlowNET.Core/Tensors/Tensor.Value.cs index 14524704..20257ea5 100644 --- a/src/TensorFlowNET.Core/Tensors/Tensor.Value.cs +++ b/src/TensorFlowNET.Core/Tensors/Tensor.Value.cs @@ -52,7 +52,7 @@ namespace Tensorflow if (dtype == TF_DataType.TF_STRING) { var str= StringData(); - return new NDArray(str, new Shape(str.Length)); + return new NDArray(str, shape); } return new NDArray(this); diff --git a/src/TensorFlowNET.Core/Tensors/constant_op.cs b/src/TensorFlowNET.Core/Tensors/constant_op.cs index 66845de1..37eb3b89 100644 --- a/src/TensorFlowNET.Core/Tensors/constant_op.cs +++ b/src/TensorFlowNET.Core/Tensors/constant_op.cs @@ -136,6 +136,8 @@ namespace Tensorflow return new EagerTensor(new[] { val }, Shape.Scalar); case double val: return new EagerTensor(new[] { val }, Shape.Scalar); + case IEnumerable val: + return ops.convert_to_tensor(val); case Array val: return new EagerTensor(val, val.GetShape()); default: