import tensorflow as tf

        else:
          if remainder is not None:
            # Add reminder from the previous collapsed cores to the current
            # core.
            sliced_core = tf.einsum('ab,bid->aid', remainder, sliced_core)
            remainder = None
          new_tt_cores.append(sliced_core)

