import tensorflow as tf

    name: string, name of the Op.

  Returns:
    TensorTrain containing an identity TT-matrix of size
    np.prod(shape) x np.prod(shape)
  """
  shape = np.array(shape)
  # In this special case shape is in the same format as in the TT-tensor case
  _validate_input_parameters(is_tensor=True, shape=shape)

  num_dims = shape.size
  tt_ranks = np.ones(num_dims + 1)

  with tf.name_scope(name):
    tt_cores = num_dims * [None]
    for i in range(num_dims):
      curr_core_shape = (1, shape[i], shape[i], 1)
      tt_cores[i] = tf.reshape(tf.eye(shape[i], dtype=dtype), curr_core_shape)

    true_shape = np.vstack([shape, shape])
    return TensorTrain(tt_cores, true_shape, tt_ranks)


def matrix_ones(shape, dtype=tf.float32, name='t3f_matrix_ones'):
  """Generate a TT-matrix of the given shape with each entry equal to 1.

