MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / memory_forward_success

Function memory_forward_success

imperative/src/impl/ops/reduce.cpp:56–67  ·  view source on GitHub ↗

TODO: using this for apply_on_physical_tensor

Source from the content-addressed store, hash-verified

54
55// TODO: using this for apply_on_physical_tensor
56bool memory_forward_success(const OpDef& def, SmallVector<TensorPtr> inputs) {
57 auto&& reduce = static_cast<const Reduce&>(def);
58 if (reduce.mode != Reduce::Mode::SUM_SQR && inputs.size() == 2) {
59 auto shape_tensor = inputs[1]->get_value();
60 TensorShape shape;
61 cg::copy_tensor_value_to_shape(shape, shape_tensor.proxy_to_default_cpu());
62 if (shape.eq_shape(inputs[0]->shape())) {
63 return true;
64 }
65 }
66 return false;
67}
68
69SmallVector<TensorPtr> apply_on_physical_tensor(
70 const OpDef& def, const SmallVector<TensorPtr>& inputs,

Callers 1

apply_on_physical_tensorFunction · 0.85

Calls 5

sizeMethod · 0.45
get_valueMethod · 0.45
proxy_to_default_cpuMethod · 0.45
eq_shapeMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected