'Function to perform batch normalization backward pass. Included
for API compatibility with GPU compound kernel call.
Arguments:
delta_out (Tensor): Delta buffer to write out to
grad_gamma (Tensor): Gradient w.r.t. gamma
grad_beta (Tensor): Gradient w.r.t. beta
delta_in (Tensor): Delta buffer to read from (incoming errors)
x (Tensor): feedforward input
xsum (Tensor): Batch sum over PQN dimension
xvar (Tensor): Batch variance
gamma (Tensor): scale parameter
eps (float): constant for numerical stability
binary (bool): Binary shift based computations'

def compound_bprop_bn(self, delta_out, grad_gamma, grad_beta, delta_in, x, xsum, xvar, gamma, eps, binary=False, layer=None):

    if binary:
        op = self.shift
    else:
        def multiply(left, right):
            return (left * right)
        op = multiply
    inv_v = (1.0 / self.sqrt((xvar + eps)))
    xhat = op((x - xsum), inv_v)
    grad_gamma[:] = self.sum((xhat * delta_in), axis=1)
    grad_beta[:] = self.sum(delta_in, axis=1)
    xtmp = ((op(xhat, grad_gamma) + grad_beta) / float(x.shape[1]))
    delta_out.reshape(delta_in.shape)[:] = op(op((delta_in - xtmp), gamma), inv_v)
