Skip to content

Instantly share code, notes, and snippets.

@connorgoggins
Created February 25, 2020 18:01
Show Gist options
  • Save connorgoggins/b72ca4b65152b9f602745ea1bcb431d8 to your computer and use it in GitHub Desktop.
Save connorgoggins/b72ca4b65152b9f602745ea1bcb431d8 to your computer and use it in GitHub Desktop.

Script:

from mxnet import nd
from benchmark.opperf.utils.benchmark_utils import run_performance_test

print(run_performance_test(nd.RNN, run_backward=True, inputs=[{'data': (2**28,4,4), 'parameters': nd.random_normal(shape=(28,)), 'state': nd.random_normal(shape=(1, 4, 1)), 'state_cell': nd.random_normal(shape=(1, 4, 1)), 'mode': 'lstm', 'state_size': 1, 'num_layers': 1}], warmup=1, runs=1))

Output:

INFO:root:Begin Benchmark - RNN
INFO:root:Complete Benchmark - RNN
[{'RNN': [{'inputs': {'data': (268435456, 4, 4), 'parameters': '<NDArray 28 @cpu(0)>', 'state': '<NDArray 1x4x1 @cpu(0)>', 'state_cell': '<NDArray 1x4x1 @cpu
(0)>', 'mode': 'lstm', 'state_size': 1, 'num_layers': 1}, 'max_storage_mem_alloc_cpu/0': 32212254.0, 'avg_time_forward_RNN': 1674036.0, 'avg_time_backward_RN
N': 6374651.0}]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment