Web3.0推动分布式经济模型的实现,如NFT、Defi、加密货币和去中心化自治组织(DAO)。Web3.0共建共享的特性,与Web2.0中用户仅作为使用者不同,使Web3.0中用户能主动参与共建与共治,以DAO的组织形式,利用区块链技术和智能合约进行规则制定与执行,共担共享平台或协议的价值。
DAO是Web3.0的重要治理机制,其在区块链上运营,是一种自动化和去中心化的治理形式。
//wrapping input tensor,convert nhwc to nchw
std::vector<int>dims{1,INPUT_SIZE,INPUT_SIZE,3};
auto nhwc_Tensor=MNN::Tensor::create<float>(dims,NULL,MNN::Tensor::TENSORFLOW);
auto nhwc_data=nhwc_Tensor->host<float>();
auto nhwc_size=nhwc_Tensor->size();
::memcpy(nhwc_data,image.data,nhwc_size);
std::string input_tensor="data";
auto inputTensor=net->getSessionInput(session,nullptr);
inputTensor->copyFromHostTensor(nhwc_Tensor);
//run network
net->runSession(session);
//get output data
std::string output_tensor_name0="conv5_fwd";
MNN::Tensor*tensor_lmks=net->getSessionOutput(session,output_tensor_name0.c_str());
MNN::Tensor tensor_lmks_host(tensor_lmks,tensor_lmks->getDimensionType());
tensor_lmks->copyToHostTensor(&tensor_lmks_host);
//load and config mnn model
auto revertor=std::unique_ptr<Revert>(new Revert(model_name.c_str()));
revertor->initialize();
auto modelBuffer=revertor->getBuffer();
const auto bufferSize=revertor->getBufferSize();
auto net=std::shared_ptr<MNN::Interpreter>(MNN::Interpreter::createFromBuffer(modelBuffer,bufferSize));
revertor.reset();
MNN::ScheduleConfig config;
config.numThread=threads;
config.type=static_cast<MNNForwardType>(forward);
MNN::BackendConfig backendConfig;
config.backendConfig=&backendConfig;
auto session=net->createSession(config);
net->releaseModel();