Ejemplo n.º 1
0
        public void Evaluate(TVar result)
        {
            if (!result.Expression.IsValidLvalue)
            {
                throw new InvalidOperationException("cannot write to given result - it is not a valid lvalue");
            }

            using (var res = result.Expression.Evaluate(null))
            {
                this.expression.Evaluate(res);
            }
        }
Ejemplo n.º 2
0
 public TVar Pow(TVar y)
 {
     return(new TVar(new BinaryScalarTensorExpression(this.Expression, y.Expression, Ops.Tpow)));
 }
Ejemplo n.º 3
0
 // Returns a copy of this tensor, with the given indices filled with the given value.
 // If, when this op is evaluated, the write target is the same tensor as this, then the copy is unnecessary and is skipped.
 public TVar ScatterFill(SVar value, int dimension, TVar indices)
 {
     return(new TVar(new ScatterFillExpression(this.Expression, value, dimension, indices.Expression)));
 }
Ejemplo n.º 4
0
 public TVar Scatter(int dimension, TVar indices)
 {
     return(new TVar(new BinaryTensorTensorExpression(this.Expression, indices.Expression, (res, src, ind) => Ops.Scatter(res, src, dimension, ind))));
 }
Ejemplo n.º 5
0
 public static TVar Lerp(TVar a, TVar b, SVar weight)
 {
     return(new TVar(new BinaryTensorTensorExpression(a.Expression, b.Expression, (res, aVal, bVal) => Ops.Lerp(res, aVal, bVal, weight.Evaluate()))));
 }
Ejemplo n.º 6
0
 public static TVar Atan2(TVar y, TVar x)
 {
     return(new TVar(new BinaryTensorTensorExpression(x.Expression, y.Expression, Ops.Atan2)));
 }
Ejemplo n.º 7
0
 public TVar CDiv(TVar rhs)
 {
     return(new TVar(new BinaryTensorTensorExpression(this.Expression, rhs.Expression, Ops.Div)));
 }
Ejemplo n.º 8
0
 // Returns beta * this + alpha * m1 * m2
 public TVar Addmm(float beta, float alpha, TVar m1, TVar m2)
 {
     return(new TVar(new AddmmExpression(beta, this.Expression, alpha, m1.Expression, m2.Expression)));
 }