'Function to perform compound kernel call for batch normalization
forward pass.
Arguments:
x (Tensor): Input from previous layer
xsum (Tensor): Precomputed batch sum over PQN dimension
xvar (Tensor): Buffer for variance (computed in kernel)
gmean (Tensor): global mean ()
gvar (Tensor): global variance
gamma (Tensor): scale parameter
beta (Tensor): location parameter
y (Tensor): normalized output
eps (float): constant for numerical stability
rho (float): exponential window averaging constant
accumbeta (float): value to scale output by before accumulating
relu (bool): Compound ReLU activation in kernel
threads (int): Number of GPU threads
repeat (int): Repeats for benchmarking
binary (bool): Binary shift based computations'

def compound_fprop_bn(self, x, xsum, xvar, gmean, gvar, gamma, beta, y, eps, rho, compute_batch_sum, accumbeta=0.0, relu=False, threads=None, repeat=1, binary=False, inference=False, outputs=None, layer=None):

    assert (xsum.dtype.type is np.float32)
    if inference:
        xhat = ((x - gmean) / self.sqrt((gvar + eps)))
        y[:] = (((y * accumbeta) + (xhat * gamma)) + beta)
        return
    if compute_batch_sum:
        xsum[:] = self.sum(x, axis=1)
    K = int(x.shape[0])
    N = int(x.shape[1])
    if (threads is None):
        if (N <= 8192):
            threads = (1 << max(5, (int(round(log(N, 2))) - 3)))
        else:
            occup = (K / (128.0 * _get_sm_count()))
            for t in (32, 64, 128, 256, 512):
                if ((occup * t) > 5.0):
                    threads = t
                    break
    if (threads is None):
        threads = 1024
    params = [(K, 1, 1), (threads, 1, 1), x.backend.stream, y.gpudata, xvar.gpudata, gmean.gpudata, gvar.gpudata, x.gpudata, xsum.gpudata, gmean.gpudata, gvar.gpudata, gamma.gpudata, beta.gpudata, eps, rho, accumbeta, N, relu, binary]
    from neon.backends.float_ew import _get_bn_fprop_kernel
    kernel = _get_bn_fprop_kernel(x.dtype.str[1:], threads, self.compute_capability)
    self._execute_bn(kernel, params, repeat, (x.nbytes * 2), N)
