text: from ..registry import RECOGNIZERS
  from .base import BaseRecognizer
  
  
  @RECOGNIZERS.register_module()
  class Recognizer3D(BaseRecognizer):
      """3D recognizer model framework."""
  
      def forward_train(self, imgs, labels, **kwargs):
          """Defines the computation performed at every call when training."""
          imgs = imgs.reshape((-1, ) + imgs.shape[2:])
          losses = dict()
  
          x = self.extract_feat(imgs)
          if hasattr(self, 'neck'):
              x, loss_aux = self.neck(x, labels.squeeze())
              losses.update(loss_aux)
  
          cls_score = self.cls_head(x)
          gt_labels = labels.squeeze()
          loss_cls = self.cls_head.loss(cls_score, gt_labels, **kwargs)
          losses.update(loss_cls)
  
          return losses
  
      def forward_test(self, imgs):
          """Defines the computation performed at every call when evaluation and
          testing."""
          num_segs = imgs.shape[1]
          imgs = imgs.reshape((-1, ) + imgs.shape[2:])
  
          x = self.extract_feat(imgs)
          if hasattr(self, 'neck'):
              x, _ = self.neck(x)
  
          cls_score = self.cls_head(x)
          cls_score = self.average_clip(cls_score, num_segs)
  
          return cls_score.cpu().numpy()
  
      def forward_dummy(self, imgs):
          """Used for computing network FLOPs.
  
          See ``tools/analysis/get_flops.py``.
  
          Args:
              imgs (torch.Tensor): Input images.
  
          Returns:
              Tensor: Class score.
          """
          imgs = imgs.reshape((-1, ) + imgs.shape[2:])
  
          x = self.extract_feat(imgs)
          outs = (self.cls_head(x), )
          return outs
  
      def forward_gradcam(self, imgs):
          """Defines the computation performed at every call when using gradcam
          utils."""
          num_segs = imgs.shape[1]
          imgs = imgs.reshape((-1, ) + imgs.shape[2:])
  
          x = self.extract_feat(imgs)
          if hasattr(self, 'neck'):
              x, _ = self.neck(x)
  
          cls_score = self.cls_head(x)
          cls_score = self.average_clip(cls_score, num_segs)
  
          return cls_score
  