Skip to content

Commit

Permalink
Fix mypy type checker error (facebookresearch#36)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebookresearch#36

`mil_encoder.py` was breaking mypy type checking in OSS

https://github.com/facebookresearch/multimodal/runs/6311395953?check_suite_focus=true

```
Found 2 errors in 1 file (checked 31 source files)
annotation for "partitioned_input" (hint:
"partitioned_input: Dict[<type>, <type>] = ...")  [var-annotated]
            partitioned_input = {}
            ^
torchmultimodal/modules/encoders/mil_encoder.py:93:29: error: Incompatible
types in assignment (expression has type "List[Tensor]", variable has type
"Dict[Any, Any]")  [assignment]
            partitioned_input = torch.split(x, self.partition_sizes, dim=1...
```

Reviewed By: ankitade

Differential Revision: D36185850

fbshipit-source-id: eb06b7f8deb8c5480f1d908d51dedbcdff80256e
  • Loading branch information
langong347 authored and facebook-github-bot committed May 9, 2022
1 parent a69f32f commit 1b01566
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion torchmultimodal/modules/encoders/mil_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def get_channel_name(self, id: int) -> str:
return f"mil_{id}"

def forward(self, x: Tensor) -> Tensor:
partitioned_input = {}
idx = 0
input_size = x.size(dim=1)
if input_size != sum(self.partition_sizes):
Expand Down

0 comments on commit 1b01566

Please sign in to comment.