Multiply column 'v' and each column of matrix M; write results into 'out'
| 1469 | |
| 1470 | /// Multiply column 'v' and each column of matrix M; write results into 'out' |
| 1471 | void MultColumn(const Tensor &v, Tensor *M) { |
| 1472 | // CHECK(!M->transpose()) << "Not supported yet"; |
| 1473 | CHECK_EQ(M->nDim(), 2u); |
| 1474 | // CHECK_EQ(v.nDim(), 1u); (chonho) shape of v is 2-element tuple |
| 1475 | CHECK_EQ(v.Size(), M->shape(0)); |
| 1476 | CheckDataTypeAndLang(*M, v); |
| 1477 | TYPE_LANG_SWITCH(v.data_type(), DType, v.device()->lang(), Lang, { |
| 1478 | Tensor &MRef = *M; |
| 1479 | v.device()->Exec( |
| 1480 | [MRef, v](Context *ctx) mutable { |
| 1481 | DGMM<DType, Lang>(false, MRef, v, &MRef, ctx); |
| 1482 | }, |
| 1483 | {M->block(), v.block()}, {M->block()}, "MultColumn"); |
| 1484 | }); |
| 1485 | } |
| 1486 | |
| 1487 | /// Multiply row 'v' with each row of matrix M; write results into 'out' |
| 1488 | void MultRow(const Tensor &v, Tensor *M) { |