def batch_norm(self, inputs, name=''):
    mean = tf.reduce_mean(inputs)
    std = tf.math.reduce_std(inputs)
    var = (std ** 2)
    try:
        idx_offset = self.name_bank.index(('%s_offset' % name))
        idx_scale = self.name_bank.index(('%s_scale' % name))
    except:
        offset = tf.Variable(0, name=('%s_offset' % name), trainable=True, dtype=tf.float32)
        self.name_bank.append(('%s_offset' % name))
        self.params_trainable.append(offset)
        self.num_params += 1
        scale = tf.Variable(1, name=('%s_scale' % name), trainable=True, dtype=tf.float32)
        self.name_bank.append(('%s_scale' % name))
        self.params_trainable.append(scale)
        self.num_params += 1
    else:
        offset = self.params_trainable[idx_offset]
        scale = self.params_trainable[idx_scale]
    offset
    scale
    out = tf.nn.batch_normalization(x=inputs, mean=mean, variance=var, offset=offset, scale=scale, variance_epsilon=1e-12, name=name)
    return out
def batch_norm(self, inputs, name=):
    mean = tf.reduce_mean(inputs)
    std = tf.math.reduce_std(inputs)
    var = (std ** 2)
    try:
        idx_offset = self.name_bank.index(('%s_offset' % name))
        idx_scale = self.name_bank.index(('%s_scale' % name))
    except:
        offset = tf.Variable(0, name=('%s_offset' % name), trainable=True, dtype=tf.float32)
        self.name_bank.append(('%s_offset' % name))
        self.params_trainable.append(offset)
        self.num_params += 1
        scale = tf.Variable(1, name=('%s_scale' % name), trainable=True, dtype=tf.float32)
        self.name_bank.append(('%s_scale' % name))
        self.params_trainable.append(scale)
        self.num_params += 1
    else:
        offset = self.params_trainable[idx_offset]
        scale = self.params_trainable[idx_scale]
    offset
    scale
    out = tf.nn.batch_normalization(x=inputs, mean=mean, variance=var, offset=offset, scale=scale, variance_epsilon=1e-12, name=name)
    return out