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 18 of file Predictor.cc.

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

Definition at line 21 of file Predictor.cc.

References load_parameters(), and sym_.

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

Definition at line 28 of file Predictor.cc.

28  {
29 }

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 31 of file Predictor.cc.

References arg_map_, aux_map_, mxnet::cpp::Predictor::context_, gen::k, mutex, mxnet::cpp::Predictor::mutex_, and dataset::name.

Referenced by aux_map(), and Block().

31  {
32  std::map<std::string, NDArray> paramters;
33  NDArray::Load(param_file, nullptr, &paramters);
34  for (const auto &k : paramters) {
35  if (k.first.substr(0, 4) == "aux:") {
36  auto name = k.first.substr(4, k.first.size() - 4);
37  aux_map_[name] = k.second;
38  }
39  if (k.first.substr(0, 4) == "arg:") {
40  auto name = k.first.substr(4, k.first.size() - 4);
41  arg_map_[name] = k.second;
42  }
43  }
44 }
std::map< std::string, NDArray > aux_map_
Definition: Predictor.h:45
std::map< std::string, NDArray > arg_map_
Definition: Predictor.h:43
int k[5][pyjets_maxn]
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().