Esempio n. 1
0
 /// <summary>
 /// Divs the specified RHS.
 /// </summary>
 /// <param name="rhs">The RHS.</param>
 /// <returns>TVar.</returns>
 public static Variable Div(Variable lhs, ScalarVar rhs)
 {
     return(new Variable(new BinaryTensorScalarExpression(lhs.Expression, rhs.Expression, Ops.Div)));
 }
Esempio n. 2
0
 /// <summary>
 /// Lerps the specified a.
 /// </summary>
 /// <param name="a">a.</param>
 /// <param name="b">The b.</param>
 /// <param name="weight">The weight.</param>
 /// <returns>TVar.</returns>
 public static Variable Lerp(Variable a, Variable b, ScalarVar weight)
 {
     return(new Variable(new BinaryTensorTensorExpression(a.Expression, b.Expression, (res, aVal, bVal) => Ops.Lerp(res, aVal, bVal, weight.Evaluate()))));
 }
Esempio n. 3
0
 /// <summary>
 /// Pows the specified y.
 /// </summary>
 /// <param name="y">The y.</param>
 /// <returns>TVar.</returns>
 public static Variable Pow(Variable t, ScalarVar y)
 {
     return(new Variable(new BinaryTensorScalarExpression(t.Expression, y.Expression, Ops.Pow)));
 }
Esempio n. 4
0
 /// <summary>
 /// Clamps the specified minimum.
 /// </summary>
 /// <param name="min">The minimum.</param>
 /// <param name="max">The maximum.</param>
 /// <returns>TVar.</returns>
 public static Variable Clip(Variable t, ScalarVar min, ScalarVar max)
 {
     return(new Variable(new UnaryTensorExpression(t.Expression, (res, src) => Ops.Clamp(res, src, min.Evaluate(), max.Evaluate()))));
 }
Esempio n. 5
0
 /// <summary>
 /// Gets or sets the value of the given scalar variable.
 /// </summary>
 /// <param name="s">The scalar variable to access.</param>
 public IValue this[ScalarVar s] {
     get => Scalars.ContainsKey(s.Value) ? Scalars[s.Value] : Parent?[s];