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

◆ Block() [1/2]

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

Definition at line 19 of file Predictor.cc.

19 {}

◆ Block() [2/2]

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:30

◆ ~Block()

mxnet::cpp::Block::~Block ( )
virtual

Definition at line 28 of file Predictor.cc.

28 {}

Member Function Documentation

◆ arg_map()

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

◆ aux_map()

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

Definition at line 35 of file Predictor.h.

References aux_map_.

35 { return aux_map_; }
std::map< std::string, NDArray > aux_map_
Definition: Predictor.h:45

◆ load_parameters()

void mxnet::cpp::Block::load_parameters ( const std::string &  param_file)
private

Definition at line 30 of file Predictor.cc.

References arg_map_, aux_map_, dqmdumpme::k, and Skims_PA_cff::name.

Referenced by Block().

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

◆ symbol() [1/2]

const Symbol& mxnet::cpp::Block::symbol ( ) const
inline

Definition at line 32 of file Predictor.h.

References sym_.

32 { return sym_; }

◆ symbol() [2/2]

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

◆ arg_map_

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().

◆ aux_map_

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().

◆ sym_

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

Definition at line 41 of file Predictor.h.

Referenced by Block(), and symbol().