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

Function SumAll

src/core/tensor/tensor.cc:1242–1254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1240}
1241
1242Tensor SumAll(const Tensor &in) {
1243 Tensor out({(size_t)1}, in.device(), in.data_type());
1244 Tensor one(in.shape(), in.device(), in.data_type());
1245 one.SetValue(1.0f);
1246 TYPE_LANG_SWITCH(in.data_type(), DType, in.device()->lang(), Lang, {
1247 one.device()->Exec(
1248 [in, one, out](Context *ctx) mutable {
1249 Dot<DType, Lang>(in, one, &out, ctx);
1250 },
1251 {in.block(), one.block()}, {out.block()}, "SumAll");
1252 });
1253 return out;
1254}
1255
1256Tensor RowMax(const Tensor &in) {
1257 Tensor ret({in.shape(0)}, in.device(), in.data_type());

Callers

nothing calls this directly

Calls 7

deviceMethod · 0.80
data_typeMethod · 0.80
shapeMethod · 0.80
langMethod · 0.80
ExecMethod · 0.80
SetValueMethod · 0.45
blockMethod · 0.45

Tested by

no test coverage detected