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

[Types] Fix misleading List[Tensor] types #2535

Merged
merged 2 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mmseg/models/decode_heads/decode_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def loss(self, inputs: Tuple[Tensor], batch_data_samples: SampleList,
return losses

def predict(self, inputs: Tuple[Tensor], batch_img_metas: List[dict],
test_cfg: ConfigType) -> List[Tensor]:
test_cfg: ConfigType) -> Tensor:
"""Forward function for prediction.

Args:
Expand All @@ -276,7 +276,7 @@ def predict(self, inputs: Tuple[Tensor], batch_img_metas: List[dict],
test_cfg (dict): The testing config.

Returns:
List[Tensor]: Outputs segmentation logits map.
Tensor: Outputs segmentation logits map.
"""
seg_logits = self.forward(inputs)

Expand Down
2 changes: 1 addition & 1 deletion mmseg/models/segmentors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _forward(self,

def postprocess_result(self,
seg_logits: Tensor,
data_samples: OptSampleList = None) -> list:
data_samples: OptSampleList = None) -> SampleList:
""" Convert results list to `SegDataSample`.
Args:
seg_logits (Tensor): The segmentation results, seg_logits from
Expand Down
2 changes: 1 addition & 1 deletion mmseg/models/segmentors/cascade_encoder_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _init_decode_head(self, decode_head: ConfigType) -> None:
self.num_classes = self.decode_head[-1].num_classes

def encode_decode(self, inputs: Tensor,
batch_img_metas: List[dict]) -> List[Tensor]:
batch_img_metas: List[dict]) -> Tensor:
"""Encode images with backbone and decode into a semantic segmentation
map of the same size as input."""
x = self.extract_feat(inputs)
Expand Down
2 changes: 1 addition & 1 deletion mmseg/models/segmentors/encoder_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def extract_feat(self, inputs: Tensor) -> List[Tensor]:
return x

def encode_decode(self, inputs: Tensor,
batch_img_metas: List[dict]) -> List[Tensor]:
batch_img_metas: List[dict]) -> Tensor:
"""Encode images with backbone and decode into a semantic segmentation
map of the same size as input."""
x = self.extract_feat(inputs)
Expand Down