| 52 | class GeometryTensorArray : public GeometryComputer { |
| 53 | public: |
| 54 | virtual bool onCompute(const Op* op, const std::vector<Tensor*>& inputs, const std::vector<Tensor*>& outputs, |
| 55 | Context& context, CommandBuffer& res) const override { |
| 56 | if (TensorUtils::getDescribe(outputs[1])->tensorArrayAttr == nullptr) { |
| 57 | MNN_ASSERT(false); |
| 58 | return false; |
| 59 | } |
| 60 | if (TensorUtils::getDescribe(outputs[1])->tensorArrayAttr->arraySize > 0) { |
| 61 | auto type = outputs[1]->getType(); |
| 62 | auto zeroConst = context.allocConst(op, {}, type); |
| 63 | if (type == halide_type_of<float>()) { |
| 64 | zeroConst->host<float>()[0] = 0.0; |
| 65 | } else { |
| 66 | zeroConst->host<int>()[0] = 0; |
| 67 | } |
| 68 | for (int i = 0; i < 2; i++) { |
| 69 | auto des = TensorUtils::getDescribe(outputs[i]); |
| 70 | des->memoryType = Tensor::InsideDescribe::MEMORY_VIRTUAL; |
| 71 | auto& regions = des->regions; |
| 72 | regions.resize(1); |
| 73 | regions[0].origin = zeroConst.get(); |
| 74 | regions[0].size[0] = outputs[1]->elementSize(); |
| 75 | regions[0].src.stride[0] = 0; |
| 76 | } |
| 77 | } |
| 78 | return true; |
| 79 | } |
| 80 | }; |
| 81 | class GeometryTensorArraySize : public GeometryComputer { |
| 82 | public: |
nothing calls this directly
no test coverage detected