MCPcopy Create free account
hub / github.com/alibaba/MNN / onCompute

Method onCompute

source/geometry/GeometryShape.cpp:239–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237class GeometrySize : public GeometryComputer {
238public:
239 virtual bool onCompute(const Op* op, const std::vector<Tensor*>& inputs, const std::vector<Tensor*>& outputs,
240 Context& context, CommandBuffer& res) const override {
241 if (nullptr == TensorUtils::getDescribeOrigin(outputs[0])->mem.get()) {
242 if(!context.allocTensor(outputs[0])) {
243 return false;
244 }
245 }
246 int count = 1;
247 for (int i = 0; i < inputs[0]->buffer().dimensions; i++) {
248 count *= inputs[0]->buffer().dim[i].extent;
249 }
250 outputs[0]->host<int>()[0] = count;
251 return true;
252 }
253};
254
255class GeometryRaster : public GeometryComputer {

Callers

nothing calls this directly

Calls 3

allocTensorMethod · 0.80
getMethod · 0.45
bufferMethod · 0.45

Tested by

no test coverage detected