Browse Source

tf.reduce_prod, tf.add_to_collections, tf.identity. #396

tags/v0.12
Oceania2018 6 years ago
parent
commit
c2138b20ab
3 changed files with 28 additions and 0 deletions
  1. +9
    -0
      src/TensorFlowNET.Core/APIs/tf.array.cs
  2. +11
    -0
      src/TensorFlowNET.Core/APIs/tf.math.cs
  3. +8
    -0
      src/TensorFlowNET.Core/APIs/tf.ops.cs

+ 9
- 0
src/TensorFlowNET.Core/APIs/tf.array.cs View File

@@ -94,6 +94,15 @@ namespace Tensorflow
public Tensor fill<T>(Tensor dims, T value, string name = null)
=> gen_array_ops.fill(dims, value, name: name);

/// <summary>
/// Return a tensor with the same shape and contents as input.
/// </summary>
/// <param name="input"></param>
/// <param name="name"></param>
/// <returns></returns>
public static Tensor identity(Tensor input, string name = null)
=> array_ops.identity(input, name: name);

/// <summary>
/// Gather slices from params axis axis according to indices.
/// </summary>


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

@@ -414,6 +414,17 @@ namespace Tensorflow
public Tensor reduce_all(Tensor input_tensor, int[] axis = null, bool keepdims = false, string name = null)
=> math_ops.reduce_all(input_tensor, axis: axis, keepdims: keepdims, name: name);

/// <summary>
/// Computes the product of elements across dimensions of a tensor.
/// </summary>
/// <param name="input_tensor"></param>
/// <param name="axis"></param>
/// <param name="keepdims"></param>
/// <param name="name"></param>
/// <returns></returns>
public Tensor reduce_prod(Tensor input_tensor, int[] axis = null, bool keepdims = false, string name = null)
=> math_ops.reduce_prod(input_tensor, axis: axis, keepdims: keepdims, name: name);

/// <summary>
/// Computes the sum of elements across dimensions of a tensor.
/// </summary>


+ 8
- 0
src/TensorFlowNET.Core/APIs/tf.ops.cs View File

@@ -14,10 +14,18 @@
limitations under the License.
******************************************************************************/

using System.Collections.Generic;

namespace Tensorflow
{
public partial class tensorflow
{
public void add_to_collection<T>(string name, T value)
=> get_default_graph().add_to_collection(name, value);

public void add_to_collections<T>(List<string> names, T value)
=> get_default_graph().add_to_collections(names, value);

public Tensor assign(Tensor @ref, object value, bool validate_shape = true, bool use_locking = true, string name = null)
=> state_ops.assign(@ref, value, validate_shape, use_locking, name);



Loading…
Cancel
Save