public override Tensor Evaluate(Tensor writeTarget) { using (var s = src.Evaluate(null)) using (var i = indices.Evaluate(null)) { if (!writeTarget.Equals(s)) { Ops.Copy(writeTarget, s); } Ops.ScatterFill(writeTarget, value.Evaluate(), dimension, i); } return(writeTarget); }
public static SVar Lerp(SVar a, SVar b, SVar weight) { return(new SVar(new DelegateScalarExpression(() => LerpFloat(a.Evaluate(), b.Evaluate(), weight.Evaluate())))); }
// 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())))); }
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())))); }
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())))); }
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())))); }
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())))); }
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())))); }
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())))); }
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())))); }
public TVar Clamp(SVar min, SVar max) { return(new TVar(new UnaryTensorExpression(this.Expression, (res, src) => Ops.Clamp(res, src, min.Evaluate(), max.Evaluate())))); }