CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
mxnet::cpp::Block Class Reference

#include <Predictor.h>

Public Member Functions

const std::map< std::string, NDArray > & arg_map () const
 
const std::map< std::string, NDArray > & aux_map () const
 
 Block ()
 
 Block (const std::string &symbol_file, const std::string &param_file)
 
const Symbol & symbol () const
 
Symbol symbol (const std::string &output_node) const
 
virtual ~Block ()
 

Private Member Functions

void load_parameters (const std::string &param_file)
 

Private Attributes

std::map< std::string, NDArray > arg_map_
 
std::map< std::string, NDArray > aux_map_
 
Symbol sym_
 

Detailed Description

Definition at line 26 of file Predictor.h.

Constructor & Destructor Documentation

mxnet::cpp::Block::Block ( )

Definition at line 17 of file Predictor.cc.

17 {}
mxnet::cpp::Block::Block ( const std::string &  symbol_file,
const std::string &  param_file 
)

Definition at line 19 of file Predictor.cc.

References load_parameters(), and sym_.

19  {
20  // load the symbol
21  sym_ = Symbol::Load(symbol_file);
22  // load the parameters
23  load_parameters(param_file);
24  }
void load_parameters(const std::string &param_file)
Definition: Predictor.cc:28
mxnet::cpp::Block::~Block ( )
virtual

Definition at line 26 of file Predictor.cc.

26 {}

Member Function Documentation

const std::map<std::string, NDArray>& mxnet::cpp::Block::arg_map ( ) const
inline

Definition at line 34 of file Predictor.h.

References arg_map_.

34 { return arg_map_; }
std::map< std::string, NDArray > arg_map_
Definition: Predictor.h:43
const std::map<std::string, NDArray>& mxnet::cpp::Block::aux_map ( ) const
inline

Definition at line 35 of file Predictor.h.

References aux_map_, load_parameters(), and AlCaHLTBitMon_QueryRunRegistry::string.

35 { return aux_map_; }
std::map< std::string, NDArray > aux_map_
Definition: Predictor.h:45
void mxnet::cpp::Block::load_parameters ( const std::string &  param_file)
private

Definition at line 28 of file Predictor.cc.

References arg_map_, aux_map_, mxnet::cpp::Predictor::context_, dqmdumpme::k, mutex, mxnet::cpp::Predictor::mutex_, and Skims_PA_cff::name.

Referenced by aux_map(), and Block().

28  {
29  std::map<std::string, NDArray> paramters;
30  NDArray::Load(param_file, nullptr, &paramters);
31  for (const auto& k : paramters) {
32  if (k.first.substr(0, 4) == "aux:") {
33  auto name = k.first.substr(4, k.first.size() - 4);
34  aux_map_[name] = k.second;
35  }
36  if (k.first.substr(0, 4) == "arg:") {
37  auto name = k.first.substr(4, k.first.size() - 4);
38  arg_map_[name] = k.second;
39  }
40  }
41  }
std::map< std::string, NDArray > aux_map_
Definition: Predictor.h:45
std::map< std::string, NDArray > arg_map_
Definition: Predictor.h:43
const Symbol& mxnet::cpp::Block::symbol ( ) const
inline

Definition at line 32 of file Predictor.h.

References sym_.

32 { return sym_; }
Symbol mxnet::cpp::Block::symbol ( const std::string &  output_node) const
inline

Definition at line 33 of file Predictor.h.

References sym_.

33 { return sym_.GetInternals()[output_node]; }

Member Data Documentation

std::map<std::string, NDArray> mxnet::cpp::Block::arg_map_
private

Definition at line 43 of file Predictor.h.

Referenced by arg_map(), and load_parameters().

std::map<std::string, NDArray> mxnet::cpp::Block::aux_map_
private

Definition at line 45 of file Predictor.h.

Referenced by aux_map(), and load_parameters().

Symbol mxnet::cpp::Block::sym_
private

Definition at line 41 of file Predictor.h.

Referenced by Block(), and symbol().