mxnet
|
Basic utilility functions. More...
#include <dmlc/logging.h>
#include <dmlc/omp.h>
#include <nnvm/graph.h>
#include <mxnet/engine.h>
#include <mxnet/ndarray.h>
#include <mxnet/op_attr_types.h>
#include <mxnet/graph_attr_types.h>
#include <nnvm/graph_attr_types.h>
#include <memory>
#include <vector>
#include <type_traits>
#include <utility>
#include <random>
#include <string>
#include <thread>
#include <algorithm>
#include <functional>
#include <limits>
#include "../operator/mxnet_op.h"
Go to the source code of this file.
Classes | |
struct | mxnet::common::csr_indptr_check |
IndPtr should be non-negative, in non-decreasing order, start with 0 and end with value equal with size of indices. More... | |
struct | mxnet::common::csr_idx_check |
Indices should be non-negative, less than the number of columns and in ascending order per row. More... | |
struct | mxnet::common::rsp_idx_check |
Indices of RSPNDArray should be non-negative, less than the size of first dimension and in ascending order. More... | |
struct | mxnet::common::helper::UniqueIf< T > |
Helper for non-array type T . More... | |
struct | mxnet::common::helper::UniqueIf< T[]> |
Helper for an array of unknown bound T . More... | |
struct | mxnet::common::helper::UniqueIf< T[kSize]> |
Helper for an array of known bound T . More... | |
Namespaces | |
mxnet | |
namespace of mxnet | |
mxnet::common | |
mxnet::common::helper | |
Helper functions. | |
Typedefs | |
typedef std::mt19937 | mxnet::common::RANDOM_ENGINE |
Random Engine. More... | |
Functions | |
template<typename xpu > | |
void | mxnet::common::CheckFormatWrapper (const RunContext &rctx, const NDArray &input, const TBlob &err_cpu, const bool full_check) |
template<typename xpu > | |
void | mxnet::common::CheckFormatCSRImpl (const RunContext &rctx, const NDArray &input, const TBlob &err_cpu, const bool full_check) |
Check the validity of CSRNDArray. More... | |
template<typename xpu > | |
void | mxnet::common::CheckFormatRSPImpl (const RunContext &rctx, const NDArray &input, const TBlob &err_cpu, const bool full_check) |
Check the validity of RowSparseNDArray. More... | |
template<typename xpu > | |
void | mxnet::common::CheckFormatImpl (const RunContext &rctx, const NDArray &input, const TBlob &err_cpu, const bool full_check) |
template<typename xpu > | |
void | mxnet::common::SparseRetainOpForwardRspWrapper (mshadow::Stream< xpu > *s, const NDArray &input_nd, const TBlob &idx_data, const OpReqType req, NDArray *output_nd) |
Pick rows specified by user input index array from a row sparse ndarray and save them in the output sparse ndarray. More... | |
template<typename xpu > | |
void | mxnet::common::CastStorageDispatch (const OpContext &ctx, const NDArray &input, const NDArray &output) |
bool | mxnet::common::ContainsOnlyStorage (const StorageTypeVector &vstorage, const NDArrayStorageType stype) |
returns true if all storage types in vstorage are the same as target stype . false is returned for empty inputs. More... | |
bool | mxnet::common::ContainsOnlyStorage (const StorageTypeVector &vstorage, const NDArrayStorageType stype1, const NDArrayStorageType stype2, bool *has_both) |
returns true if all storage types in vstorage are the same as target stype1 or `stype2'. Sets boolean if both found. false is returned for empty inputs. More... | |
bool | mxnet::common::ContainsOnlyStorage (const std::vector< NDArray > &ndarrays, const NDArrayStorageType stype) |
returns true if the storage types of arrays in ndarrays are the same as target stype . false is returned for empty inputs. More... | |
bool | mxnet::common::ContainsOnlyStorage (const std::vector< NDArray > &ndarrays, const NDArrayStorageType stype1, const NDArrayStorageType stype2, bool *has_both) |
returns true if the storage types of arrays in ndarrays are the same as targets stype1 or stype2 . false is returned for empty inputs. More... | |
bool | mxnet::common::ContainsStorageType (const std::vector< NDArray > &ndarrays, const NDArrayStorageType stype) |
returns true if storage type of any array in ndarrays is the same as the target stype . false is returned for empty inputs. More... | |
bool | mxnet::common::ContainsStorageType (const std::vector< int > &ndstypes, const NDArrayStorageType stype) |
returns true if any storage type ndstype in ndstypes is the same as the target stype . false is returned for empty inputs. More... | |
std::string | mxnet::common::dispatch_mode_string (const DispatchMode x) |
get string representation of dispatch_mode More... | |
std::string | mxnet::common::stype_string (const int x) |
get string representation of storage_type More... | |
std::string | mxnet::common::dev_type_string (const int dev_type) |
get string representation of device type More... | |
std::string | mxnet::common::operator_stype_string (const nnvm::NodeAttrs &attrs, const int dev_mask, const std::vector< int > &in_attrs, const std::vector< int > &out_attrs) |
get string representation of the operator stypes More... | |
std::string | mxnet::common::operator_string (const nnvm::NodeAttrs &attrs, const OpContext &ctx, const std::vector< NDArray > &inputs, const std::vector< OpReqType > &req, const std::vector< NDArray > &outputs) |
get string representation of the operator More... | |
void | mxnet::common::LogOnce (const std::string &message) |
log message once. Intended for storage fallback warning messages. More... | |
void | mxnet::common::LogStorageFallback (const nnvm::NodeAttrs &attrs, const int dev_mask, const std::vector< int > *in_attrs, const std::vector< int > *out_attrs) |
log storage fallback event More... | |
int | mxnet::common::GetNumThreadsPerGPU () |
int | mxnet::common::GetExecNumMatchColor () |
template<typename T , typename V > | |
V | mxnet::common::ParallelAccumulate (const T *a, const int n, V start) |
template<typename RandomIt , typename Compare > | |
void | mxnet::common::ParallelSortHelper (RandomIt first, size_t len, size_t grainsize, const Compare &comp) |
Helper function for ParallelSort. DO NOT call this function directly. Use the interface ParallelSort instead. Ref: https://github.com/dmlc/difacto/blob/master/src/common/parallel_sort.h. More... | |
template<typename RandomIt , typename Compare > | |
void | mxnet::common::ParallelSort (RandomIt first, RandomIt last, size_t num_threads, Compare comp) |
Sort the elements in the range [first, last) into the ascending order defined by the comparator comp. If the length of the range [first, last) is greater than a certain threshold, the range will be recursively divided into two and assign two threads to sort each half range. Ref: https://github.com/dmlc/difacto/blob/master/src/common/parallel_sort.h. More... | |
template<typename RandomIt > | |
void | mxnet::common::ParallelSort (RandomIt first, RandomIt last, size_t num_threads) |
Sort the elements in the range [first, last) into ascending order. The elements are compared using the default < operator. If the length of the range [first, last) is greater than a certain threshold, the range will be recursively divided into two and assign two threads to sort each half range. Ref: https://github.com/dmlc/difacto/blob/master/src/common/parallel_sort.h. More... | |
template<class T , class... Args> | |
helper::UniqueIf< T >::SingleObject | mxnet::common::MakeUnique (Args &&...args) |
Constructs an object of type T and wraps it in a std :: unique_ptr . More... | |
template<class T > | |
helper::UniqueIf< T >::UnknownBound | mxnet::common::MakeUnique (size_t n) |
Constructs an object of type T and wraps it in a std :: unique_ptr . More... | |
template<class T , class... Args> | |
helper::UniqueIf< T >::KnownBound | mxnet::common::MakeUnique (Args &&...args)=delete |
Constructs an object of type T and wraps it in a std :: unique_ptr . More... | |
template<typename FCompType > | |
FCompType | mxnet::common::GetFCompute (const nnvm::Op *op, const std::string &name, const Context &ctx) |
template<typename T > | |
constexpr size_t | mxnet::common::MaxIntegerValue () |
Return the max integer value representable in the type T without loss of precision. More... | |
template<> | |
constexpr size_t | mxnet::common::MaxIntegerValue< mshadow::half::half_t > () |
MSHADOW_XINLINE int | mxnet::common::ilog2ul (size_t a) |
MSHADOW_XINLINE int | mxnet::common::ilog2ui (unsigned int a) |
NDArray | mxnet::common::InitZeros (const NDArrayStorageType stype, const mxnet::TShape &shape, const Context &ctx, const int dtype) |
Return an NDArray of all zeros. More... | |
void | mxnet::common::EmplaceBackZeros (const NDArrayStorageType stype, const mxnet::TShape &shape, const Context &ctx, const int dtype, std::vector< NDArray > *vec) |
Helper to add a NDArray of zeros to a std::vector. More... | |
template<typename DType > | |
void | mxnet::common::ParallelCopy (DType *dst, const DType *src, index_t size) |
parallelize copy by OpenMP. More... | |
void | mxnet::common::ConvertToNumpyShape (mxnet::TShape *shape) |
If numpy compatibility is turned off (default), the shapes passed in by users follow the legacy shape definition: More... | |
void | mxnet::common::ConvertToNumpyShape (mxnet::ShapeVector *shapes) |
void | mxnet::common::ConvertToLegacyShape (mxnet::TShape *shape) |
This is function is used to convert shapes returned by the infer shape functions/pass to the legacy shape definition. More... | |
void | mxnet::common::ConvertToLegacyShape (mxnet::ShapeVector *shapes) |
Basic utilility functions.
Copyright (c) 2015 by Contributors