Exemplo n.º 1
0
 public ScatterFillExpression(TExpression src, SVar value, int dimension, TExpression indices)
 {
     this.src       = src;
     this.value     = value;
     this.dimension = dimension;
     this.indices   = indices;
 }
Exemplo n.º 2
0
 public static SVar Lerp(SVar a, SVar b, SVar weight)
 {
     return(new SVar(new DelegateScalarExpression(() => LerpFloat(a.Evaluate(), b.Evaluate(), weight.Evaluate()))));
 }
Exemplo n.º 3
0
        // public TVar Pow(TVar y) { return new TVar(new BinaryScalarTensorExpression(this.Expression, y.Expression, Ops.Tpow)); }


        public static SVar Atan2(SVar y, SVar x)
        {
            return(new SVar(new DelegateScalarExpression(() => (float)Math.Atan2(y.Evaluate(), x.Evaluate()))));
        }
Exemplo n.º 4
0
 public SVar Clamp(SVar min, SVar max)
 {
     return(new SVar(new DelegateScalarExpression(() => ClampFloat(expression.Evaluate(), min.expression.Evaluate(), max.expression.Evaluate()))));
 }
Exemplo n.º 5
0
 public SVar Pow(SVar y)
 {
     return(new SVar(new BinaryScalarExpression(expression, y.expression, (xVal, yVal) => (float)Math.Pow(xVal, yVal))));
 }
Exemplo n.º 6
0
 public static TVar Fill(SVar value, IAllocator allocator, DType type, params long[] sizes)
 {
     return(new TVar(new FillExpression(allocator, type, sizes, res => Ops.Fill(res, value.Evaluate()))));
 }
Exemplo n.º 7
0
 public static TVar RandomBernoulli(SeedSource seedSource, SVar p, IAllocator allocator, DType type, params long[] sizes)
 {
     return(new TVar(new FillExpression(allocator, type, sizes, res => Ops.RandomBernoulli(res, seedSource, p.Evaluate()))));
 }
Exemplo n.º 8
0
 public static TVar RandomCauchy(SeedSource seedSource, SVar median, SVar sigma, IAllocator allocator, DType type, params long[] sizes)
 {
     return(new TVar(new FillExpression(allocator, type, sizes, res => Ops.RandomCauchy(res, seedSource, median.Evaluate(), sigma.Evaluate()))));
 }
Exemplo n.º 9
0
 public static TVar RandomLogNormal(SeedSource seedSource, SVar mean, SVar stdv, IAllocator allocator, DType type, params long[] sizes)
 {
     return(new TVar(new FillExpression(allocator, type, sizes, res => Ops.RandomLogNormal(res, seedSource, mean.Evaluate(), stdv.Evaluate()))));
 }
Exemplo n.º 10
0
 public static TVar RandomUniform(SeedSource seedSource, SVar min, SVar max, IAllocator allocator, DType type, params long[] sizes)
 {
     return(new TVar(new FillExpression(allocator, type, sizes, res => Ops.RandomUniform(res, seedSource, min.Evaluate(), max.Evaluate()))));
 }
Exemplo n.º 11
0
 public static TVar RandomExponential(SeedSource seedSource, SVar lambda, IAllocator allocator, DType type, params long[] sizes)
 {
     return(new TVar(new FillExpression(allocator, type, sizes, res => Ops.RandomExponential(res, seedSource, lambda.Evaluate()))));
 }
Exemplo n.º 12
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)));
 }
Exemplo n.º 13
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()))));
 }
Exemplo n.º 14
0
 public TVar Clamp(SVar min, SVar max)
 {
     return(new TVar(new UnaryTensorExpression(this.Expression, (res, src) => Ops.Clamp(res, src, min.Evaluate(), max.Evaluate()))));
 }
Exemplo n.º 15
0
 public TVar Pow(SVar y)
 {
     return(new TVar(new BinaryTensorScalarExpression(this.Expression, y.Expression, Ops.Pow)));
 }
Exemplo n.º 16
0
 public TVar Div(SVar rhs)
 {
     return(new TVar(new BinaryTensorScalarExpression(this.Expression, rhs.Expression, Ops.Div)));
 }