import tensorflow as tf

  shape = np.array(shape)
  tt_rank = np.array(tt_rank)
  _validate_input_parameters(is_tensor=False, shape=shape, tt_rank=tt_rank)

  num_dims = shape[0].size
  if tt_rank.size == 1:
    tt_rank = tt_rank * np.ones(num_dims - 1)
    tt_rank = np.concatenate([[1], tt_rank, [1]])

  tt_rank = tt_rank.astype(int)
  tt_cores = [None] * num_dims
  with tf.name_scope(name):
    for i in range(num_dims):
      curr_core_shape = (tt_rank[i], shape[0][i], shape[1][i],
                         tt_rank[i + 1])
      tt_cores[i] = tf.random_normal(curr_core_shape, mean=mean, stddev=stddev,
                                     dtype=dtype)

    return TensorTrain(tt_cores, shape, tt_rank)


def matrix_batch_with_random_cores(shape, tt_rank=2, batch_size=1,
