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

Executor interface. More...

#include <executor.h>

Collaboration diagram for mxnet::cpp::Executor:
Collaboration graph

Public Member Functions

 Executor (const Symbol &symbol, Context context, const std::vector< NDArray > &arg_arrays, const std::vector< NDArray > &grad_arrays, const std::vector< OpReqType > &grad_reqs, const std::vector< NDArray > &aux_arrays, const std::map< std::string, Context > &group_to_ctx=std::map< std::string, Context >(), Executor *shared_exec=nullptr)
 
 Executor (const CachedOpHandle &h)
 
void Forward (bool is_train)
 Perform a Forward operation of Operator After this operation, user can get the result by using function head. More...
 
void Backward (const std::vector< NDArray > &head_grads=std::vector< NDArray >())
 Perform a Backward operation of the Operator. This must be called after Forward. After this operation, NDArrays specified by grad_in_args_store will be updated accordingly. User is allowed to pass in an empty Array if the head node is loss function and head gradeitn is not needed. More...
 
void Reshape ()
 
 ~Executor ()
 destructor, free the handle More...
 
std::map< std::string, NDArrayarg_dict ()
 
std::map< std::string, NDArraygrad_dict ()
 
std::map< std::string, NDArrayaux_dict ()
 

Public Attributes

std::vector< NDArrayarg_arrays
 
std::vector< NDArraygrad_arrays
 
std::vector< NDArrayaux_arrays
 
std::vector< NDArraycombined_arrays
 
int device_type
 
int device_id
 
bool require_grad
 
std::vector< NDArrayoutputs
 arrays store the outputs of forward More...
 

Detailed Description

Executor interface.

Constructor & Destructor Documentation

◆ Executor() [1/2]

mxnet::cpp::Executor::Executor ( const Symbol symbol,
Context  context,
const std::vector< NDArray > &  arg_arrays,
const std::vector< NDArray > &  grad_arrays,
const std::vector< OpReqType > &  grad_reqs,
const std::vector< NDArray > &  aux_arrays,
const std::map< std::string, Context > &  group_to_ctx = std::map< std::string, Context >(),
Executor shared_exec = nullptr 
)

◆ Executor() [2/2]

mxnet::cpp::Executor::Executor ( const CachedOpHandle h)
inlineexplicit

◆ ~Executor()

mxnet::cpp::Executor::~Executor ( )
inline

destructor, free the handle

Member Function Documentation

◆ arg_dict()

std::map<std::string, NDArray> mxnet::cpp::Executor::arg_dict ( )
inline

◆ aux_dict()

std::map<std::string, NDArray> mxnet::cpp::Executor::aux_dict ( )
inline

◆ Backward()

void mxnet::cpp::Executor::Backward ( const std::vector< NDArray > &  head_grads = std::vector<NDArray>())
inline

Perform a Backward operation of the Operator. This must be called after Forward. After this operation, NDArrays specified by grad_in_args_store will be updated accordingly. User is allowed to pass in an empty Array if the head node is loss function and head gradeitn is not needed.

Parameters
head_gradsthe gradient of head nodes to be backproped.

◆ Forward()

void mxnet::cpp::Executor::Forward ( bool  is_train)
inline

Perform a Forward operation of Operator After this operation, user can get the result by using function head.

◆ grad_dict()

std::map<std::string, NDArray> mxnet::cpp::Executor::grad_dict ( )
inline

◆ Reshape()

void mxnet::cpp::Executor::Reshape ( )

Member Data Documentation

◆ arg_arrays

std::vector<NDArray> mxnet::cpp::Executor::arg_arrays

◆ aux_arrays

std::vector<NDArray> mxnet::cpp::Executor::aux_arrays

◆ combined_arrays

std::vector<NDArray> mxnet::cpp::Executor::combined_arrays

◆ device_id

int mxnet::cpp::Executor::device_id

◆ device_type

int mxnet::cpp::Executor::device_type

◆ grad_arrays

std::vector<NDArray> mxnet::cpp::Executor::grad_arrays

◆ outputs

std::vector<NDArray> mxnet::cpp::Executor::outputs

arrays store the outputs of forward

◆ require_grad

bool mxnet::cpp::Executor::require_grad

The documentation for this class was generated from the following file: