affine_transform + broadcasting = segfault
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 701
- PR merge metrics
- No merged PRs in 30d
Description
Consider the following code:
```
import dynet as dy
W = dy.zeros((32, 32))
x = dy.zeros((32,))
b = dy.zeros((32,64))
y = W * x + b
print(y.dim())
z = dy.affine_transform([b, W, x])
print(z.dim())
z.forward()
z.backward()
```
Here the dimensionality of `y` is correct (`((32, 64), 1)`), but the dimensionality of `z` is incorrect (dynet thinks it's `((32,), 1)` when it should be the same as `y`).
Furthermore, calling `backward()` on `z` causes a segfault.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the provided C++-library reproducer and inspect the affine_transform entry point and the broadcasting behavior used by W * x + b. Confirm that affine_transform reports the broadcasted dimensions, then run forward and backward to verify that the corrected result no longer segfaults.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100