1 #ifndef _NNDEPLOY_PREPROCESS_CONVERT_TO_H_
2 #define _NNDEPLOY_PREPROCESS_CONVERT_TO_H_
20 namespace preprocess {
28 rapidjson::Value &json,
29 rapidjson::Document::AllocatorType &allocator)
override {
41 if (json.HasMember(
"dst_data_type_") && json[
"dst_data_type_"].IsString()) {
42 std::string dst_data_type_str = json[
"dst_data_type_"].GetString();
51 ConvertTo(
const std::string &name) : dag::Node(name) {
52 key_ =
"nndeploy::preprocess::ConvertTo";
54 "Convert the data type of the input tensor to the specified data type";
55 param_ = std::make_shared<ConvertToParam>();
56 this->setInputTypeInfo<device::Tensor>();
57 this->setOutputTypeInfo<device::Tensor>();
59 ConvertTo(
const std::string &name, std::vector<dag::Edge *> inputs,
60 std::vector<dag::Edge *> outputs)
61 : dag::Node(name, inputs, outputs) {
62 key_ =
"nndeploy::preprocess::ConvertTo";
64 "Convert the data type of the input tensor to the specified data type";
65 param_ = std::make_shared<ConvertToParam>();
66 this->setInputTypeInfo<device::Tensor>();
67 this->setOutputTypeInfo<device::Tensor>();
virtual base::Status deserialize(rapidjson::Value &json)
virtual std::string serialize()
virtual base::Status deserialize(rapidjson::Value &json) override
virtual base::Status serialize(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) override
ConvertTo(const std::string &name)
ConvertTo(const std::string &name, std::vector< dag::Edge * > inputs, std::vector< dag::Edge * > outputs)
virtual base::Status run()
Run node (pure virtual function)
#define NNDEPLOY_CC_API
api
DataType stringToDataType(const std::string &str)
std::string dataTypeToString(DataType data_type)
DataType dataTypeOf< float >()