Raises an exception if the tensor rank is not of the expected rank.

tensor A tf.Tensor to check the rank of.
expected_rank Python integer or list of integers, expected rank.
name Optional name of the tensor for the error message.

ValueError If the expected shape doesn't match the actual shape.