code: def _avg_pool_grad_flops(graph, node):
      """Compute flops for AvgPoolGrad operation."""
      _verify_conv_data_format(node)
      # Pooling gradient implementation:
      out_backprop_shape = graph_util.tensor_shape_from_node_def_name(
          graph, node.input[1]
      )
      out_backprop_shape.assert_is_fully_defined()
      kernel_shape = list(node.attr["ksize"].list.i)
      kernel_area = _list_product(kernel_shape)
      # TensorFlow multiply each element of pooling window by coefficient,
      # then sum up all of them, thus we have 2 flops per element:
      # More optimal implementation - if division is done after.
      return ops.OpStats(
          "flops", kernel_area * out_backprop_shape.num_elements() * 2
      )
  
imports: import numpy
  from tensorflow.python.framework import graph_util
  from tensorflow.python.framework import ops
label_desc: Use image node_id 39 for calling a global function with example usage: _avg_pool_grad_flops(graph, node) and returns: ops