Browse Source

tf.reduce_any #396

tags/v0.12
Oceania2018 6 years ago
parent
commit
f61e260bfe
4 changed files with 32 additions and 0 deletions
  1. +14
    -0
      src/TensorFlowNET.Core/APIs/tf.math.cs
  2. +3
    -0
      src/TensorFlowNET.Core/APIs/tf.variable.cs
  3. +7
    -0
      src/TensorFlowNET.Core/Operations/gen_math_ops.cs
  4. +8
    -0
      src/TensorFlowNET.Core/Operations/math_ops.cs

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

@@ -389,6 +389,20 @@ namespace Tensorflow
public Tensor range(object start, object limit = null, object delta = null, TF_DataType dtype = TF_DataType.DtInvalid, string name = "range")
=> math_ops.range(start, limit: limit, delta: delta, dtype: dtype, name: name);

/// <summary>
/// Computes the "logical or" of elements across dimensions of a tensor.
/// </summary>
/// <param name="input_tensor">The boolean tensor to reduce.</param>
/// <param name="axis">The dimensions to reduce.</param>
/// <param name="keepdims">If true, retains reduced dimensions with length 1.</param>
/// <param name="name"></param>
/// <returns>The reduced tensor.</returns>
public Tensor reduce_any(Tensor input_tensor, int[] axis = null, bool keepdims = false, string name = null)
=> math_ops.reduce_any(input_tensor, axis: axis, keepdims: keepdims, name: name);

public Tensor reduce_any(Tensor input_tensor, int axis = 0, bool keepdims = false, string name = null)
=> math_ops.reduce_any(input_tensor, axis: new[] { axis }, keepdims: keepdims, name: name);

/// <summary>
/// Computes the "logical and" of elements across dimensions of a tensor.
/// </summary>


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

@@ -64,5 +64,8 @@ namespace Tensorflow
trainable: trainable,
collections: collections);
}

public VariableScope get_variable_scope()
=> Tensorflow.variable_scope.get_variable_scope();
}
}

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

@@ -632,6 +632,13 @@ namespace Tensorflow
return _op.outputs[0];
}
public static Tensor _any<Tx, Ty>(Tx input, Ty axis, bool keep_dims = false, string name = null)
{
var _op = _op_def_lib._apply_op_helper("Any", name, new { input, reduction_indices = axis, keep_dims });
return _op.outputs[0];
}
public static Tensor _max<Tx, Ty>(Tx input, Ty axis, bool keep_dims=false, string name = null)
{
var _op = _op_def_lib._apply_op_helper("Max", name, new { input, reduction_indices = axis, keep_dims });


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

@@ -361,6 +361,14 @@ namespace Tensorflow
});
}

public static Tensor reduce_any(Tensor input_tensor, int[] axis = null, bool keepdims = false, string name = null)
{
var r = _ReductionDims(input_tensor, axis);
var max = (axis != null) ? gen_math_ops._any(input_tensor, axis, keepdims, name) :
gen_math_ops._any(input_tensor, r, keepdims, name);
return _may_reduce_to_scalar(keepdims, axis, max);
}

public static Tensor reduce_max(Tensor input_tensor, int[] axis = null, bool keepdims = false, string name = null)
{
var r = _ReductionDims(input_tensor, axis);


Loading…
Cancel
Save