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

Function SumRows

src/core/tensor/tensor.cc:1523–1538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1521 }
1522}
1523void SumRows(const Tensor &M, Tensor *v) {
1524 if (M.transpose()) {
1525 Tensor X = Transpose(M);
1526 SumColumns(X, v);
1527 } else {
1528 CHECK_EQ(M.nDim(), 2u);
1529 // CHECK_EQ(v->nDim(), 1u); (chonho) shape of v is 2-element tuple
1530 size_t nb_row = M.shape(0), nb_col = M.shape(1);
1531 CHECK_EQ(nb_col, v->Size());
1532
1533 Tensor one(Shape{nb_row}, M.device(), M.data_type());
1534 one.SetValue(1.0f); // TODO(wangwei) cast type
1535 Tensor X = Transpose(M);
1536 Mult(X, one, v);
1537 }
1538}
1539// ====================Random operations=====================================
1540template <typename SType>
1541void Bernoulli(const SType p, Tensor *out) {

Callers 11

TEST_FFunction · 0.85
SumFunction · 0.85
SumColumnsFunction · 0.85
CpuConvBackwardbFunction · 0.85
BackwardMethod · 0.85
BackwardMethod · 0.85
BackwardMethod · 0.85
BackwardMethod · 0.85
ForwardMethod · 0.85
BackwardMethod · 0.85
BackwardMethod · 0.85

Calls 10

SumColumnsFunction · 0.85
MultFunction · 0.85
nDimMethod · 0.80
shapeMethod · 0.80
deviceMethod · 0.80
data_typeMethod · 0.80
TransposeFunction · 0.70
transposeMethod · 0.45
SizeMethod · 0.45
SetValueMethod · 0.45

Tested by 1

TEST_FFunction · 0.68