Official TensorFlow for Jetson Nano!

I think that Tensorflow for JP 4.4 was compiled with different flags than Tensorflow for JP 4.3.

I now get this (JP 4.4, tf_gpu-2.1.0+nv20.4-py3)

$ python3
Python 3.6.9 (default, Apr 18 2020, 01:56:04) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
2020-05-12 10:51:03.048952: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.2
2020-05-12 10:51:07.319165: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libnvinfer.so.7
2020-05-12 10:51:07.322609: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libnvinfer_plugin.so.7
>>> tensorflow.version
<module 'tensorflow_core._api.v1.version' from '/usr/local/lib/python3.6/dist-packages/tensorflow_core/_api/v1/version/__init__.py'>
>>> tensorflow.__version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/util/module_wrapper.py", line 192, in __getattr__
    attr = getattr(self._tfmw_wrapped_module, name)
AttributeError: module 'tensorflow' has no attribute '__version__'

Furthermore, a deep learning script that worked flawlessly in JP 4.3 with tensorflow-2.1.0+nv20.3-cp36-cp36m-linux_aarch64.whl now fails:

Traceback (most recent call last):
  File "./mnist_dcgan_tf2.py", line 162, in <module>
    train(train_dataset, EPOCHS)
  File "./mnist_dcgan_tf2.py", line 148, in train
    for image_batch in dataset:
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 2443, in __iter__
    return iter(self._dataset)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 426, in __iter__
    raise RuntimeError("__iter__() is only supported inside of tf.function "
RuntimeError: __iter__() is only supported inside of tf.function or when eager execution is enabled.

It only works now under JP 4.4 when I make those changes in the script:

import tensorflow.compat.v2 as tf
import tensorflow.compat.v2.keras as keras
tf.enable_v2_behavior()

This looks like the current Tensorflow for JP 4.4 was compiled with --config=v1 flag., as V2 behaviour seems to be disabled in default.

Can the maintainers of the TF packages check if this was the case?

3 Likes