Browse Source

add missing np api but pending to implemented.

tags/v0.60-tf.numpy
Oceania2018 4 years ago
parent
commit
141bdf3384
4 changed files with 16 additions and 3 deletions
  1. +4
    -1
      src/TensorFlowNET.Core/NumPy/Implementation/RandomizedImpl.cs
  2. +6
    -0
      src/TensorFlowNET.Core/NumPy/Numpy.Manipulation.cs
  3. +5
    -1
      src/TensorFlowNET.Core/Numpy/Numpy.Creation.cs
  4. +1
    -1
      src/TensorFlowNET.Keras/Preprocessings/DatasetUtils.index_directory.cs

+ 4
- 1
src/TensorFlowNET.Core/NumPy/Implementation/RandomizedImpl.cs View File

@@ -23,7 +23,10 @@ namespace Tensorflow.NumPy
public NDArray rand(params int[] shape)
=> throw new NotImplementedException("");

public NDArray randint(long x)
public NDArray randint(int low, int? high = null, Shape size = null, TF_DataType dtype = TF_DataType.TF_INT32)
=> throw new NotImplementedException("");

public NDArray normal(float loc = 0.0f, float scale = 1.0f, Shape size = null)
=> throw new NotImplementedException("");
}
}

+ 6
- 0
src/TensorFlowNET.Core/NumPy/Numpy.Manipulation.cs View File

@@ -8,10 +8,16 @@ namespace Tensorflow.NumPy
{
public partial class np
{
[AutoNumPy]
public static NDArray expand_dims(NDArray a, Axis? axis = null) => throw new NotImplementedException("");

[AutoNumPy]
public static NDArray reshape(NDArray x1, Shape newshape) => x1.reshape(newshape);

[AutoNumPy]
public static NDArray squeeze(NDArray x1, Axis? axis = null) => new NDArray(array_ops.squeeze(x1, axis));

[AutoNumPy]
public static NDArray dstack(params NDArray[] tup) => throw new NotImplementedException("");
}
}

+ 5
- 1
src/TensorFlowNET.Core/Numpy/Numpy.Creation.cs View File

@@ -35,7 +35,11 @@ namespace Tensorflow.NumPy

[AutoNumPy]
public static NDArray full<T>(Shape shape, T fill_value)
=> new NDArray(tf.fill(tf.constant(shape), fill_value));
where T : unmanaged => new NDArray(tf.fill(tf.constant(shape), fill_value));

[AutoNumPy]
public static NDArray full_like<T>(NDArray x, T fill_value, TF_DataType? dtype = null, Shape shape = null)
where T : unmanaged => new NDArray(array_ops.fill(x.shape, constant_op.constant(fill_value)));

[AutoNumPy]
public static NDArray frombuffer(byte[] bytes, Shape shape, TF_DataType dtype)


+ 1
- 1
src/TensorFlowNET.Keras/Preprocessings/DatasetUtils.index_directory.cs View File

@@ -49,7 +49,7 @@ namespace Tensorflow.Keras.Preprocessings
if (shuffle)
{
if (!seed.HasValue)
seed = np.random.randint((long)1e6);
seed = np.random.randint((int)1e6);
var random_index = np.arange(label_list.Count);
tf.set_random_seed(seed.Value);
np.random.shuffle(random_index);


Loading…
Cancel
Save