class_docstr: Abstract class for different global pooling 2D layers.
class_docstr_tok: ["Abstract","class","for","different","global","pooling","2D","layers","."]
code: def compute_output_shape(self, input_shape):
      if self.data_format == "channels_last":
          if self.keepdims:
              output_shape = [input_shape[0], 1, 1, input_shape[3]]
          else:
              output_shape = [input_shape[0], input_shape[3]]
      else:
          if self.keepdims:
              output_shape = [input_shape[0], input_shape[1], 1, 1]
          else:
              output_shape = [input_shape[0], input_shape[1]]
  
      return output_shape
  
imports: import math
  from abc import abstractmethod
  from tensorflow.python.keras.utils import conv_utils
  import tf_encrypted
  from tf_encrypted.keras.engine import Layer
label_desc: Use image node_id 2 for calling the GlobalPooling2D obj's underlying member method code with example usage: obj.compute_output_shape(input_shape) and returns: output_shape