code: def test_pad(batch_ndim, val, width=3):
      from lasagne.theano_extensions.padding import pad
  
      X = T.tensor4()
      X0 = lasagne.utils.floatX(np.ones((2, 3, 4, 5)))
      X_pad_theano = pad(X, width, val, batch_ndim).eval({X: X0})
  
      pads = tuple(
          (width, width) if i >= batch_ndim else (0, 0)
          for i, _ in enumerate(X0.shape)
      )
      X_pad_np = np.pad(X0, pads, mode="constant", constant_values=val)
  
      assert (X_pad_theano == X_pad_np).all()
  
file_path: Lasagne/lasagne/tests/test_theano_extensions.py
imports: import pytest
  import numpy
  import theano.tensor
  import lasagne
label_desc: Use image node_id 7 for calling a global function with example usage: test_pad(batch_ndim, val, width) without return types