import tensorflow as tf


  Returns:
    A Tensor of size [batch_size], denoting the error between the quaternions.
  """
  assertions = []
  assertions.append(
      tf.Assert(
          tf.reduce_all(tf.less(tf.abs(tf.reduce_sum(tf.square(predictions), [1]) - 1), 1e-4)),
          ['The l2 norm of each prediction quaternion vector should be 1.']))
  assertions.append(
      tf.Assert(
          tf.reduce_all(tf.less(tf.abs(tf.reduce_sum(tf.square(labels), [1]) - 1), 1e-4)),
          ['The l2 norm of each label quaternion vector should be 1.']))
  with tf.name_scope(name):
