class_docstr: Tests for utilities in nn_ops.py.
class_docstr_tok: ["Tests","for","utilities","in","nn_ops.py","."]
docstr: Tests ImagePatcher.
  
  Args:
    input_shape: tuple; Shape of the input data.
    patch_size: tuple; size of the patch: (height, width).
    strides: tuple; Specifies how far two consecutive patches are in the
      input.
    padding: str; The type of padding algorithm to use.
    expected_output_shape: expected shape of the output.
docstr_tok: ["Tests","ImagePatcher",".","Args",":","input_shape",":","tuple",";","Shape","of","the","input","data",".","patch_size",":","tuple",";","size","of","the","patch",":","(","height",",","width",")",".","strides",":","tuple",";","Specifies","how","far","two","consecutive","patches","are","in","the","input",".","padding",":","str",";","The","type","of","padding","algorithm","to","use",".","expected_output_shape",":","expected","shape","of","the","output","."]
code: def test_image_patcher(
      self,
      input_shape,
      patch_size,
      strides,
      padding,
      expected_output_shape,
  ):
      """Tests ImagePatcher.
  
      Args:
        input_shape: tuple; Shape of the input data.
        patch_size: tuple; size of the patch: (height, width).
        strides: tuple; Specifies how far two consecutive patches are in the
          input.
        padding: str; The type of padding algorithm to use.
        expected_output_shape: expected shape of the output.
      """
      inputs = jnp.zeros(input_shape)
  
      image_patcher = functools.partial(
          nn_ops.patch_image,
          inputs_shape=input_shape,
          patch_size=patch_size,
          strides=strides,
          padding=padding,
          mode="i2p",
      )
  
      # test output shape
      outputs = image_patcher(inputs)
      self.assertEqual(outputs.shape, expected_output_shape)
  
imports: import functools
  from absl.testing import absltest
  from absl.testing import parameterized
  import flax.linen
  import jax
  import jax.numpy
  import numpy
  from scenic.model_lib.layers import nn_ops
label_desc: Use image node_id 9 for calling the NNOpsTest obj's underlying member method code with example usage: obj.test_image_patcher(input_shape, patch_size, strides, padding, expected_output_shape) without return types