Commit ac714ff
committed
Assert the gradients in the tiled-logits layout test
The flatten under test also feeds the backward: x_grad is a zeros_like of the
flattened activation, scattered per shard through
x_grad.narrow(...).view_as(x_shard) and unflattened on the way out. The test
compared only the loss and never called backward, so that path was not
exercised and the copy reshape makes for a non-contiguous input was never
checked for putting the gradient back where it came from.
shards=2 loss_equal=True x_grad_equal=True max|dx|=0.000e+00 max|dW|=0.000e+00
shards=4 loss_equal=True x_grad_equal=True max|dx|=0.000e+00 max|dW|=0.000e+00
Also asserts the parameter gradients, which is the third comparison
TestTiledMLPInputLayout makes.
Signed-off-by: alanhuangyoo <alanhuangyoo@gmail.com>1 parent 307ff15 commit ac714ff
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
438 | | - | |
| 438 | + | |
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
442 | 445 | | |
| 446 | + | |
443 | 447 | | |
444 | 448 | | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
0 commit comments