Skip to content

Commit 483ac82

Browse files
Update tensor_util.cs
1 parent b21a58a commit 483ac82

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/TensorFlowNET.Core/Tensors/tensor_util.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,15 @@ public static TensorProto make_tensor_proto(object values, TF_DataType dtype = T
178178
values = values switch
179179
{
180180
long[] longValues when dtype == TF_DataType.TF_INT32 => longValues.Select(x => (int)x).ToArray(),
181+
long[] longValues => values,
181182
float[] floatValues when dtype == TF_DataType.TF_DOUBLE => floatValues.Select(x => (double)x).ToArray(),
183+
float[] floatValues => values,
182184
float[,] float2DValues when dtype == TF_DataType.TF_DOUBLE => ConvertArray2D(float2DValues, Convert.ToDouble),
185+
float[,] float2DValues => values,
183186
double[] doubleValues when dtype == TF_DataType.TF_FLOAT => doubleValues.Select(x => (float)x).ToArray(),
184-
double[,] double2DValues when dtype == TF_DataType.TF_DOUBLE => ConvertArray2D(double2DValues, Convert.ToSingle),
187+
double[] doubleValues => values,
188+
double[,] double2DValues when dtype == TF_DataType.TF_FLOAT => ConvertArray2D(double2DValues, Convert.ToSingle),
189+
double[,] double2DValues => values,
185190
_ => Convert.ChangeType(values, new_system_dtype),
186191
};
187192
dtype = values.GetDataType();

0 commit comments

Comments
 (0)