diff --git a/src/TensorFlowNET.Core/Binding.Util.cs b/src/TensorFlowNET.Core/Binding.Util.cs index 8a744543..f5fbd4e6 100644 --- a/src/TensorFlowNET.Core/Binding.Util.cs +++ b/src/TensorFlowNET.Core/Binding.Util.cs @@ -517,7 +517,7 @@ namespace Tensorflow return tensor.shape; else if (data is Axis axis) - return axis.IsScalar ? Shape.Scalar : new Shape(axis.axis); + return axis.IsScalar ? Shape.Scalar : new Shape(axis.axis.Length); else if (!data.GetType().IsArray) return Shape.Scalar; diff --git a/src/TensorFlowNET.Keras/Utils/np_utils.cs b/src/TensorFlowNET.Keras/Utils/np_utils.cs index 8430bff0..758c287c 100644 --- a/src/TensorFlowNET.Keras/Utils/np_utils.cs +++ b/src/TensorFlowNET.Keras/Utils/np_utils.cs @@ -20,9 +20,9 @@ namespace Tensorflow.Keras.Utils // var input_shape = y.shape[..^1]; var categorical = np.zeros(((int)y.size, num_classes), dtype: dtype); // categorical[np.arange(y.size), y] = 1; - for (ulong i = 0; i < y.size; i++) + for (var i = 0; i < (int)y.size; i++) { - categorical[i][y1[i]] = 1; + categorical[i][y1[i]] = 1.0f; } return categorical;