MNN/backupcode/shape/ShapeAsString.cpp

33 lines
784 B
C++
Raw Permalink Normal View History

2019-04-17 10:49:11 +08:00
//
// ShapeAsString.cpp
// MNN
//
// Created by MNN on 2019/01/10.
// Copyright © 2018, Alibaba Group Holding Limited
//
2020-11-05 16:41:56 +08:00
#include "shape/SizeComputer.hpp"
2019-12-27 22:16:57 +08:00
#include "core/Macro.h"
2019-04-17 10:49:11 +08:00
namespace MNN {
class AsStringComputer : public SizeComputer {
public:
virtual bool onComputeSize(const MNN::Op* op, const std::vector<Tensor*>& inputs,
const std::vector<Tensor*>& outputs) const override {
MNN_ASSERT(1 == inputs.size());
MNN_ASSERT(1 == outputs.size());
auto output = outputs[0];
auto input = inputs[0];
TensorUtils::copyShape(input, output, true);
2019-04-17 10:49:11 +08:00
output->setType(MNN::DataType_DT_STRING);
return true;
}
};
REGISTER_SHAPE(AsStringComputer, OpType_AsString);
} // namespace MNN