import tensorflow as tf

          name = "core%d" % i
          tt_cores[i] = tf.convert_to_tensor(tt_cores[i], name=name)

    if not _are_tt_cores_valid(tt_cores, shape, tt_ranks):
      raise ValueError('The tt_cores provided to TensorTrain constructor are '
                       'not valid, have different dtypes, or are inconsistent '
                       'with the provided shape or TT-ranks.')

    self._tt_cores = tuple(tt_cores)
    self._raw_shape = shapes.clean_raw_shape(shape)
    if self._raw_shape is None:
      self._raw_shape = _infer_raw_shape(self._tt_cores)
    self._tt_ranks = None if tt_ranks is None else tf.TensorShape(tt_ranks)
    if self._tt_ranks is None:
      self._tt_ranks = _infer_tt_ranks(self._tt_cores)

  @property
  def tt_cores(self):
    """A tuple of TT-cores.

    Returns:
      A tuple of 3d or 4d tensors shape
        `[r_k-1, n_k, r_k]`
      or
