MCPcopy Create free account
hub / github.com/apache/singa / MultColumn

Function MultColumn

src/core/tensor/tensor.cc:1471–1485  ·  view source on GitHub ↗

Multiply column 'v' and each column of matrix M; write results into 'out'

Source from the content-addressed store, hash-verified

1469
1470/// Multiply column 'v' and each column of matrix M; write results into 'out'
1471void 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'
1488void MultRow(const Tensor &v, Tensor *M) {

Callers 4

TEST_FFunction · 0.85
DivColumnFunction · 0.85
ForwardMethod · 0.85
BackwardMethod · 0.85

Calls 9

CheckDataTypeAndLangFunction · 0.85
nDimMethod · 0.80
shapeMethod · 0.80
data_typeMethod · 0.80
langMethod · 0.80
deviceMethod · 0.80
ExecMethod · 0.80
SizeMethod · 0.45
blockMethod · 0.45

Tested by 1

TEST_FFunction · 0.68