code: def get_gradients_of_trainable_weights(model, x, y):
      """
      Get the gradients of trainable_weights for the kernel and the bias nodes for all filters in each layer.
      Trainable_weights gradients are averaged over the minibatch.
      :param model: keras compiled model or one of ['vgg16', 'vgg19', 'inception_v3', 'inception_resnet_v2',
      'mobilenet_v2', 'mobilenetv2']
      :param x: inputs for which gradients are sought (averaged over all inputs if batch_size > 1)
      :param y: outputs for which gradients are sought
      :return: dict mapping layers to corresponding gradients (filter_h, filter_w, in_channels, out_channels)
      """
      nodes = OrderedDict(
          [(n.name, n) for n in model.trainable_weights]
      )
      return _get_gradients(model, x, y, nodes)
  
imports: import json
  import os
  from collections import OrderedDict
  import numpy
  import tensorflow
  import tensorflow.keras.backend
  from tensorflow.keras import Sequential
  from tensorflow.keras.models import Model
label_desc: Use image node_id 5 for calling a global function with example usage: get_gradients_of_trainable_weights(model, x, y) and returns: _get_gradients