Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mxnet.gluon.parameter.DeferredInitializationError in 'gru0_l0_i2h_weight' #1

Open
scaleoutsean opened this issue Nov 9, 2019 · 0 comments

Comments

@scaleoutsean
Copy link

  • mxnet-cu101mkl 1.5.1.post0
  • python3 opperf.py --output-format json --output-file mxnet_operator_benchmark_results.json
MX_Gluon_Imperative_MaxPool2D_Forward_Backward_Time - 0.000993 seconds
Traceback (most recent call last):
  File "/home/sean/python-tensorflow-vs-mxnet-mkl-gpu/venv/lib/python3.6/site-packages/mxnet/gluon/block.py", line 918, in forward
    params = {i: j.data(ctx) for i, j in self._reg_params.items()}
  File "/home/sean/python-tensorflow-vs-mxnet-mkl-gpu/venv/lib/python3.6/site-packages/mxnet/gluon/block.py", line 918, in <dictcomp>
    params = {i: j.data(ctx) for i, j in self._reg_params.items()}
  File "/home/sean/python-tensorflow-vs-mxnet-mkl-gpu/venv/lib/python3.6/site-packages/mxnet/gluon/parameter.py", line 543, in data
    return self._check_and_get(self._data, ctx)
  File "/home/sean/python-tensorflow-vs-mxnet-mkl-gpu/venv/lib/python3.6/site-packages/mxnet/gluon/parameter.py", line 234, in _check_and_get
    "num_features, etc., for network layers."%(self.name))
mxnet.gluon.parameter.DeferredInitializationError: Parameter 'gru0_l0_i2h_weight' has not been initialized yet because initialization was deferred. Actual initialization happens during the first forward pass. Please pass one batch of data through the network before accessing Parameters. You can also avoid deferred initialization by specifying in_units, num_features, etc., for network layers.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sean/python-tensorflow-vs-mxnet-mkl-gpu/venv/lib/python3.6/site-packages/mxnet/gluon/block.py", line 797, in _deferred_infer_shape
    self.infer_shape(*args)
  File "/home/sean/python-tensorflow-vs-mxnet-mkl-gpu/venv/lib/python3.6/site-packages/mxnet/gluon/block.py", line 870, in infer_shape
    self._infer_attrs('infer_shape', 'shape', *args)
  File "/home/sean/python-tensorflow-vs-mxnet-mkl-gpu/venv/lib/python3.6/site-packages/mxnet/gluon/block.py", line 855, in _infer_attrs
    inputs, out = self._get_graph(*args)
  File "/home/sean/python-tensorflow-vs-mxnet-mkl-gpu/venv/lib/python3.6/site-packages/mxnet/gluon/block.py", line 749, in _get_graph
    out = self.hybrid_forward(symbol, *grouped_inputs, **params)  # pylint: disable=no-value-for-parameter
TypeError: hybrid_forward() missing 1 required positional argument: 'states'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "opperf.py", line 50, in <module>
    final_benchmark_result_map = run_all_mxnet_operator_benchmarks(ctx=ctx, inputs=inputs)
  File "/home/sean/dl-operator-benchmark/mxnet_benchmarks/benchmark_executor.py", line 83, in run_all_mxnet_operator_benchmarks
    mxnet_operator_benchmark_results.extend(run_all_gluon_recurrent_operations_benchmarks(ctx, inputs))
  File "/home/sean/dl-operator-benchmark/mxnet_benchmarks/nn_operations/recurrent_operations.py", line 189, in run_all_gluon_recurrent_operations_benchmarks
    benchmark_ref.run_benchmark()
  File "/home/sean/dl-operator-benchmark/mxnet_benchmarks/nn_operations/recurrent_operations.py", line 166, in run_benchmark
    _, _ = block_forward_backward_and_time(block=self.block, runs=self.warmup, x=self.data)
  File "/home/sean/dl-operator-benchmark/utils/profiler_utils.py", line 15, in timeit
    res = func(*args, **kwargs)
  File "/home/sean/dl-operator-benchmark/mxnet_benchmarks/utils/gluon_utils.py", line 22, in block_forward_backward_and_time
    res = block.forward(*args, **kwargs)
  File "/home/sean/python-tensorflow-vs-mxnet-mkl-gpu/venv/lib/python3.6/site-packages/mxnet/gluon/block.py", line 920, in forward
    self._deferred_infer_shape(x, *args)
  File "/home/sean/python-tensorflow-vs-mxnet-mkl-gpu/venv/lib/python3.6/site-packages/mxnet/gluon/block.py", line 801, in _deferred_infer_shape
    raise ValueError(error_msg)
ValueError: Deferred initialization failed because shape cannot be inferred. hybrid_forward() missing 1 required positional argument: 'states'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant