Incomplete mxnet install?

时间:2017-08-05 10:55:34

标签: python mxnet

I am following along with the tutorials here: http://gluon.mxnet.io/P01-C02-ndarray.html. I installed mxnet for windows according to the instructions here: http://mxnet.io/get_started/windows_setup.html.

I did not get so far before running into some difficultly. For instance running the following

import mxnet as mx
from mxnet import nd
mx.random.seed(1)
y = nd.random_normal(shape=(3,4))
print(y.asnumpy())

gives this error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-16-a96a0205f28b> in <module>()
----> 1 y = nd.random_normal(shape=(3,4))
      2 print(y.asnumpy())

AttributeError: 'module' object has no attribute 'random_normal'

I tried printing out the module methods and indeed there appears to be no nd.random_normal, nd.random_uniform, or any of the other nd.random_... methods I would have expected to find from the docs here: http://mxnet.io/api/python/ndarray.html#the-ndarray-class. Here are the packages that I do have:

dir(mx)
['AttrScope',
 'Context',
 'MXNetError',
 '__builtins__',
 '__doc__',
 '__file__',
 '__name__',
 '__package__',
 '__path__',
 '__version__',
 'absolute_import',
 'attribute',
 'base',
 'callback',
 'context',
 'cpu',
 'current_context',
 'executor',
 'executor_manager',
 'gpu',
 'init',
 'initializer',
 'io',
 'kv',
 'kvstore',
 'kvstore_server',
 'libinfo',
 'lr_scheduler',
 'metric',
 'mod',
 'model',
 'module',
 'mon',
 'monitor',
 'name',
 'nd',
 'ndarray',
 'operator',
 'optimizer',
 'random',
 'recordio',
 'rnd',
 'rtc',
 'sym',
 'symbol',
 'symbol_doc',
 'th',
 'torch',
 'visualization',
 'viz']

Have I somehow managed an incomplete install or were these methods possibly moved to another part of the namespace in a recent update?

1 个答案:

答案 0 :(得分:1)

I assume you installed the prebuilt last release version of mxnet. The docs however are based on the master / development version of mxnet. Please install mxnet from source, following the installation guide you already mentioned:

http://mxnet.io/get_started/windows_setup.html#building-and-installing-packages-on-windows