Bug in Dimensions node
- Dominant language
- Python
- Stars
- 14
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
When running through the [YouTube Tutorial 1.3 video](https://www.youtube.com/watch?v=6nUXaXlP4Ss&list=PLWHGXTFXApYGjmM5fb1RktVa-7mqclMCh) I discovered that the `Dimension` node in that video would trigger a crash when set to 'Tile' as a 4 column by 3 row set of images and then hitting compute. The error message was
```
Traceback (most recent call last):
File "/Users/XXXX/miniforge3/envs/gpi_env/lib/python3.7/site-packages/gpi/functor.py", line 378, in run
self._proxy.append(['retcode', self._func()])
File "/Users/XXXXX/miniforge3/envs/gpi_env/lib/python3.7/site-packages/gpi_core/shapers/GPI/Dimensions_GPI.py", line 616, in compute
out.shape = self.shape
ValueError: cannot reshape array of size 691200 into shape ()
```
A quick investigation showed that if the `initUI(self)` function in the class is run, then we get a crash. In certain situations when this `initUI(self)` is not run (for example, removing the connection to the `Dimensions` node and reconnecting it only triggers `validate(self)` and `compute(self)`), the function works as advertised. In `InitUI(self)` we set `self.shape = []`, which may be a problem in that an empty tuple is then used for the shape, which causes a problem when trying to reshape the array later.
Interestingly running `InitUI(self)` followed by `validate(self)` and `compute(self)` still triggers the problem even through `validate(self)` is supposed to set the `self.shape` value. A little bit of poking around confirmed that the initial `validate(self)` after `initUI(self)` if we have op==8 ('Tile') set doesn't appear to actually initialize `self.shape`. not sure where the initialization should take place in the `validate(self)` function, but it is likely the bug fix needs to be there.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.