Exceptions not thrown/SIGABRT when concatenating vectors of different batch sizes
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 701
- PR merge metrics
- No merged PRs in 30d
Description
Example for not throwing exceptions:
```python
import dynet as dy
x1 = dy.zeros((4,), batch_size=3)
x2 = dy.zeros((4,), batch_size=2)
x = dy.concatenate([x1, x2])
print(x.dim()) # prints ((8,), 3), but should throw an exception
```
And, in a part of a larger program, I tried concatenating expressions of batch sizes 10, 10, 2, and 1. The first three are complicated expressions involving LSTMs, and the last one was a `dy.lookup`. In this case, the program aborted given the following message:
```
Assertion failed: (dimensions_match(m_leftImpl.dimensions(), m_rightImpl.dimensions())), function evalSubExprsIfNeeded, file /usr/local/Cellar/eigen/HEAD-1ff051b7a3ae/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h, line 122.
```
I'll try and see if I could come up with a minimal example.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the dy.concatenate call in the Python example and trace how mismatched batch sizes reach the Eigen assertion in evalSubExprsIfNeeded. Compare the handling of batch sizes 3 and 2, and of 10, 10, 2, and 1; done means mismatches are rejected with an exception instead of silently producing a result or aborting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100