code: def add(self, tensor, tf_sess=None, key=None, **kwargs):
          
          if not isinstance(tensor, Tensor):
              tensor = Tensor(tensor, tf_sess, **kwargs)
  
          if key is None:
              if len(self.roots) == 0:
                  key = 0
              else:
                  key = max(self.roots.keys()) + 1
  
          self.roots[key] = tensor
docs: Adds a new root *tensor* for a *key* which, if *None*, defaults to a consecutive number.
          When *tensor* is not an instance of :py:class:`Tensor` but an instance of
          ``tensorflow.Tensor``, it is converted first. In that case, *tf_sess* should be a valid
          tensorflow session and *kwargs* are forwarded to the :py:class:`Tensor` constructor.