Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Incorrect type hint in the loss() function in mvx_two_stage.py #2659

Open
ShaneXiangH opened this issue Jul 19, 2023 · 1 comment · May be fixed by #2662
Open

[Docs] Incorrect type hint in the loss() function in mvx_two_stage.py #2659

ShaneXiangH opened this issue Jul 19, 2023 · 1 comment · May be fixed by #2662

Comments

@ShaneXiangH
Copy link

Branch

main branch https://mmdetection3d.readthedocs.io/en/latest/

📚 The doc issue

This function:

def loss(self, batch_inputs_dict: Dict[List, torch.Tensor],
             batch_data_samples: List[Det3DDataSample],
             **kwargs) -> List[Det3DDataSample]:
        """
        Args:
            batch_inputs_dict (dict): The model input dict which include
                'points' and `imgs` keys.

                - points (list[torch.Tensor]): Point cloud of each sample.
                - imgs (torch.Tensor): Tensor of batch images, has shape
                  (B, C, H ,W)
            batch_data_samples (List[:obj:`Det3DDataSample`]): The Data
                Samples. It usually includes information such as
                `gt_instance_3d`, .

        Returns:
            dict[str, Tensor]: A dictionary of loss components.

        """

        batch_input_metas = [item.metainfo for item in batch_data_samples]
        img_feats, pts_feats = self.extract_feat(batch_inputs_dict,
                                                 batch_input_metas)
        losses = dict()
        if pts_feats:
            losses_pts = self.pts_bbox_head.loss(pts_feats, batch_data_samples,
                                                 **kwargs)
            losses.update(losses_pts)
        if img_feats:
            losses_img = self.loss_imgs(img_feats, batch_data_samples)
            losses.update(losses_img)
        return losses

Shows incorrect type hint for the batch_inputs_dict param. It should be: Dict[str, Union[List[torch.Tensor], torch.Tensor]]

Suggest a potential alternative/fix

Change the type hint for the batch_inputs_dict param to: Dict[str, Union[List[torch.Tensor], torch.Tensor]]

@Xiangxu-0103
Copy link
Collaborator

Xiangxu-0103 commented Jul 20, 2023

Are you willing to create a PR to help us fix it?

@ShaneXiangH ShaneXiangH linked a pull request Jul 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants