Official TensorFlow for Jetson Nano!

My post was not focused on a comparison with a laptop. The focus is that a got better numbers with a tensorflow that is not loading the cuda libraries than with one that is properly loading the cuda libraries.
As this seems against the logic, I was wondering if I may have done anything wrong or if there was any problem with tensorflow for jetpack 4.4.

What version of protobuf?

For x86_64, OSX/Linux, python 3.7/3.8, I had to install specific version of proto 3.8.0. Searching the tensorflow github PRs and issues, is usually my first stop for these issues.

Yes, I am now trying to build a new protobuf. The steps described by Nvidia in this thread install PB 3.0.6 on my machine. That is probably too old.

Unsuccessful so far. Neither Protobuf 3.6, 3.8 did fix anything.

what the hell?
python3 tensorflow2.1+20.4 jetpack4.4

import tensorflow as tf
2020-05-12 16:13:47.706899: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.2
2020-05-12 16:13:50.404420: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libnvinfer.so.7
2020-05-12 16:13:50.406626: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libnvinfer_plugin.so.7
print(tf.version)
Traceback (most recent call last):
File “”, line 1, in
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

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

I was getting similar errors from the wheel. I’m just going to build from source.

This works:

tf.version.VERSION
‘2.1.0’

Is there are chance to get an updated version of TF 2.1.1?
Version 2.1.1 ‘Fixes a versioning bug which causes Keras layers from TF 1.x to be used instead of those from TF 2.x’

I tried to build TF from source, but failed (it seems TF2.1.1 requires cuDNN7.6, but Jetpack 4.4 installed TF2.1 with cuDNN 8.0). Downgrading cuDNN 8.0 to 7.6 gives a ‘broken package’ …

(using Jetson Nano, Ubuntu 18.04, Jetpack4.4)

1 Like

Dear all.

I installed Jetpack 4.4 and Nvidia TensorFlow 2.1.0.
I have a question for tf.convert_to_tensor function.

In my Jetson Nano, following return without numpy object.
>>> import numpy as np
>>> import tensorflow as tf
>>> a = np.array([1,2])
>>> a
array([1, 2])
>>> t = tf.convert_to_tensor(a)
>>> t
<tf.Tensor ‘Const:0’ shape=(2,) dtype=int64>

But tensorflow-gpu 2.0.0 and other system’s tensorflow 2.1.0 includes numpy.
For example, my mac return following.

>>> import numpy as np
>>> import tensorflow as tf
>>> a = np.array([1,2])
>>> a
array([1, 2])
>>> t = tf.convert_to_tensor(a)
>>> t
<tf.Tensor: shape=(2,), dtype=int64, numpy=array([1, 2])>

I have a trouble with Nvidia’s TensorFlow 2.1.0 because I test TensorFlow Lite example but tf.lite.Interpreter.set_tensor raise ValueError.

BTW, I was finally able to compile (app 40hours!!!) and install TF2.1.1 from source and install on my Nano
Seems much more stable compared to 2.1

@AastaLLL would it be possible to release a new TF 2.1 wheel for JetPack 4.4 that would be correctly compiled? I’m also having trouble with running TF 2 on Jetson Nano with JetPack 4.4.

@berykubik:
in the meantime you can try my build: Tensorflow 2.x on Jetson nano - #19 by mictiemix

1 Like

I have some problems with tf 2.1.0 on AGX Xavier.
I installed tf 2.1.0 with “sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v44 tensorflow”

But i feel a little bit strange.

  1. I checked tf version with tensorflow.version but it doesnt have version.
  2. I can’t use function .numpy() to convert tensor to numpy array which is possible in tf2.

@quangminhbui.dev
See the bottom if this post: Official TensorFlow for Jetson Nano! - #127 by steffen.aus.karlsruhe

1 Like

May it work on AGX Xavier?

Most likely not due to different Cuda architecture (5.3 vs 7.2)

I’m also running into this version problem with tensorflow 2.1.0 on my Jetson Xavier NX.

NVIDIA, please release a fixed version ASAP as this is really messing up my use of the module.

3 Likes

Also have the same problem for the Jetson NX.
The command tf.version.VERSION works but it seams to mess up other stuff.
Is there somthing new?

We are still waiting for a new Jetpack 4.4 compatible build.

1 Like