public void Visit(Compiled.UnaryFunc elem) { double arg = ValueOf(elem.Arg); elem.Value = elem.Eval(arg); elem.Inputs[0].Weight = elem.Diff(arg); }
public TapeElement Visit(UnaryFunc func) { return(Compile(func, () => { var argElement = func.Argument.Accept(this); var element = new Compiled.UnaryFunc(func.Eval, func.Diff) { Inputs = MakeInputEdges(() => { edges.Add(new InputEdge { Element = argElement }); }), }; return element; })); }
public int Visit(UnaryFunc func) { return(Compile(func, () => { var argIndex = func.Argument.Accept(this); var element = new Compiled.UnaryFunc(func.Eval, func.Diff) { Arg = argIndex, Inputs = new Compiled.InputEdge[] { new Compiled.InputEdge { Index = argIndex }, }, }; return element; })); }
public void Visit(Compiled.UnaryFunc elem) { elem.Value = elem.Eval(ValueOf(elem.Arg)); }