Skip to content

Commit 41d4e84

Browse files
committed
tf.sin, tf.sinh, tf.sum, tf.tan, tf.tanh
1 parent c491c17 commit 41d4e84

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

src/TensorFlowNET.Core/APIs/tf.math.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,24 @@ public static Tensor arg_min(Tensor input, int dimension, TF_DataType output_typ
5454
public static Tensor ceil(Tensor x, string name = null)
5555
=> gen_math_ops.ceil(x, name);
5656

57+
/// <summary>
58+
/// Computes sin of x element-wise.
59+
/// </summary>
60+
/// <param name="x"></param>
61+
/// <param name="name"></param>
62+
/// <returns></returns>
63+
public static Tensor sin(Tensor x, string name = null)
64+
=> gen_math_ops.sin(x, name);
65+
66+
/// <summary>
67+
/// Computes hyperbolic sine of x element-wise.
68+
/// </summary>
69+
/// <param name="x"></param>
70+
/// <param name="name"></param>
71+
/// <returns></returns>
72+
public static Tensor sinh(Tensor x, string name = null)
73+
=> gen_math_ops.sinh(x, name);
74+
5775
/// <summary>
5876
/// Computes cos of x element-wise.
5977
/// </summary>
@@ -72,6 +90,12 @@ public static Tensor cos(Tensor x, string name = null)
7290
public static Tensor cosh(Tensor x, string name = null)
7391
=> gen_math_ops.cosh(x, name);
7492

93+
public static Tensor tan(Tensor x, string name = null)
94+
=> gen_math_ops.tan(x, name);
95+
96+
public static Tensor tanh(Tensor x, string name = null)
97+
=> gen_math_ops.tanh(x, name);
98+
7599
/// <summary>
76100
/// Returns element-wise largest integer not greater than x.
77101
/// </summary>
@@ -257,6 +281,9 @@ public static Tensor reduce_sum(Tensor input, int axis, int? reduction_indices =
257281
return math_ops.reduce_sum(input, axis);
258282
}
259283

284+
public static Tensor sum(Tensor input, int axis, bool keep_dims = false, string name = null)
285+
=> gen_math_ops._sum(input, axis, keep_dims: keep_dims, name: name);
286+
260287
public static Tensor reduce_mean(Tensor input_tensor, int[] axis = null, bool keepdims = false, string name = null, int? reduction_indices = null)
261288
=> math_ops.reduce_mean(input_tensor, axis: axis, keepdims: keepdims, name: name, reduction_indices: reduction_indices);
262289

src/TensorFlowNET.Core/Operations/gen_math_ops.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ public static Tensor ceil(Tensor x, string name = null)
101101
return _op.outputs[0];
102102
}
103103

104+
public static Tensor sin(Tensor x, string name = null)
105+
{
106+
var _op = _op_def_lib._apply_op_helper("Sin", name, args: new { x });
107+
108+
return _op.outputs[0];
109+
}
110+
111+
public static Tensor sinh(Tensor x, string name = null)
112+
{
113+
var _op = _op_def_lib._apply_op_helper("Sinh", name, args: new { x });
114+
115+
return _op.outputs[0];
116+
}
117+
104118
public static Tensor cos(Tensor x, string name = null)
105119
{
106120
var _op = _op_def_lib._apply_op_helper("Cos", name, args: new { x });
@@ -115,6 +129,20 @@ public static Tensor cosh(Tensor x, string name = null)
115129
return _op.outputs[0];
116130
}
117131

132+
public static Tensor tan(Tensor x, string name = null)
133+
{
134+
var _op = _op_def_lib._apply_op_helper("Tan", name, args: new { x });
135+
136+
return _op.outputs[0];
137+
}
138+
139+
public static Tensor tanh(Tensor x, string name = null)
140+
{
141+
var _op = _op_def_lib._apply_op_helper("Tanh", name, args: new { x });
142+
143+
return _op.outputs[0];
144+
}
145+
118146
public static Tensor floor(Tensor x, string name = null)
119147
{
120148
var _op = _op_def_lib._apply_op_helper("Floor", name, args: new { x });

0 commit comments

Comments
 (0)