| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,7 +71,7 @@ public Tensor uniform(Shape shape, | |||
| 71 | 71 | string name = null) | |
| 72 | 72 | { | |
| 73 | 73 | if (dtype.is_integer()) | |
| 74 | - return random_ops.random_uniform_int(shape, (int)minval, (int)maxval, dtype, seed, name); | ||
| 74 | + return random_ops.random_uniform_int(shape, (int)minval, (int)maxval, seed, name); | ||
| 75 | 75 | else | |
| 76 | 76 | return random_ops.random_uniform(shape, minval, maxval, dtype, seed, name); | |
| 77 | 77 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,8 +23,18 @@ public void shuffle(NDArray x) | |||
| 23 | 23 | public NDArray rand(params int[] shape) | |
| 24 | 24 | => throw new NotImplementedException(""); | |
| 25 | 25 | ||
| 26 | + [AutoNumPy] | ||
| 26 | 27 | public NDArray randint(int low, int? high = null, Shape size = null, TF_DataType dtype = TF_DataType.TF_INT32) | |
| 27 | - => throw new NotImplementedException(""); | ||
| 28 | + { | ||
| 29 | + if(high == null) | ||
| 30 | + { | ||
| 31 | + high = low; | ||
| 32 | + low = 0; | ||
| 33 | + } | ||
| 34 | + size = size ?? Shape.Scalar; | ||
| 35 | + var tensor = random_ops.random_uniform_int(shape: size, minval: low, maxval: (int)high); | ||
| 36 | + return new NDArray(tensor); | ||
| 37 | + } | ||
| 28 | 38 | ||
| 29 | 39 | public NDArray normal(float loc = 0.0f, float scale = 1.0f, Shape size = null) | |
| 30 | 40 | => throw new NotImplementedException(""); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -94,7 +94,6 @@ public static Tensor random_uniform(int[] shape, | |||
| 94 | 94 | public static Tensor random_uniform_int(int[] shape, | |
| 95 | 95 | int minval = 0, | |
| 96 | 96 | int maxval = 1, | |
| 97 | - TF_DataType dtype = TF_DataType.TF_FLOAT, | ||
| 98 | 97 | int? seed = null, | |
| 99 | 98 | string name = null) | |
| 100 | 99 | { | |
@@ -103,8 +102,8 @@ public static Tensor random_uniform_int(int[] shape, | |||
| 103 | 102 | name = scope; | |
| 104 | 103 | var (seed1, seed2) = random_seed.get_seed(seed); | |
| 105 | 104 | var tensorShape = tensor_util.shape_tensor(shape); | |
| 106 | - var minTensor = ops.convert_to_tensor(minval, dtype: dtype, name: "min"); | ||
| 107 | - var maxTensor = ops.convert_to_tensor(maxval, dtype: dtype, name: "max"); | ||
| 105 | + var minTensor = ops.convert_to_tensor(minval, name: "min"); | ||
| 106 | + var maxTensor = ops.convert_to_tensor(maxval, name: "max"); | ||
| 108 | 107 | return gen_random_ops.random_uniform_int(tensorShape, minTensor, maxTensor, seed: seed1, seed2: seed2); | |
| 109 | 108 | }); | |
| 110 | 109 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments