Stepn跑鞋系统开发/NFT跑鞋链游模式/链上合约/系统开发详情规则/方案逻辑/源码项目
区块链是什么?一句话,它是一种特殊的分布式数据库。首先,区块链的主要作用是储存信息。任何需要保存的信息,都可以写入区块链,也可以从里面读取,所以它是数据库。 其次,任何人都可以架设服务器,加入区块链网络,成为一个节点。区块链的世界里面,没有中心节点,每个节点都是平等的,都保存着整个数据库。你可以向任何一个节点,写入/读取数据,因为所有节点最后都会同步,保证区块链一致。 在区块链中,每个块包含了一定数量的交易信息和该块的唯一标识符,同时还包含了前一个块的哈希值。这样的设计保证了区块之间的顺序和完整性,一旦一个块被添加到区块链中,它就不可更改。这使得区块链成为一个安全可信的分布式账本,可用于记录和验证各种类型的交易。 void Calibration::_computeFeatureScaleADMM(){ //feed input data according to input images int count=0; std::vector<int>oneImageTensorDims=_inputTensorDims; oneImageTensorDims[0]=1; auto inputTensorDataFormat=MNN::TensorUtils::getDescribe(_inputTensor)->dimensionFormat; auto dimType=MNN::Tensor::CAFFE_C4; if(inputTensorDataFormat==MNN::MNN_DATA_FORMAT_NHWC){ dimType=MNN::Tensor::TENSORFLOW; } for(const auto&img:_imgaes){ auto curPtr=_inputTensor->host<float>()+count*_inputTensor->stride(0); std::shared_ptr<MNN::Tensor>tensorWarp( MNN::Tensor::create(oneImageTensorDims,_inputTensor->getType(),curPtr,dimType)); Helper::preprocessInput(_process.get(),_width,_height,img,tensorWarp.get()); count++; MNN_PRINT("rProcessImage:%.2lf%%",(float)count*100.0f/(float)_imageNum); fflush(stdout); } MNN_PRINT("n"); _scales.clear(); const int totalLayers=_featureInfo.size(); count=0; MNN::TensorCallBackWithInfo before=[&](const std::vector<MNN::Tensor*>&nTensors,const MNN::OperatorInfo*info){ if(Helper::gNeedFeatureOp.find(info->type())!=Helper::gNeedFeatureOp.end()){ for(auto t:nTensors){ if(_featureInfo.find(t)!=_featureInfo.end()){ _scales[t]=_featureInfo[t]->computeScaleADMM(); count++; MNN_PRINT("rComputeADMM:%.2lf%%",(float)count*100.0f/(float)totalLayers); fflush(stdout); } } } return true; }; MNN::TensorCallBackWithInfo after=[&](const std::vector<MNN::Tensor*>&nTensors,const MNN::OperatorInfo*info){ if(Helper::gNeedFeatureOp.find(info->type())!=Helper::gNeedFeatureOp.end()){ for(auto t:nTensors){ if(_featureInfo.find(t)!=_featureInfo.end()){ _scales[t]=_featureInfo[t]->computeScaleADMM(); count++; MNN_PRINT("rComputeADMM:%.2lf%%",(float)count*100.0f/(float)totalLayers); fflush(stdout); } } } return true; }; _interpreter->runSessionWithCallBackInfo(_session,before,after); MNN_PRINT("n"); }
发表回复