Update ops.py
The condition can return a list and all should work the same as if returned tuple. The comment above expresses the case of a returned single item but does not account for an item of type list
Thanks for the pull request @DdHms. Does this fix and issue you are having? If so, please share some details.
while trying to script the following model:
class SEG_COREML(torch.nn.Module):
def __init__(self):
super().__init__()
self.non_mem = traced_no_mem
self.mem_frame = traced_mem_frame
def forward(self, img, init_mask, key_k, key_v, frame_num, mem_every):
frac = frame_num[0] / mem_every[0]
if frac.double() == frac.int():
segmentation, key_k, key_v = self.mem_frame(img, key_k, key_v)
else:
segmentation, key_k, key_v = self.non_mem(img, key_k, key_v)
return segmentation, key_k, key_v
This line returned a list of the 3 outputs from my _if op but since it wasn't a tuple it was wrapped into a tuple at line and then failed the assertion in line because len(cond) was now 1 instead of 3
I have rebase this change. CI: https://gitlab.com/coremltools1/coremltools/-/pipelines/629008351