You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
even with that implemented, it doesn't work properly on tuples. In the example below it gives an explicit error but in other cases, fails silently. I think the issue is with the implementation of Transform itself
Example:
Compare torchvision.transforms.Lambda which gives the expected output
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[31], line 5
1 from lobster.transforms import Lambda
3 transform = Lambda(lambda item: (item[0] + 1, item[1]))
----> 5 transform((1, 1))
File ~/Desktop/code/lobster/.venv/lib/python3.10/site-packages/torch/nn/modules/module.py:1736, in Module._wrapped_call_impl(self, *args, **kwargs)
1734 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1735 else:
-> 1736 return self._call_impl(*args, **kwargs)
File ~/Desktop/code/lobster/.venv/lib/python3.10/site-packages/torch/nn/modules/module.py:1747, in Module._call_impl(self, *args, **kwargs)
1742 # If we don't have any hooks, we want to skip the rest of the logic in
1743 # this function, and just call forward.
1744 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1745 or _global_backward_pre_hooks or _global_backward_hooks
1746 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1747 return forward_call(*args, **kwargs)
1749 result = None
1750 called_always_called_hooks = set()
File ~/Desktop/code/lobster/src/lobster/transforms/_transform.py:105, in Transform.forward(self, *inputs)
103 for x, transformable in zip(flattened, transformables):
104 if transformable:
--> 105 y = self._transform(x, inputs)
106 else:
107 y = x
File ~/Desktop/code/lobster/src/lobster/transforms/_lambda.py:46, in Lambda._transform(self, input, parameters)
29 """
30 Parameters
31 ----------
(...)
43
44 """
45 if isinstance(input, self._types):
---> 46 return self._fn(input)
47 else:
48 return input
Cell In[31], line 3
1 from lobster.transforms import Lambda
----> 3 transform = Lambda(lambda item: (item[0] + 1, item[1]))
5 transform((1, 1))
TypeError: 'int' object is not subscriptable
The text was updated successfully, but these errors were encountered:
lobster.transforms.Lambda
seems broken_check_inputs
Transform
itselfExample:
Compare
torchvision.transforms.Lambda
which gives the expected outputand
lobster.transforms.Lambda
The text was updated successfully, but these errors were encountered: