合約跟單開發需求丨合約跟單系統開發(技術方案)丨合約跟單原始碼及功能

xiaofufu發表於2023-02-28

  什麼是量化交易機器人?從本質上來說,量化交易機器人是一個軟體程式,它直接與金融交易所互動,並根據市場資料的解釋代表你發出買賣指令


  這些機器人透過監控市場價格趨勢並根據一套預設和程式化的規則做出反應來做出這些決定


  通常,交易機器人會分析市場行為,比如交易量、訂單、價格和時間,這些通常可以根據您自己的偏好進行程式設計


  class Calibration{


  public:


  //引數原始模型,模型uint8_t buffer,size,json配置檔案


  Calibration(MNN::NetT*model,uint8_t*modelBuffer,const int bufferSize,const std::string&configPath);


  void runQuantizeModel();


  private:


  Calibration();


  MNN::NetT*_originaleModel;//需要量化的模型


  std::shared_ptr<MNN::CV::ImageProcess>_process;//負責image到tensor的轉化類


  const int _binNums=2048;


  int _imageNum=0;


  int _width;詳細及原始碼:MrsFu123


  int _height;


  std::vector<std::string>_imgaes;//圖片,用於校正特徵量化係數的


  //Tensor and Info


  //tensor到對應的TensorStatistic,TensorStatistic是描述tensor在量化過程中需要的統計資料,後面有解釋


  std::map<const MNN::Tensor*,std::shared_ptr<TensorStatistic>>_featureInfo;


  //所有的tensor


  std::map<int,const MNN::Tensor*>_tensorMap;


  //Op's name,Inputs,Outputs


  //op到input/output tensor的對映


  std::map<std::string,std::pair<std::vector<MNN::Tensor*>,std::vector<MNN::Tensor*>>>_opInfo;


  //The scale results


  std::map<const MNN::Tensor*,std::vector<float>>_scales;


  std::shared_ptr<MNN::Interpreter>_interpreter;


  //keep mnn forward information


  MNN::Session*_session;


  MNN::Tensor*_inputTensor;


  std::vector<int>_inputTensorDims;


  std::string _featureQuantizeMethod="KL";


  std::string _weightQuantizeMethod="MAX_ABS";


  void _initMNNSession(const uint8_t*modelBuffer,const int bufferSize,const int channels);


  void _initMaps();


  void _computeFeatureMapsRange();


  void _collectFeatureMapsDistribution();


  void _computeFeatureScaleKL();


  void _computeFeatureScaleADMM();


  void _updateScale();


  //insert the dequantization op before the not supported op(int8),and insert dequantization op


  //after the output op,so that get original float data conveniently


  void _insertDequantize();


  };


  #endif//CALIBRATION_HPP


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69956839/viewspace-2937457/,如需轉載,請註明出處,否則將追究法律責任。

相關文章