Browse Source

tf.reverse #396

tags/v0.12
Oceania2018 6 years ago
parent
commit
c88d190a59
2 changed files with 19 additions and 0 deletions
  1. +13
    -0
      src/TensorFlowNET.Core/APIs/tf.array.cs
  2. +6
    -0
      src/TensorFlowNET.Core/Operations/gen_array_ops.cs

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

@@ -98,6 +98,19 @@ namespace Tensorflow
public Tensor transpose<T1>(T1 a, int[] perm = null, string name = "transpose", bool conjugate = false) public Tensor transpose<T1>(T1 a, int[] perm = null, string name = "transpose", bool conjugate = false)
=> array_ops.transpose(a, perm, name, conjugate); => array_ops.transpose(a, perm, name, conjugate);


/// <summary>
/// Reverses specific dimensions of a tensor.
/// </summary>
/// <param name="tensor"></param>
/// <param name="axis"></param>
/// <param name="name"></param>
/// <returns></returns>
public static Tensor reverse(Tensor tensor, int[] axis, string name = null)
=> gen_array_ops.reverse(tensor, axis, name: name);

public static Tensor reverse(Tensor tensor, Tensor axis, string name = null)
=> gen_array_ops.reverse(tensor, axis, name: name);

/// <summary> /// <summary>
/// Returns the rank of a tensor. /// Returns the rank of a tensor.
/// </summary> /// </summary>


+ 6
- 0
src/TensorFlowNET.Core/Operations/gen_array_ops.cs View File

@@ -228,6 +228,12 @@ namespace Tensorflow
return (_op.outputs[0], _op.outputs[1]); return (_op.outputs[0], _op.outputs[1]);
} }


public static Tensor reverse<T>(Tensor tensor, T axis, string name = null)
{
var _op = _op_def_lib._apply_op_helper("ReverseV2", name, new { tensor, axis });
return _op.output;
}

public static Tensor reshape<T1, T2>(T1 tensor, T2 shape, string name = null) public static Tensor reshape<T1, T2>(T1 tensor, T2 shape, string name = null)
{ {
var _op = _op_def_lib._apply_op_helper("Reshape", name, new { tensor, shape }); var _op = _op_def_lib._apply_op_helper("Reshape", name, new { tensor, shape });


Loading…
Cancel
Save