Browse Source

add math.round

tags/v0.9
Oceania2018 6 years ago
parent
commit
87eac0c0f8
2 changed files with 25 additions and 0 deletions
  1. +3
    -0
      src/TensorFlowNET.Core/APIs/tf.math.cs
  2. +22
    -0
      src/TensorFlowNET.Core/Operations/gen_math_ops.cs

+ 3
- 0
src/TensorFlowNET.Core/APIs/tf.math.cs View File

@@ -287,6 +287,9 @@ namespace Tensorflow
public static Tensor reduce_mean(Tensor input_tensor, int[] axis = null, bool keepdims = false, string name = null, int? reduction_indices = null)
=> math_ops.reduce_mean(input_tensor, axis: axis, keepdims: keepdims, name: name, reduction_indices: reduction_indices);

public static Tensor round(Tensor x, string name = null)
=> gen_math_ops.round(x, name: name);

public static Tensor cast(Tensor x, TF_DataType dtype = TF_DataType.DtInvalid, string name = null)
=> math_ops.cast(x, dtype, name);



+ 22
- 0
src/TensorFlowNET.Core/Operations/gen_math_ops.cs View File

@@ -429,6 +429,28 @@ namespace Tensorflow
return _op.outputs[0];
}
/// <summary>
/// Rounds the values of a tensor to the nearest integer, element-wise.
/// </summary>
/// <param name="x">
/// </param>
/// <param name="name">
/// If specified, the created operation in the graph will be this one, otherwise it will be named 'Round'.
/// </param>
/// <returns>
/// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
/// </returns>
/// <remarks>
/// Rounds half to even. Also known as bankers rounding. If you want to round
/// according to the current system rounding mode use std::cint.
/// </remarks>
public static Tensor round(Tensor x, string name = "Round")
{
var op = _op_def_lib._apply_op_helper("Round", name: name, new { x });
return op.output;
}
/// <summary>
/// Computes reciprocal of square root of x element-wise.
/// </summary>


Loading…
Cancel
Save