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

[Lab 1 Part 1.3] Solution throws AssertionError on Apple M1? #97

Open
adrianhak opened this issue Aug 18, 2021 · 3 comments
Open

[Lab 1 Part 1.3] Solution throws AssertionError on Apple M1? #97

adrianhak opened this issue Aug 18, 2021 · 3 comments

Comments

@adrianhak
Copy link

Running the solution notebook for section 1.3 returns an AssertionError (pasted below)
I'm running macOS 11.5.1 on the M1 chip, using tensorflow-macos 2.5.0

Have anyone got this working on the M1 chip?

[[0.55266035 0.85308117 0.09644735]]
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
/var/folders/_q/0sn2mknj461fsdfsz8xvkhpm0000gn/T/ipykernel_88430/4197002161.py in <module>
     37 # test the output!
     38 print(y.numpy())
---> 39 mdl.lab1.test_custom_dense_layer_output(y)

~/miniforge3/lib/python3.9/site-packages/mitdeeplearning/lab1.py in test_custom_dense_layer_output(y)
     83     true_y = np.array([[0.2697859,  0.45750418, 0.66536945]],dtype='float32')
     84     assert tf.shape(y).numpy().tolist() == list(true_y.shape), "[FAIL] output is of incorrect shape. expected {} but got {}".format(true_y.shape, y.numpy().shape)
---> 85     np.testing.assert_almost_equal(y.numpy(), true_y, decimal=7, err_msg="[FAIL] output is of incorrect value. expected {} but got {}".format(y.numpy(), true_y), verbose=True)
     86     print("[PASS] test_custom_dense_layer_output")
     87     return True

    [... skipping hidden 2 frame]

~/miniforge3/lib/python3.9/site-packages/numpy/testing/_private/utils.py in assert_array_compare(comparison, x, y, err_msg, verbose, header, precision, equal_nan, equal_inf)
    842                                 verbose=verbose, header=header,
    843                                 names=('x', 'y'), precision=precision)
--> 844             raise AssertionError(msg)
    845     except ValueError:
    846         import traceback

AssertionError: 
Arrays are not almost equal to 7 decimals
[FAIL] output is of incorrect value. expected [[0.55266035 0.85308117 0.09644735]] but got [[0.2697859  0.45750418 0.66536945]]
Mismatched elements: 3 / 3 (100%)
Max absolute difference: 0.5689221
Max relative difference: 1.0485145
 x: array([[0.5526603, 0.8530812, 0.0964473]], dtype=float32)
 y: array([[0.2697859, 0.4575042, 0.6653695]], dtype=float32)

Python packages installed:

absl-py @ file:///home/conda/feedstock_root/build_artifacts/absl-py_1606234718434/work
anyio==3.3.0
appnope==0.1.2
argon2-cffi==20.1.0
astunparse @ file:///home/conda/feedstock_root/build_artifacts/astunparse_1610696312422/work
attrs==21.2.0
Babel==2.9.1
backcall==0.2.0
bleach==4.0.0
brotlipy==0.7.0
cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
cachetools==4.2.2
certifi==2021.5.30
cffi @ file:///Users/runner/miniforge3/conda-bld/cffi_1625835350093/work
chardet @ file:///Users/runner/miniforge3/conda-bld/chardet_1610093454858/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1626371162869/work
cloudpickle==1.6.0
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1602866480661/work
conda==4.10.3
conda-package-handling @ file:///Users/runner/miniforge3/conda-bld/conda-package-handling_1618231726924/work
cryptography @ file:///Users/runner/miniforge3/conda-bld/cryptography_1616851494586/work
cycler==0.10.0
debugpy==1.4.1
decorator==5.0.9
defusedxml==0.7.1
entrypoints==0.3
flatbuffers==1.12
gast @ file:///home/conda/feedstock_root/build_artifacts/gast_1596839682936/work
google-auth==1.35.0
google-auth-oauthlib==0.4.5
google-pasta==0.2.0
grpcio @ file:///Users/runner/miniforge3/conda-bld/grpcio_1610588577338/work
gym==0.19.0
h5py @ file:///Users/runner/miniforge3/conda-bld/h5py_1609497507927/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1609836280497/work
ipykernel==6.2.0
ipython==7.26.0
ipython-genutils==0.2.0
jedi==0.18.0
Jinja2==3.0.1
json5==0.9.6
jsonschema==3.2.0
jupyter-client==6.1.12
jupyter-core==4.7.1
jupyter-server==1.10.2
jupyterlab==3.1.7
jupyterlab-pygments==0.1.2
jupyterlab-server==2.7.1
keras-nightly==2.5.0.dev2021032900
Keras-Preprocessing @ file:///home/conda/feedstock_root/build_artifacts/keras-preprocessing_1610713559828/work
kiwisolver==1.3.1
Markdown==3.3.4
MarkupSafe==2.0.1
matplotlib==3.4.3
matplotlib-inline==0.1.2
mistune==0.8.4
mitdeeplearning==0.2.0
nbclassic==0.3.1
nbclient==0.5.4
nbconvert==6.1.0
nbformat==5.1.3
nest-asyncio==1.5.1
notebook==6.4.3
numpy==1.21.2
oauthlib==3.1.1
opencv-python==4.5.3.56
opt-einsum @ file:///home/conda/feedstock_root/build_artifacts/opt_einsum_1617859230218/work
packaging==21.0
pandocfilters==1.4.3
parso==0.8.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.3.1
prometheus-client==0.11.0
prompt-toolkit==3.0.19
protobuf==3.17.2
ptyprocess==0.7.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycosat @ file:///Users/runner/miniforge3/conda-bld/pycosat_1624996792650/work
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1593275161868/work
Pygments==2.10.0
pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1608055815057/work
pyparsing==2.4.7
pyrsistent==0.18.0
PySocks @ file:///Users/runner/miniforge3/conda-bld/pysocks_1610291460269/work
python-dateutil==2.8.2
pytz==2021.1
pyzmq==22.2.1
regex==2021.8.3
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1626393743643/work
requests-oauthlib==1.3.0
requests-unixsocket==0.2.0
rsa==4.7.2
ruamel-yaml-conda @ file:///Users/runner/miniforge3/conda-bld/ruamel_yaml_1624999868738/work
scipy @ file:///Users/runner/miniforge3/conda-bld/scipy_1624824941870/work
Send2Trash==1.8.0
six @ file:///home/conda/feedstock_root/build_artifacts/six_1590081179328/work
sniffio==1.2.0
tensorboard==2.6.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
tensorflow-estimator==2.5.0
tensorflow-macos==2.5.0
tensorflow-metal==0.1.2
termcolor==1.1.0
terminado==0.11.0
testpath==0.5.0
tornado==6.1
tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1627689047698/work
traitlets==5.0.5
typing-extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1602702424206/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1624634538755/work
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.2.1
Werkzeug==2.0.1
wrapt @ file:///Users/runner/miniforge3/conda-bld/wrapt_1624972047019/work
@highel
Copy link

highel commented Apr 20, 2022

If this is MIT lab, I had the same problem because was referencing b from the context instead of self.b , but please keep this post for future generations

@rlamba89
Copy link

rlamba89 commented Apr 8, 2023

I am using the same machine, also referring self.b and getting the same error. Is there any way to rectify this issue?

@highel
Copy link

highel commented Apr 11, 2023

I am using the same machine, also referring self.b and getting the same error. Is there any way to rectify this issue?

See another issue #116
If you re running locally then get the pull request suggested and install local version of mitdeeplearning library with pip3 install . from the suggested PR

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

3 participants