public void CustomOpSupportsLambda() { var x = T.Scalar <float>("x"); Scalar <float> y = CustomOp.Create("myCustomSinus", a => (float)Math.Sin(a), x); var f = T.Function(x, y); AssertAreCoherents(a => (float)Math.Sin(a), f); }
public void CustomOpSupportsStatic() { var x = T.Scalar <float>("x"); Scalar <float> y = CustomOp.Create("myCustomCosinus", Cos, x); var f = T.Function(x, y); AssertAreCoherents(Cos, f); }
public void CustomOpCanBeDerivated() { var x = T.Scalar <float>("x"); Scalar <float> y = CustomOp.Create("myCustomSinus", f: a => (float)Math.Sin(a), df_dx: (a, b) => CustomOp.Create("myCustomCosinus", Cos, a), x: x ); // f = d/dx(sin(x)) = cos(x) var f = T.Function(x, T.Grad(y, x)); AssertAreCoherents(Cos, f); }