title: How to solve the run time error "Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment"
body: <p>I want to use output variables of NN as an input in another function,but met with error like this 'Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment'.The out variables require gradient. </p>
  
  <p>I tried by changing the output variables to numpy values, but in that case the back propagataion does not work because it see numpy values as variables which does not need gradient.</p>
  
  <pre><code>output = model(SOC[13])
  
  # Three output values of NN
  Rs=output[0]
  R1=output[1]
  C1=output[2]
  
  # Using these variables in another function
  
  num1=[Rs*R1*C1,R1+Rs]
  den1=[C1*R1,1]
  G = control.tf(num,den)
  </code></pre>
  
  <p>It should work, but it gives error.</p>
  
  <pre><code>     14             num=[Rs*R1*C1,R1+Rs]
       15             den=[C1*R1,1]
  ---&gt; 16             G = control.tf(num,den)
  ~\Anaconda3\lib\site-packages\control\xferfcn.py in __init__(self, *args)
      106 
      107         """
  --&gt; 108         args = deepcopy(args)
      109         if len(args) == 2:
      110             # The user provided a numerator and a denominator.
  ~\Anaconda3\lib\site-packages\torch\tensor.py in __deepcopy__(self, memo)
       16     def __deepcopy__(self, memo):
       17         if not self.is_leaf:
  ---&gt; 18             raise RuntimeError("Only Tensors created explicitly by the user "
       19                                "(graph leaves) support the deepcopy protocol at the moment")
       20         if id(self) in memo:
  </code></pre>