class_docstr: A tower function (see
  `tutorial on tower function
  <http://tensorpack.readthedocs.io/tutorial/extend/trainer.html#tower-trainer>`_)
  It keeps track of the name scope, variable scope and input/output tensors
  each time the function is called.
  
  :class:`TowerTrainer` needs this so that it knows how to build a predictor.
  
  Conceptually, this class is roughly equivalent to `tf.function` with input signature, introduced in TF 2.0.
class_docstr_tok: ["A","tower","function","(","see","`","tutorial","on","tower","function","<","http",":","\/\/tensorpack.readthedocs.io\/tutorial\/extend\/trainer.html","#","tower-trainer",">","`","_",")","It","keeps","track","of","the","name","scope",",","variable","scope","and","input\/output","tensors","each","time","the","function","is","called",".",":","class",":","`","TowerTrainer","`","needs","this","so","that","it","knows","how","to","build","a","predictor",".","Conceptually",",","this","class","is","roughly","equivalent","to","`","tf.function","`","with","input","signature",",","introduced","in","TF","2.0","."]
code: def __new__(cls, tower_fn, _):
      # to avoid double-wrapping a function
      if isinstance(tower_fn, TowerFunc):
          return tower_fn
      else:
          return super(TowerFunc, cls).__new__(cls)
  
imports: from abc import ABCMeta, abstractmethod, abstractproperty
  import six
  from ..compat import tfv1
  from ..utils import logger
  from ..utils.argtools import call_only_once
  from ..utils.develop import HIDE_DOC
  from ..utils.naming import MOVING_SUMMARY_OPS_KEY
  from .collection import CollectionGuard
  from .common import get_op_or_tensor_by_name, get_op_tensor_name
label_desc: Use image node_id 2 for calling the TowerFunc obj's underlying member method code with example usage: obj.__new__(cls, tower_fn, _) and returns: tower_fn, super