MCPcopy Create free account
hub / github.com/cactus-compute/cactus / sum

Method sum

cactus/graph/graph_builder.cpp:240–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240size_t CactusGraph::sum(size_t input, int axis) {
241 const auto& input_buffer = get_output_buffer(input);
242 std::vector<size_t> output_shape;
243
244 if (axis == -1) {
245 output_shape = {1};
246 } else {
247 output_shape = input_buffer.shape;
248 output_shape.erase(output_shape.begin() + axis);
249 if (output_shape.empty()) {
250 output_shape = {1};
251 }
252 }
253
254 OpParams params{.axis = axis, .output_precision = input_buffer.precision};
255 return add_node(OpType::SUM, {input}, output_shape, params);
256}
257
258size_t CactusGraph::mean(size_t input, int axis) {
259 const auto& input_buffer = get_output_buffer(input);

Callers 7

test_softmax_2dMethod · 0.80
cactus_graph_sumFunction · 0.80
build_gated_deltanetMethod · 0.80
benchmark_reduction_opsFunction · 0.80

Calls

no outgoing calls