'Accuracy computation op.
Parameters
mod_y : tf.Tensor
Model output tensor.
ref_y : tf.Tensor
Reference input tensor.
summary : bool, optional (default = True)
Whether to save tf summary for the op.
Returns
tf.Tensor : accuracy op. tensor'

@staticmethod
def accuracy(mod_y, ref_y, summary=True, name='accuracy'):

    with tf.name_scope(name):
        mod_pred = tf.argmax(mod_y, 1)
        correct_pred = tf.equal(mod_pred, tf.argmax(ref_y, 1))
        accuracy = tf.reduce_mean(tf.cast(correct_pred, tf.float32))
        if summary:
            tf.summary.scalar('accuracy', accuracy)
        return accuracy
