This class provides a unified interface to inspect the value of all data types including Tensor, TBlob, and NDArray. If the tensor resides on GPU, then it will be copied from GPU memory back to CPU memory to be operated on. Internally, all data types are stored as a TBlob object tb_.
More...
#include <tensor_inspector.h>
|
template<typename Device , int dimension, typename DType > |
| TensorInspector (const mshadow::Tensor< Device, dimension, DType > &ts, const RunContext &ctx) |
| construct from Tensor object More...
|
|
| TensorInspector (const TBlob &tb, const RunContext &ctx) |
| construct from TBlob object More...
|
|
| TensorInspector (const NDArray &arr, const RunContext &ctx) |
| construct from NDArray object. Currently this only works with kDefaultStorage More...
|
|
void | print_string () |
| print the tensor to std::cout More...
|
|
std::string | to_string () |
| return a string which contains the values and other info of the tensor More...
|
|
void | interactive_print (std::string tag="") |
| interactively print the tensor value More...
|
|
template<typename ValueChecker > |
std::vector< std::vector< index_t > > | check_value (const ValueChecker &checker, bool interactive=false, std::string tag="") |
| check/validate the values within the tensor, return the coordinates where the value checker evaluates to true More...
|
|
std::vector< std::vector< index_t > > | check_value (CheckerType ct, bool interactive=false, std::string tag="") |
| check/validate the values within the tensor, return the coordinates where the lambda evaluates to true More...
|
|
void | dump_to_file (std::string tag) |
| dump the value of the tensor to a file with name "tag_[visit count].npy" in npy format More...
|
|
This class provides a unified interface to inspect the value of all data types including Tensor, TBlob, and NDArray. If the tensor resides on GPU, then it will be copied from GPU memory back to CPU memory to be operated on. Internally, all data types are stored as a TBlob object tb_.
|__ __| |_ _| | | | | ___ _ __ ___ ___ _ __| | _ __ ___ _ __ ___ ___| |_ ___ _ __ | |/ _ \ '_ \/ __|/ _ | '__| | | '_ \/ __| '_ \ / _ \/ __| __/ _ | '__| | | __/ | | __ \ (_) | | _| |_| | | __ \ |_) | __/ (__| || (_) | | |_|___|_| |_|___/___/|_||_____|_| |_|___/ .__/ ___|___|_____/|_| | | |_|
template<typename Device , int dimension, typename DType >
construct from Tensor object
- Template Parameters
-
Device | the device the tensor resides in |
dimension | the dimension of the tensor |
DType | the data type |
- Parameters
-
ts | the source tensor object |
ctx | the run context of the tensor |
mxnet::TensorInspector::TensorInspector |
( |
const TBlob & |
tb, |
|
|
const RunContext & |
ctx |
|
) |
| |
|
inline |
construct from TBlob object
- Parameters
-
tb | the source tblob object |
ctx | the run context of the tensor |
mxnet::TensorInspector::TensorInspector |
( |
const NDArray & |
arr, |
|
|
const RunContext & |
ctx |
|
) |
| |
|
inline |
construct from NDArray object. Currently this only works with kDefaultStorage
- Parameters
-
arr | the source ndarray object |
ctx | the run context of the tensor |
template<typename ValueChecker >
std::vector<std::vector<index_t> > mxnet::TensorInspector::check_value |
( |
const ValueChecker & |
checker, |
|
|
bool |
interactive = false , |
|
|
std::string |
tag = "" |
|
) |
| |
|
inline |
check/validate the values within the tensor, return the coordinates where the value checker evaluates to true
- Template Parameters
-
ValueChecker | the type of the lambda |
- Parameters
-
checker | the lambda function to check each value of within the tensor |
interactive | wherether to allow the user to interactively check the coordinates |
tag | the name given to this call |
std::vector<std::vector<index_t> > mxnet::TensorInspector::check_value |
( |
CheckerType |
ct, |
|
|
bool |
interactive = false , |
|
|
std::string |
tag = "" |
|
) |
| |
|
inline |
check/validate the values within the tensor, return the coordinates where the lambda evaluates to true
- Parameters
-
ct | the type of the checker |
interactive | wherether to allow the user to interactively check the coordinates |
tag | the name given to this call |
void mxnet::TensorInspector::dump_to_file |
( |
std::string |
tag | ) |
|
|
inline |
dump the value of the tensor to a file with name "tag_[visit count].npy" in npy format
- Parameters
-
tag | the name given to this call |
void mxnet::TensorInspector::interactive_print |
( |
std::string |
tag = "" | ) |
|
|
inline |
interactively print the tensor value
- Parameters
-
tag | the name given to this call |
void mxnet::TensorInspector::print_string |
( |
| ) |
|
|
inline |
print the tensor to std::cout
std::string mxnet::TensorInspector::to_string |
( |
| ) |
|
|
inline |
return a string which contains the values and other info of the tensor
The documentation for this class was generated from the following file: