Manipulating Data with ndarray

#1

URL: http://en.diveintodeeplearning.org/chapter_crashcourse/ndarray.html

#2

In section Operations, it seems that the function f should be R^2 \to R rather than R \to R.

And in “In [11]”, the operations should be between x+y, x-y, etc. (it says x+x, x-x,…).

#3

I get the following error when running x = nd.array(12). I installed mxnet as per the introduction and activated the conda environment. Please advise:

AttributeError: module ‘mxnet.ndarray’ has no attribute ‘arrange’

#4

Disregard, I was using nd.arrange() and the command is nd.arange() with one ‘r’.

#5

Thanks. Would you like to contribute to the book by fixing such issues?

Here is how:
http://en.diveintodeeplearning.org/chapter_appendix/how-to-contribute.html

#6

I have followed all installation steps. I tried running the code in the Notebook by going to the folder “d2l-en”, then type “cmd” onto the address bar. When the command prompt window pops up I typed in “jupyter notebook”. The note books then appear and I open the notebook for this section. When I tried to run the code, the following error appears. Can someone help? Thanks


ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 import mxnet as mx
2 from mxnet import nd

ModuleNotFoundError: No module named ‘mxnet’

#7

Have you install mxnet? Use “pip install mxnet”
Or “pip install mxnet-cuxx” replace xx with your cuda version and multiply by 10, ex- “pip install mxnet-cu100” for cuda version 10.0

#8

It worked! Thanks for the fix

#9

Hi there, I am stuck (yet again) on the Data Manipulation part (section 2.1).

I opened up a bank Jupyter Notebook to practice the code in the book. When I tried to import mxnet as mx and from mxnet import nd, I get the following message. Does any know what that means and how to fix it? Thanks


C:\ProgramData\Anaconda3\lib\site-packages\h5py_hl\base.py:19: DeprecationWarning: Using or importing the ABCs from ‘collections’ instead of from ‘collections.abc’ is deprecated, and in 3.8 it will stop working from collections import (Mapping, MutableMapping, KeysView, C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\func_inspect.py:53: DeprecationWarning: invalid escape sequence < ‘<doctest (..rst)[(.)]>’, source_file).groups() C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib_memory_helpers.py:10: DeprecationWarning: invalid escape sequence \s cookie_re = re.compile(“coding[:=]\s*([-\w.]+)”) C:\ProgramData\Anaconda3\lib\site-packages\socks.py:58: DeprecationWarning: Using or importing the ABCs from ‘collections’ instead of from ‘collections.abc’ is deprecated, and in 3.8 it will stop working from collections import Callable

#10

Sorry I don’t know how to fix this. But I think mxnet installation is perfectly fine. It’s the anaconda that causing the error. Try removing anaconda if possible. And then uninstall and reinstall mxnet.

#11

Is there any rule for broadcast mechanism, because I am unable to broadcast with tensors for Exercise - 2

This is what I have tried for tensors:

a = nd.random.normal(0, 1, shape=(1, 6, 2))
b = nd.random.normal(0, 1, shape=(6, 3, 1))
#12

To broadcast you need to have dimensions of size 1, or matching dimensions across your tensors

For example:

a = nd.random.normal(0, 1, shape=(1, 6, 2))
b = nd.random.normal(0, 1, shape=(6, 6, 1))

would work.

#13

I get it now thanks :+1:t4: