8000 add missing np api but pending to implemented. · SciSharp/TensorFlow.NET@141bdf3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 141bdf3

Browse files
committed
add missing np api but pending to implemented.
1 parent a4a4da9 commit 141bdf3

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

src/TensorFlowNET.Core/NumPy/Implementation/RandomizedImpl.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ public void shuffle(NDArray x)
2323
public NDArray rand(params int[] shape)
2424
=> throw new NotImplementedException("");
2525

26-
public NDArray randint(long x)
26+
public NDArray randint(int low, int? high = null, Shape size = null, TF_DataType dtype = TF_DataType.TF_INT32)
27+
=> throw new NotImplementedException("");
28+
29+
public NDArray normal(float loc = 0.0f, float scale = 1.0f, Shape size = null)
2730
=> throw new NotImplementedException("");
2831
}
2932
}

src/TensorFlowNET.Core/NumPy/Numpy.Manipulation.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ namespace Tensorflow.NumPy
88
{
99
public partial class np
1010
{
11+
[AutoNumPy]
12+
public static NDArray expand_dims(NDArray a, Axis? axis = null) => throw new NotImplementedException("");
13+
1114
[AutoNumPy]
1215
public static NDArray reshape(NDArray x1, Shape newshape) => x1.reshape(newshape);
1316

1417
[AutoNumPy]
1518
public static NDArray squeeze(NDArray x1, Axis? axis = null) => new NDArray(array_ops.squeeze(x1, axis));
19+
20+
[AutoNumPy]
21+
public static NDArray dstack(params NDArray[] tup) => throw new NotImplementedException("");
1622
}
1723
}

src/TensorFlowNET.Core/Numpy/Numpy.Creation.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ public static NDArray eye(int N, int? M = null, int k = 0, TF_DataType dtype = T
3535

3636
[AutoNumPy]
3737
public static NDArray full<T>(Shape shape, T fill_value)
38-
=> new NDArray(tf.fill(tf.constant(shape), fill_value));
38+
where T : unmanaged => new NDArray(tf.fill(tf.constant(shape), fill_value));
39+
40+
[AutoNumPy]
41+
public static NDArray full_like<T>(NDArray x, T fill_value, TF_DataType? dtype = null, Shape shape = null)
42+
where T : unmanaged => new NDArray(array_ops.fill(x.shape, constant_op.constant(fill_value)));
3943

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

src/TensorFlowNET.Keras/Preprocessings/DatasetUtils.index_directory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public partial class DatasetUtils
4949
if (shuffle)
5050
{
5151
if (!seed.HasValue)
52-
seed = np.random.randint((long)1e6);
52+
seed = np.random.randint((int)1e6);
5353
var random_index = np.arange(label_list.Count);
5454
tf.set_random_seed(seed.Value);
5555
np.random.shuffle(random_index);

0 commit comments

Comments
 (0)
0