public void Visit(Compiled.UnaryFunc elem)
            {
                double arg = ValueOf(elem.Arg);

                elem.Value            = elem.Eval(arg);
                elem.Inputs[0].Weight = elem.Diff(arg);
            }
コード例 #2
0
            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;
                }));
            }
コード例 #3
0
            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;
                }));
            }
コード例 #4
0
 public void Visit(Compiled.UnaryFunc elem)
 {
     elem.Value = elem.Eval(ValueOf(elem.Arg));
 }