class_docstr: Automatic differentiation given an op-tree.
  
  Arguments:
      op_tree (OpTreeNode): the op-tree to take gradient of
      be (Backend): computation backend used
      next_error (Tensor or OpTreeNode, optional): next layer's error, usually
                                                   self.delta in a layer. If
                                                   set to None, then automatically
                                                   the default value is tensor
                                                   ones() in output shape
class_docstr_tok: ["Automatic","differentiation","given","an","op-tree",".","Arguments",":","op_tree","(","OpTreeNode",")",":","the","op-tree","to","take","gradient","of","be","(","Backend",")",":","computation","backend","used","next_error","(","Tensor","or","OpTreeNode",",","optional",")",":","next","layer","'s","error",",","usually","self.delta","in","a","layer",".","If","set","to","None",",","then","automatically","the","default","value","is","tensor","ones","(",")","in","output","shape"]
code: def __init__(self, op_tree, be, next_error=None):
      # check type
      assert (
          type(op_tree) in _scalar_types
          or type(op_tree) == OpTreeNode
          or isinstance(op_tree, Tensor)
      ), "op_tree type not supported"
      assert be is not None
  
      # attributes
      self.op_tree = op_tree
      self.be = be
      self.dtype = be.default_dtype
      if next_error is not None:
          assert next_error.shape == op_tree.shape, (
              "next_error.shape %s must be consistant with op_tree.shape %s"
              % (next_error.shape, op_tree.shape)
          )
          self.next_error = next_error
      else:
          self.next_error = self.be.ones(op_tree.shape)
  
      self.map_tensor_grad_node = {}  # for building grad tree
      self.map_tensor_grad_op_tree = {}  # quick access to grad_op_tree
  
      # build_grad
      self.grad_node = GradNode(op_tree, self)
      if self.next_error:
          self.grad_node.grad_op_tree = self.next_error
      else:
          self.grad_node.grad_op_tree = self.be.ones(self.op_tree.shape)
      self.grad_node.build_grad()
  
imports: from __future__ import division
  from builtins import object, zip
  from neon.backends.backend import OpTreeNode, Tensor
  import numpy
  from functools import wraps
label_desc: Use image node_id 1 to create a new Autodiff object from inherited base classes: object with example: obj = Autodiff(op_tree, be, next_error)