Matrix multiplication does not check batch size
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 701
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
matrix multiplication does not check the batch size. I don't know if this the correct behavior or an actual (weird) feature. If it's a bug, I can look into it and propose a pull request.
Exemple:
```
#include
#include
#include "dynet/dynet.h"
#include "dynet/expr.h"
int main(int argc, char** argv)
{
dynet::initialize(argc, argv);
dynet::ComputationGraph cg;
std::vector v1(5);
std::vector v2(6);
std::cerr << "batch size=5,6\n";
{
auto e1 = dynet::input(cg, dynet::Dim({1}, 5), v1);
auto e2 = dynet::input(cg, dynet::Dim({1}, 6), v2);
// does not fail
auto e3 = e1 * e2;
}
std::cerr << "batch size=1\n";
{
auto e1 = dynet::input(cg, dynet::Dim({5}, 1), v1);
auto e2 = dynet::input(cg, dynet::Dim({6}, 1), v2);
// fails
auto e3 = e1 * e2;
}
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the provided C++ example and trace the matrix-multiplication operation's shape validation. Determine whether mismatched batch sizes should be rejected, then add or update coverage for both examples so the intended behavior is explicit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100