Commit 45a8e27
committed
Update the torch vecdot wrapper
- torch.vecdot incorrectly allows broadcasting in the contracted dimensions
- The 2023 version of the spec updates the language to require axis to apply
before broadcasting, not after. The implementation for integer arguments is
updated to follow this behavior. Note that the spec only actually requires
axis to be negative, but we allow nonnegative axis too if x1 and x2 have the
required number of dimensions and those dimensions have same value, which
matches the numpy gufunc vecdot implementation and also the base
torch.vecdot implementation as far as I can tell.1 parent e4ec81d commit 45a8e27
1 file changed
+8
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
0 commit comments