class_docstr: Tests for DeformableDETRBackbone.
class_docstr_tok: ["Tests","for","DeformableDETRBackbone","."]
docstr: Test DeformableDETREncoderLayer output shape.
docstr_tok: ["Test","DeformableDETREncoderLayer","output","shape","."]
code: def test_backbone_output_shape(self, shape, num_feature_levels):
      """Test DeformableDETREncoderLayer output shape."""
      rng = random.PRNGKey(8877)
      x = jnp.ones(shape)
  
      backbone = DeformableDETRBackbone(
          embed_dim=4,
          num_filters=16,
          num_layers=18,
          num_feature_levels=num_feature_levels,
      )
      (features, pad_masks, pos_embs), _ = backbone.init_with_output(
          rng, x
      )
      self.assertLen(features, num_feature_levels)
      for i in range(num_feature_levels):
          fshape = features[i].shape[1:3]
          self.assertSequenceEqual(fshape, pad_masks[i].shape[1:3])
          self.assertEqual(math.prod(fshape), pos_embs[i].shape[1])
          if i > 0:
              self.assertGreater(
                  features[i].shape[-1], features[i - 1].shape[-1]
              )
  
file_path: scenic/scenic/projects/baselines/deformable_detr/tests/test_backbone.py
imports: import math
  from absl.testing import absltest
  from absl.testing import parameterized
  from jax import random
  import jax.numpy
  from scenic.projects.baselines.deformable_detr.backbone import DeformableDETRBackbone
  from scenic.projects.baselines.deformable_detr.backbone import mask_for_shape
label_desc: Use image node_id 1 for calling the DeformableDETRBackboneTest obj's underlying member method code with example usage: obj.test_backbone_output_shape(shape, num_feature_levels) without return types