def __init__(self, ns_name, vs_name='', index=0, total=1):
        """
        Args:
            index (int): index of this tower, only used in training.
            total (int): total number of towers to be built.
        """
        super(TrainTowerContext, self).__init__(ns_name, vs_name)
        self._is_training = True

        self.index = int(index)
        self.total = int(total)
        if self.index > 0:
            assert self.total > self.index, "(index, total) = ({}, {})".format(self.index, self.total)

        vs = tf.get_variable_scope()
        assert vs.name == '', "Cannot nest TrainTowerContext with an existing variable scope!"
        if vs_name:
            assert not vs.reuse, \
                "Cannot create tower {} with vs_name={} under reuse=True!".format(ns_name, vs_name)
        self._original_vs_reuse = vs.reuse

        Args:
            index (int): index of this tower, only used in training.
            total (int): total number of towers to be built.
        
tensorpack/tfutils/tower.py