Table Of Contents
Table Of Contents

mxnet.test_utils

Tools for testing.

Functions

almost_equal(a, b[, rtol, atol, equal_nan]) Test if two numpy arrays are almost equal.
almost_equal_ignore_nan(a, b[, rtol, atol]) Test that two NumPy arrays are almost equal (ignoring NaN in either array).
assert_almost_equal(a, b[, rtol, atol, …]) Test that two numpy arrays are almost equal.
assert_almost_equal_ignore_nan(a, b[, rtol, …]) Test that two NumPy arrays are almost equal (ignoring NaN in either array).
assert_exception(f, exception_type, *args, …) Test that function f will throw an exception of type given by exception_type
assign_each(the_input, function) Return ndarray composed of passing each array value through some function
assign_each2(input1, input2, function) Return ndarray composed of passing two array values through some function
check_consistency(sym, ctx_list[, scale, …]) Check symbol gives the same output for different running context
check_numeric_gradient(sym, location[, …]) Verify an operation by checking backward pass via finite difference method.
check_speed(sym[, location, ctx, N, …]) Check the running speed of a symbol.
check_symbolic_backward(sym, location, …) Compares a symbol’s backward results with the expected ones.
check_symbolic_forward(sym, location, expected) Compares a symbol’s forward results with the expected ones.
chi_square_check(generator, buckets, probs) Run the chi-square test for the generator.
create_sparse_array(shape, stype[, …]) Create a sparse array, For Rsp, assure indices are in a canonical format
create_sparse_array_zd(shape, stype, density) Create sparse array, using only rsp_indices to determine density
default_context() Get default context for regression test.
default_dtype() Get default data type for regression test.
discard_stderr() Discards error output of a routine if invoked as:
download(url[, fname, dirname, overwrite, …]) Download an given URL
find_max_violation(a, b[, rtol, atol]) Finds and returns the location of maximum violation.
gen_buckets_probs_with_ppf(ppf, nbuckets) Generate the buckets and probabilities for chi_square test when the ppf (Quantile function)
get_atol([atol]) Get default numerical threshold for regression test.
get_bz2_data(data_dir, data_name, url, …) Download and extract bz2 data.
get_cifar10() Downloads CIFAR10 dataset into a directory in the current directory with the name data, and then extracts all files into the directory data/cifar.
get_im2rec_path([home_env]) Get path to the im2rec.py tool
get_mnist() Download and load the MNIST dataset
get_mnist_iterator(batch_size, input_shape) Returns training and validation iterators for MNIST dataset
get_mnist_pkl() Downloads MNIST dataset as a pkl.gz into a directory in the current directory with the name data
get_mnist_ubyte() Downloads ubyte version of the MNIST dataset into a directory in the current directory with the name data and extracts all files in the zip archive to this directory.
get_rtol([rtol]) Get default numerical threshold for regression test.
get_zip_data(data_dir, url, data_origin_name) Download and extract zip data.
list_gpus() Return a list of GPUs
mean_check(generator, mu, sigma[, nsamples]) Test the generator by matching the mean.
np_reduce(dat, axis, keepdims, numpy_reduce_func) Compatible reduce for old version of NumPy.
numeric_grad(executor, location[, …]) Calculates a numeric gradient via finite difference method.
rand_ndarray(shape, stype[, density, dtype, …])
rand_shape_2d([dim0, dim1])
rand_shape_3d([dim0, dim1, dim2])
rand_shape_nd(num_dim[, dim])
rand_sparse_ndarray(shape, stype[, density, …]) Generate a random sparse ndarray.
random_arrays(*shapes) Generate some random numpy arrays.
random_sample(population, k) Return a k length list of the elements chosen from the population sequence.
retry(n) Retry n times before failing for stochastic test cases.
same(a, b) Test if two NumPy arrays are the same.
same_array(array1, array2) Check whether two NDArrays sharing the same memory block
set_default_context(ctx) Set default context.
set_env_var(key, val[, default_val]) Set environment variable
shuffle_csr_column_indices(csr) Shuffle CSR column indices per row This allows validation of unordered column indices, which is not a requirement for a valid CSR matrix
simple_forward(sym[, ctx, is_train]) A simple forward function for a symbol.
var_check(generator, sigma[, nsamples]) Test the generator by matching the variance.
verify_generator(generator, buckets, probs) Verify whether the generator is correct using chi-square testing.

Classes

DummyIter(real_iter) A dummy iterator that always returns the same batch of data (the first data batch of the real data iter).