tf.numpy_function | TensorFlow Core v2.7.0
www.tensorflow.org › api_docs › pythonIf you are using distributed TensorFlow, you must run a tf.distribute.Server in the same process as the program that calls tf.numpy_function you must pin the created operation to a device in that server (e.g. using with tf.device (): ). Since the function takes numpy arrays, you cannot take gradients through a numpy_function.