tf.keras get computed gradient during training
问题 Following what is written here I was trying to get the computed gradient during the training using tf.keras , I've end up with the following callback function which is called during the fitting's phase: The used networks is a very standard one, fully connected and sequential. r = network.fit(x=trn.X,y=trn.Y,verbose=2,batch_size=50,epochs=50,callbacks=[reporter,]) def on_train_begin(self, logs={}): # Functions return weights of each layer self.layerweights = [] for lndx, l in enumerate(self