Category : gradient

I’m trying to remove a dependency of autograd and trying to calculate the gradients instead by np.gradient. In the process, I’m running into some trouble, 1) because numpy.gradient is not callable, and if I workaround that, I encounter 2) invalid number of arguments. Here is the class I’m trying to implement (see function grad_log): class ..

Read more

I am using Faster RCNN and want to compute this gradient img_input = graph.get_tensor_by_name(‘image_tensor:0’) detection_scores = graph.get_tensor_by_name(‘detection_scores:0’) grads = tf.gradients(detection_scores,img_input) and I get this error Screenshot Anyone with suggestions is encouraged Source: Python..

Read more

I’ve got a code with multiple usage of tf.GradientTape() in it like this : with tf.GradientTape() as tape: actions = actor_model(state_batch, training=True) critic_value = critic_model([state_batch, actions], training=True) actor_loss = -tf.math.reduce_mean(critic_value) actor_grad = tape.gradient(actor_loss, actor_model.trainable_variables) actor_optimizer.apply_gradients( zip(actor_grad, actor_model.trainable_variables) ) I have tried to run this functions with or without @tf.function but in either way speed of ..

Read more