Browse Source

Merge pull request #1155 from Wanglongzhi2001/master

fix: revise np.amin, np.amax and add np.argmin
tags/v0.110.4-Transformer-Model
Haiping GitHub 2 years ago
parent
commit
a5fdaf4fca
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions
  1. +4
    -0
      src/TensorFlowNET.Core/NumPy/NumPy.Sorting.Searching.Counting.cs
  2. +2
    -2
      src/TensorFlowNET.Core/NumPy/NumPy.Statistics.cs
  3. +3
    -0
      src/TensorFlowNET.Core/Operations/math_ops.cs

+ 4
- 0
src/TensorFlowNET.Core/NumPy/NumPy.Sorting.Searching.Counting.cs View File

@@ -13,6 +13,10 @@ namespace Tensorflow.NumPy
public static NDArray argmax(NDArray a, Axis? axis = null) public static NDArray argmax(NDArray a, Axis? axis = null)
=> new NDArray(math_ops.argmax(a, axis ?? 0)); => new NDArray(math_ops.argmax(a, axis ?? 0));


[AutoNumPy]
public static NDArray argmin(NDArray a, Axis? axis = null)
=> new NDArray(math_ops.argmin(a, axis ?? 0));

[AutoNumPy] [AutoNumPy]
public static NDArray argsort(NDArray a, Axis? axis = null) public static NDArray argsort(NDArray a, Axis? axis = null)
=> new NDArray(sort_ops.argsort(a, axis: axis ?? -1)); => new NDArray(sort_ops.argsort(a, axis: axis ?? -1));


+ 2
- 2
src/TensorFlowNET.Core/NumPy/NumPy.Statistics.cs View File

@@ -10,10 +10,10 @@ namespace Tensorflow.NumPy
public partial class np public partial class np
{ {
[AutoNumPy] [AutoNumPy]
public static NDArray amin(NDArray x, int axis = 0) => new NDArray(tf.arg_min(x, axis));
public static NDArray amin(NDArray x, int axis = 0) => new NDArray(tf.min(x, axis));


[AutoNumPy] [AutoNumPy]
public static NDArray amax(NDArray x, int axis = 0) => new NDArray(tf.math.argmax(x, axis));
public static NDArray amax(NDArray x, int axis = 0) => new NDArray(tf.max(x, axis));


[AutoNumPy] [AutoNumPy]
public static NDArray average(NDArray a, int axis = -1, NDArray? weights = null, bool returned = false) public static NDArray average(NDArray a, int axis = -1, NDArray? weights = null, bool returned = false)


+ 3
- 0
src/TensorFlowNET.Core/Operations/math_ops.cs View File

@@ -77,6 +77,9 @@ namespace Tensorflow
public static Tensor argmax(Tensor input, Axis dimension, TF_DataType output_type = TF_DataType.TF_INT64, string name = null) public static Tensor argmax(Tensor input, Axis dimension, TF_DataType output_type = TF_DataType.TF_INT64, string name = null)
=> gen_math_ops.arg_max(input, dimension, output_type: output_type, name: name); => gen_math_ops.arg_max(input, dimension, output_type: output_type, name: name);


public static Tensor argmin(Tensor input, Axis dimension, TF_DataType output_type = TF_DataType.TF_INT64, string name = null)
=> gen_math_ops.arg_min(input, dimension, output_type: output_type, name: name);

public static Tensor round(Tensor x, string name = null) public static Tensor round(Tensor x, string name = null)
{ {
x = ops.convert_to_tensor(x, name: "x"); x = ops.convert_to_tensor(x, name: "x");


Loading…
Cancel
Save