Error TypeError: _variable_v1_call() got an unexpected keyword argument in JETSON AGX ORIN and Tensorflow 2.12.0

Hello everybody,
I am newby with tensorflow and Jetson AGX Orin. I have installed succesfully the Tensorflow version for JEtson AGX Orin but I am having problems when launching simple programs in python.

My Jetpack and tensorflow versions are the following:

JETPACK VERSION

sudo apt-cache show nvidia-jetpack
Package: nvidia-jetpack
Version: 5.1.2-b104
Architecture: arm64
Maintainer: NVIDIA Corporation
Installed-Size: 194
Depends: nvidia-jetpack-runtime (= 5.1.2-b104), nvidia-jetpack-dev (= 5.1.2-b104)
Homepage: http://developer.nvidia.com/jetson

TENSORFLOW VERSION

pip3 show tensorflow
Name: tensorflow
Version: 2.12.0+nv23.6
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: /usr/local/lib/python3.8/dist-packages

I have created a simple program to check tensorflow neural network model creation works, however the following error appear:

File “/home/user/catkin_ws/src/robotrack_py/scripts/example_tensorflow_node.py”, line 70, in
model = tf.keras.models.Sequential([
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/trackable/base.py”, line 205, in _method_wrapper
result = method(self, *args, **kwargs)
File “/home/user/.local/lib/python3.8/site-packages/keras/src/utils/traceback_utils.py”, line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/variables.py”, line 285, in call
return cls._variable_v1_call(*args, **kwargs)
TypeError: _variable_v1_call() got an unexpected keyword argument ‘experimental_enable_variable_lifting’

My python program is very simple:
import tensorflow as tf
import logging
logger = tf.get_logger()
logger.setLevel(logging.ERROR)
model = tf.keras.models.Sequential([
tf.keras.layers.Input(shape=(3,)),
tf.keras.layers.Dense(100, activation=“relu”),
tf.keras.layers.Dense(100, activation=“relu”),
tf.keras.layers.Dense(100, activation=“relu”),
tf.keras.layers.Dense(1, activation=None)
])

But this error always appear:
TypeError: _variable_v1_call() got an unexpected keyword argument ‘experimental_enable_variable_lifting’

I have also try using different examples to generate an example of simple neural network, for example:
import tensorflow as tf
import logging
logger = tf.get_logger()
logger.setLevel(logging.ERROR)
model = tf.keras.Sequential()
model.add(tf.keras.Input(shape=(16,)))
model.add(tf.keras.layers.Dense(8))

However the same error appears:
TypeError: _variable_v1_call() got an unexpected keyword argument ‘experimental_enable_variable_lifting’

If I remove the tf.keras.Input line then it works without errors
For example, if I run:
model = tf.keras.Sequential()
##model.add(tf.keras.Input(shape=(16,)))
model.add(tf.keras.layers.Dense(8))

Or I run:
model = tf.keras.models.Sequential([
##tf.keras.layers.Input(shape=(3,)),
tf.keras.layers.Dense(100, activation=“relu”),
tf.keras.layers.Dense(100, activation=“relu”),
tf.keras.layers.Dense(100, activation=“relu”),
tf.keras.layers.Dense(1, activation=None)
])

Then the error disappears

Many thanks in advance
Regards

Hello,

If I run the same scripts in a virtual machine with tensorflow 2.12.0 installed on it then the error doesn’t appear.

Hi,
If I install Tensorflow 2.13.1 the error disappears also.

As summary, if I install
sudo pip3 install --extra-index-url Index of /compute/redist/jp/v512 tensorflow==2.13.1

Then there is no error when executing the scripts.

However if I install
sudo pip3 install --extra-index-url Index of /compute/redist/jp/v512 tensorflow==2.12.0+nv23.06

Then errors appear when executing the scripts.

The version 2.12.0+nv23.06 is the last Nvidia version for jetpack 5.1.2. However the version 2.13.1 is not an Nvidia version.
If I dont use the prebuilt image 2.12.0+nv23.06 then the GPU is not detected when I launch “tf.config.list_physical_devices()” command in python console, as explaind in this topic:

Ok, it seems that after installing tensorflow as sudo I have to execute python also as sudo.

Hi,

Based on the below discussion, this issue comes from TensorFlow v2.12 itself:

Unfortunately, we don’t have the v2.13 package now.
Please wait for the next release.

Thanks.

Hi AastalLLL

many thanks
Finally, if I launch python as sudo then the error does not appear.

Hi,

Thanks for the update.
Do you use our prebuilt or the CPU 2.13 version?

Thanks

Hi,
I finally used your prebuilt.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.