class_docstr: To retain the output of the named layer during the computation of
  the given network:
  
      with Trace(net, 'layer.name') as ret:
          _ = net(inp)
          representation = ret.output
  
  A layer module can be passed directly without a layer name, and
  its output will be retained.  By default, a direct reference to
  the output object is returned, but options can control this:
  
      clone=True  - retains a copy of the output, which can be
          useful if you want to see the output before it might
          be modified by the network in-place later.
      detach=True - retains a detached reference or copy.  (By
          default the value would be left attached to the graph.)
      retain_grad=True - request gradient to be retained on the
          output.  After backward(), ret.output.grad is populated.
  
      retain_input=True - also retains the input.
      retain_output=False - can disable retaining the output.
      edit_output=fn - calls the function to modify the output
          of the layer before passing it the rest of the model.
          fn can optionally accept (output, layer) arguments
          for the original output and the layer name.
      stop=True - throws a StopForward exception after the layer
          is run, which allows running just a portion of a model.
class_docstr_tok: ["To","retain","the","output","of","the","named","layer","during","the","computation","of","the","given","network",":","with","Trace","(","net",",","'layer.name","'",")","as","ret",":","_","=","net","(","inp",")","representation","=","ret.output","A","layer","module","can","be","passed","directly","without","a","layer","name",",","and","its","output","will","be","retained",".","By","default",",","a","direct","reference","to","the","output","object","is","returned",",","but","options","can","control","this",":","clone=True","-","retains","a","copy","of","the","output",",","which","can","be","useful","if","you","want","to","see","the","output","before","it","might","be","modified","by","the","network","in-place","later",".","detach=True","-","retains","a","detached","reference","or","copy",".","(","By","default","the","value","would","be","left","attached","to","the","graph",".",")","retain_grad=True","-","request","gradient","to","be","retained","on","the","output",".","After","backward","(",")",",","ret.output.grad","is","populated",".","retain_input=True","-","also","retains","the","input",".","retain_output=False","-","can","disable","retaining","the","output",".","edit_output=fn","-","calls","the","function","to","modify","the","output","of","the","layer","before","passing","it","the","rest","of","the","model",".","fn","can","optionally","accept","(","output",",","layer",")","arguments","for","the","original","output","and","the","layer","name",".","stop=True","-","throws","a","StopForward","exception","after","the","layer","is","run",",","which","allows","running","just","a","portion","of","a","model","."]
code: def __exit__(self, type, value, traceback):
      self.close()
      if self.stop and issubclass(type, StopForward):
          return True
  
imports: import contextlib
  import copy
  import inspect
  from collections import OrderedDict
  import torch
label_desc: Use image node_id 3 for calling the Trace obj's underlying member method code with example usage: obj.__exit__(type, value, traceback) and returns: True