Browse Source

fix GetShape for Axis.

tags/v0.60-tf.numpy
Oceania2018 4 years ago
parent
commit
f9802664d3
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      src/TensorFlowNET.Core/Binding.Util.cs
  2. +2
    -2
      src/TensorFlowNET.Keras/Utils/np_utils.cs

+ 1
- 1
src/TensorFlowNET.Core/Binding.Util.cs View File

@@ -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;


+ 2
- 2
src/TensorFlowNET.Keras/Utils/np_utils.cs View File

@@ -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;


Loading…
Cancel
Save