code: def forward(
      self,
      img,
      return_features: bool = True,
      use_fp16: bool = False,
      no_output_bias: bool = False,
  ):
      batch_size, channels, height, width = img.shape  # [NCHW]
      assert channels == 3
  
      # Cast to float.
      x = img.to(torch.float16 if use_fp16 else torch.float32)
  
      # Emulate tf.image.resize_bilinear(x, [299, 299]), including the funky alignment.
      new_width, new_height = 299, 299
      theta = torch.eye(2, 3, device=x.device)
      theta[0, 2] += theta[0, 0] / width - theta[0, 0] / new_width
      theta[1, 2] += theta[1, 1] / height - theta[1, 1] / new_height
      theta = theta.to(x.dtype).unsqueeze(0).repeat([batch_size, 1, 1])
      grid = torch.nn.functional.affine_grid(
          theta,
          [batch_size, channels, new_height, new_width],
          align_corners=False,
      )
      x = torch.nn.functional.grid_sample(
          x,
          grid,
          mode="bilinear",
          padding_mode="border",
          align_corners=False,
      )
  
      # Scale dynamic range from [0,255] to [-1,1[.
      x -= 128
      x /= 128
  
      # Main layers.
      intermediate = self.layers[:-6](x)
      spatial_features = (
          self.layers[-6]
          .conv(intermediate)[:, :7]
          .permute(0, 2, 3, 1)
          .reshape(-1, 2023)
      )
      features = (
          self.layers[-6:](intermediate)
          .reshape(-1, 2048)
          .to(torch.float32)
      )
      if return_features:
          return features, spatial_features
  
      # Output layer.
      return self.acts_to_probs(features, no_output_bias=no_output_bias)
  
imports: import collections
  import torch
label_desc: Use image node_id 2 for calling the InceptionV3 obj's underlying member method code with example usage: obj.forward(img, return_features, use_fp16, no_output_bias) and returns: self, features,  spatial_features