Help Center/ ModelArts/ Troubleshooting/ Training Jobs/ Service Code Issues/ Distributed TensorFlow Cannot Use tf.variable
Updated on 2025-06-06 GMT+08:00

Distributed TensorFlow Cannot Use tf.variable

Symptom

The following error occurs when tf.variable is used across multiple machines or multiple cards:

WARNING:tensorflow:Gradient is None for variable:v0/tower_0/UNET_v7/sub_pixel/Variable:0.Make sure this variable is used in loss computation.

Possible Causes

Distributed TensorFlow needs to use tf.get_variable instead of tf.variable.

Solution

Replace tf.variable in the boot file with tf.get_variable.