code: def test_conv_rand(backend_default, rand_convargs, deltas_buffer):
      (
          indim,
          nifm,
          fshape,
          nofm,
          batch_size,
          stride,
          rng_max,
          w_rng,
          pad,
      ) = rand_convargs
      if isinstance(
          NervanaObject.be, NervanaGPU
      ) and NervanaObject.be.compute_capability < (5, 0):
          if nifm % 4 != 0:
              pytest.skip(
                  msg="C dim must be a multiple of 4 for Kepler bprop kernel"
              )
  
      NervanaObject.be.bsz = batch_size
      inp_rng = [0.0, rng_max]
      dtypeu = np.float32
      init_unif = Uniform(low=w_rng[0], high=w_rng[1])
  
      inshape = (nifm, indim, indim)
      insize = np.prod(inshape)
  
      # generate neon conv layer
      neon_layer = Convolution(
          fshape=(fshape, fshape, nofm),
          strides=stride,
          padding=pad,
          init=init_unif,
      )
  
      # generate the reference layer
      ref_layer = ConvLayerRef(
          1,
          batch_size,
          identity,
          inshape[0],
          inshape[1:3],
          (fshape, fshape),
          nofm,
          stride,
          dtypeu,
          padding=pad,
      )
  
      # setup input in range inp_rng
      inpa = np.random.random((insize, batch_size))
      inpa *= inp_rng[1] - inp_rng[0]
      inpa += inp_rng[0]
      inpa = inpa.astype(dtypeu)
      inp = neon_layer.be.array(inpa)
      inp.lshape = inshape
  
      # run fprop on neon
      neon_layer.configure(inshape)
      neon_layer.prev_layer = True
      neon_layer.allocate()
  
      neon_layer.allocate_deltas(deltas_buffer)
      deltas_buffer.allocate_buffers()
      neon_layer.set_deltas(deltas_buffer)
  
      neon_out = neon_layer.fprop(inp).get()
  
      # pull neon weights into ref layer weights
      ref_layer.weights = neon_layer.W.get().T
      ref_layer.fprop(inpa.T)
      ref_out = np.copy(ref_layer.y)
  
      # estimate the numerical precision by
      # permuting order of ops in ref layer
      # fprop calculation
      ref_layer.fprop(inpa.T, permute=True)
      ref_out_perm = ref_layer.y
      atol = 4 * np.max(np.abs(ref_out - ref_out_perm))
  
      # compare ref and neon layer fprop outputs
      # using the empirically determined atol
      assert allclose_with_out(
          ref_out.T, neon_out, atol=atol, rtol=1.0e-4
      )
  
      # generate random deltas array
      erra = np.random.random(neon_out.shape)
      erra *= inp_rng[1] - inp_rng[0]
      erra += inp_rng[0]
  
      erra = erra.astype(dtypeu)
      err = neon_layer.be.array(erra)
  
      # run neon bprop
      neon_deltas = neon_layer.bprop(err).get()
      neon_dW = neon_layer.dW.get()
  
      # run ref code bprop
      ref_layer.bprop(erra.T, 1.0)
      ref_deltas = np.copy(ref_layer.berror_nopad.T)
      ref_dW = np.copy(ref_layer.updates)
  
      # estimate precision using permutation
      # of operation order on ref layer code
      ref_layer.bprop(erra.T, 1.0, permute=True)
      ref_deltas_perm = ref_layer.berror_nopad.T
      ref_dW_perm = ref_layer.updates
  
      atol = 4 * np.max(np.abs(ref_deltas - ref_deltas_perm))
      assert allclose_with_out(
          ref_deltas, neon_deltas, atol=atol, rtol=1.0e-4
      )
  
      atol = 4 * np.max(np.abs(ref_dW - ref_dW_perm))
      assert allclose_with_out(
          ref_dW.T, neon_dW, atol=atol, rtol=1.0e-4
      )
      return
  
imports: import itertools
  import numpy
  import pytest
  from neon import NervanaObject
  from neon.layers.layer import Convolution
  from neon.initializers.initializer import Uniform
  from utils import allclose_with_out
label_desc: Use image node_id 4 for calling a global function with example usage: test_conv_rand(backend_default, rand_convargs, deltas_buffer) without return types