Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e007e86

Browse files
Lee ReidOceania2018
Lee Reid
authored andcommitted
Fixed many simple functions in gen_math_ops.cs
1 parent a814d2d commit e007e86

File tree

1 file changed

+8
-38
lines changed

1 file changed

+8
-38
lines changed

src/TensorFlowNET.Core/Operations/gen_math_ops.cs

+8-38
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,10 @@ private static Tensor prod_eager_fallback(Tensor input_t, int[] axis, bool keep_
161161
}
162162

163163
public static Tensor acos(Tensor x, string name = null)
164-
{
165-
var _op = tf.OpDefLib._apply_op_helper("Acos", name, args: new { x });
166-
167-
return _op.outputs[0];
168-
}
164+
=> tf.Context.ExecuteOp("Acos", name, new ExecuteOpArgs(x));
169165

170166
public static Tensor asin(Tensor x, string name = null)
171-
{
172-
var _op = tf.OpDefLib._apply_op_helper("Asin", name, args: new { x });
173-
174-
return _op.outputs[0];
175-
}
167+
=> tf.Context.ExecuteOp("Asin", name, new ExecuteOpArgs(x));
176168

177169
public static Tensor add(Tensor x, Tensor y, string name = null)
178170
=> tf.Context.ExecuteOp("Add", name, new ExecuteOpArgs(x, y));
@@ -233,21 +225,13 @@ public static Tensor sign<T>(T x, string name = "Sign")
233225
=> tf.Context.ExecuteOp("Sign", name, new ExecuteOpArgs(x));
234226

235227
public static Tensor sinh(Tensor x, string name = null)
236-
{
237-
var _op = tf.OpDefLib._apply_op_helper("Sinh", name, args: new { x });
238-
239-
return _op.outputs[0];
240-
}
228+
=> tf.Context.ExecuteOp("Sinh", name, new ExecuteOpArgs(x));
241229

242230
public static Tensor cos<T>(T x, string name = null)
243231
=> tf.Context.ExecuteOp("Cos", name, new ExecuteOpArgs(x));
244232

245233
public static Tensor cosh(Tensor x, string name = null)
246-
{
247-
var _op = tf.OpDefLib._apply_op_helper("Cosh", name, args: new { x });
248-
249-
return _op.outputs[0];
250-
}
234+
=> tf.Context.ExecuteOp("Cosh", name, new ExecuteOpArgs(x));
251235

252236
/// <summary>
253237
/// Computes the sum along segments of a tensor.
@@ -308,11 +292,8 @@ public static Tensor greater<Tx, Ty>(Tx x, Ty y, string name = null)
308292
/// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
309293
/// </returns>
310294
public static Tensor lgamma(Tensor x, string name = null)
311-
{
312-
var op = tf.OpDefLib._apply_op_helper("Lgamma", name: name, args: new { x });
295+
=> tf.Context.ExecuteOp("Lgamma", name, new ExecuteOpArgs(x));
313296

314-
return op.output;
315-
}
316297

317298
public static Tensor greater_equal<Tx, Ty>(Tx x, Ty y, string name = null)
318299
=> tf.Context.ExecuteOp("GreaterEqual", name, new ExecuteOpArgs(x, y));
@@ -365,18 +346,11 @@ public static Tensor square(Tensor x, string name = null)
365346
/// <param name="name"> A name for the operation (optional).</param>
366347
/// <returns> A `Tensor` of type `bool`.</returns>
367348
public static Tensor is_finite(Tensor x, string name = null)
368-
{
369-
var _op = tf.OpDefLib._apply_op_helper("IsFinite", name, args: new { x });
370-
371-
return _op.outputs[0];
372-
}
349+
=> tf.Context.ExecuteOp("IsFinite", name, new ExecuteOpArgs(x));
373350

374351
public static Tensor is_nan(Tensor x, string name = null)
375-
{
376-
var _op = tf.OpDefLib._apply_op_helper("IsNan", name: name, args: new { x });
352+
=> tf.Context.ExecuteOp("IsNan", name, new ExecuteOpArgs(x));
377353

378-
return _op.outputs[0];
379-
}
380354

381355
/// <summary>
382356
/// Computes exponential of x element-wise. \\(y = e^x\\).
@@ -577,11 +551,7 @@ public static Tensor range(Tensor start, Tensor limit, Tensor delta, string name
577551
/// according to the current system rounding mode use std::cint.
578552
/// </remarks>
579553
public static Tensor round(Tensor x, string name = "Round")
580-
{
581-
var op = tf.OpDefLib._apply_op_helper("Round", name: name, new { x });
582-
583-
return op.output;
584-
}
554+
=> tf.Context.ExecuteOp("Round", name, new ExecuteOpArgs(x));
585555

586556
/// <summary>
587557
/// Computes reciprocal of square root of x element-wise.

0 commit comments

Comments
 (0)