/// <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))); }
/// <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())))); }
/// <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))); }
/// <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())))); }
/// <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];