Multiply after broadcasting vec to match dimensions of mat. Args: vec: A 1-D tensor of dimension [D0] mat: A 2-D tensor of dimension [D0, D1] Returns: A tensor of dimension [D0, D1], the result of vec * mat
(vec, mat)
| 505 | |
| 506 | |
| 507 | def _BroadcastMul(vec, mat): |
| 508 | """Multiply after broadcasting vec to match dimensions of mat. |
| 509 | |
| 510 | Args: |
| 511 | vec: A 1-D tensor of dimension [D0] |
| 512 | mat: A 2-D tensor of dimension [D0, D1] |
| 513 | |
| 514 | Returns: |
| 515 | A tensor of dimension [D0, D1], the result of vec * mat |
| 516 | """ |
| 517 | # Reshape vec to [D0, 1] |
| 518 | vec = array_ops.expand_dims(vec, -1) |
| 519 | return vec * mat |
| 520 | |
| 521 | |
| 522 | @ops.RegisterGradient("SoftmaxCrossEntropyWithLogits") |
no test coverage detected