From 668af612851bfa960591d5383d72d2a46d7141d5 Mon Sep 17 00:00:00 2001 From: MPnoy Date: Wed, 16 Mar 2022 00:18:04 +0300 Subject: [PATCH] Add np.add and np.random.uniform --- src/TensorFlowNET.Core/NumPy/Implementation/RandomizedImpl.cs | 4 ++++ src/TensorFlowNET.Core/NumPy/Numpy.Math.cs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/TensorFlowNET.Core/NumPy/Implementation/RandomizedImpl.cs b/src/TensorFlowNET.Core/NumPy/Implementation/RandomizedImpl.cs index 9d594637..222b10bb 100644 --- a/src/TensorFlowNET.Core/NumPy/Implementation/RandomizedImpl.cs +++ b/src/TensorFlowNET.Core/NumPy/Implementation/RandomizedImpl.cs @@ -43,5 +43,9 @@ namespace Tensorflow.NumPy [AutoNumPy] public NDArray normal(float loc = 0.0f, float scale = 1.0f, Shape size = null) => new NDArray(random_ops.random_normal(size ?? Shape.Scalar, mean: loc, stddev: scale)); + + [AutoNumPy] + public NDArray uniform(float low = 0.0f, float high = 1.0f, Shape size = null) + => new NDArray(random_ops.random_uniform(size ?? Shape.Scalar, low, high)); } } diff --git a/src/TensorFlowNET.Core/NumPy/Numpy.Math.cs b/src/TensorFlowNET.Core/NumPy/Numpy.Math.cs index 440a6faa..0e50cd56 100644 --- a/src/TensorFlowNET.Core/NumPy/Numpy.Math.cs +++ b/src/TensorFlowNET.Core/NumPy/Numpy.Math.cs @@ -52,5 +52,8 @@ namespace Tensorflow.NumPy [AutoNumPy] public static NDArray sum(NDArray x1, Axis? axis = null) => new NDArray(tf.math.sum(x1, axis)); + + [AutoNumPy] + public static NDArray add(NDArray x, NDArray y) => new NDArray(math_ops.add(x, y)); } }