예제 #1
0
        // hook autograd single parent
        public void HookAutograd(ref FloatTensor result, string creation_op)
        {
            if (autograd)
            {
                result.InitAutograd();
                result.creators.Add(this);
                result.creation_op = creation_op;

                children.Add(result.Id, 0);
            }
        }
예제 #2
0
        // hook autograd two parents - one scalar
        public void HookAutograd(ref FloatTensor result, float x, string creation_op)
        {
            if (autograd)
            {
                FloatTensor new_child = new FloatTensor(_ctrl: ctrl, _shape: new int[] { 1 }, _data: new float[] { x });

                result.InitAutograd();
                result.creators.Add(this);
                result.creators.Add(new_child);
                result.creation_op = creation_op;

                children.Add(result.Id, 0);
//				new_child.children.Add (result.Id, 0);
            }
        }