Skip to content

Commit

Permalink
Merge pull request #370 from bioimage-io/fix-optional
Browse files Browse the repository at this point in the history
Fix optional inputs for pytorch
  • Loading branch information
FynnBe authored Mar 21, 2024
2 parents de6435f + 789ba05 commit 84382dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bioimageio/core/model_adapters/_pytorch_model_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def forward(self, *input_tensors: Optional[Tensor]) -> List[Optional[Tensor]]:
None if ipt is None else torch.from_numpy(ipt.data)
for ipt in input_tensors
]
tensors = [t.to(self._devices[0]) for t in tensors]
tensors = [None if t is None else t.to(self._devices[0]) for t in tensors]
result: Union[Tuple[Any, ...], List[Any], Any] = self._network(*tensors)
if not isinstance(result, (tuple, list)):
result = [result]
Expand Down

0 comments on commit 84382dc

Please sign in to comment.