mirror of
https://github.com/RustyRaptor/incubator-mxnet.git
synced 2026-12-04 16:25:27 -07:00
Time major data layout support for RNN (#3497)
* rnn-cell demo (push to server for testing) * a running example with cuDNN RNN cell * ndarray concatenate * fix lint errors * allow batch_axis in executor_group * add batch_axis parameter for all modules * fix bug in copy slice implementation * fix module examples * use batch_axis if data iterator provided such information * rnn cell example in time major * fix init state names in rnn cell bucketing example * sanity check stochastic depth mnist * a cifar10 example (not tested) * add description for sd cifar * add doc for sd module * add a simple random number queue * add final numbers * fix typo * default layout mapper * fix other modules for layout mapper * fix typo * softmax output mode that preserves the shape * comments on run-time speed of time-major * extend layout mapper to include other information * fix data layout API change * fix lint errors * fix Travis CI numpy error on unit test
This commit is contained in:
1 parent
d97e3605af
commit
23bf60cab8
20 files changed
+879
-131
No files matched your search
@@ -38,6 +38,8 @@ class PythonModule(BaseModule):
|
||||
self._label_shapes = None
|
||||
self._output_shapes = None
|
||||
|
||||
self.layout_mapper = None
|
||||
|
||||
################################################################################
|
||||
# Symbol information
|
||||
################################################################################
|
||||
@@ -139,7 +141,8 @@ class PythonModule(BaseModule):
|
||||
# module setup
|
||||
################################################################################
|
||||
def bind(self, data_shapes, label_shapes=None, for_training=True,
|
||||
inputs_need_grad=False, force_rebind=False, shared_module=None):
|
||||
inputs_need_grad=False, force_rebind=False, shared_module=None,
|
||||
layout_mapper=None):
|
||||
"""Bind the symbols to construct executors. This is necessary before one
|
||||
can perform computation with the module.
|
||||
|
||||
@@ -162,11 +165,16 @@ class PythonModule(BaseModule):
|
||||
Default is `None`. This is used in bucketing. When not `None`, the shared module
|
||||
essentially corresponds to a different bucket -- a module with different symbol
|
||||
but with the same sets of parameters (e.g. unrolled RNNs with different lengths).
|
||||
layout_mapper: LayoutMapper
|
||||
Default None. A helper that decide the layout of data, label and outputs
|
||||
(time-major? batch-major?).
|
||||
"""
|
||||
if self.binded and not force_rebind:
|
||||
self.logger.warning('Already binded, ignoring bind()')
|
||||
return
|
||||
|
||||
self.layout_mapper = layout_mapper
|
||||
|
||||
self.for_training = for_training
|
||||
self.inputs_need_grad = inputs_need_grad
|
||||
|
||||
|
||||
Reference in new issue
Block a user