class_docstr: Tests for deform_attn_sampling_fn.
class_docstr_tok: ["Tests","for","deform_attn_sampling_fn","."]
docstr: Tests matches results from pytorch custom CUDA kernel.
docstr_tok: ["Tests","matches","results","from","pytorch","custom","CUDA","kernel","."]
code: def test_bilinear_interp_single_pixel(self):
      """Tests matches results from pytorch custom CUDA kernel."""
      im = np.ones((1, 1, 1))
      grid = np.array([[[0, 0], [0.5, 0.5], [1, 1]]])
      res = bilinear_interpolate(im, grid, 1, 1)
      self.assertSequenceEqual(res.shape, (1, 3, 1))
      res = res.reshape(-1)
  
      # (0, 0) maps to top-left, (0.5, 0.5) is center, (1, 1) is bottom-right.
      exp_res = [0.25, 1, 0.25]
      self.assertSequenceAlmostEqual(res, exp_res)
  
file_path: scenic/scenic/projects/baselines/deformable_detr/tests/test_attention.py
imports: from absl.testing import absltest
  from absl.testing import parameterized
  import jax
  from jax import random
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.projects.baselines.deformable_detr.attention import bilinear_interpolate
  from scenic.projects.baselines.deformable_detr.attention import MultiScaleDeformableAttention
label_desc: Use image node_id 1 for calling the DeformAttnSamplingFnTest obj's underlying member method code with example usage: obj.test_bilinear_interp_single_pixel() without return types