class_docstr: Generic merge layer for elementwise merge functions.
  
  Used to implement `Sum`, `Average`, etc.
  
  Args:
      **kwargs: standard layer keyword arguments.
class_docstr_tok: ["Generic","merge","layer","for","elementwise","merge","functions",".","Used","to","implement","`","Sum","`",",","`","Average","`",",","etc",".","Args",":","*","*","kwargs",":","standard","layer","keyword","arguments","."]
code: def build(self, input_shape):
      # Used purely for shape validation.
      if not isinstance(input_shape[0], (tuple, list)):
          raise ValueError(
              "A merge layer should be called on a list of inputs. "
              f"Received: input_shape={input_shape} (not a list of shapes)"
          )
      if len(input_shape) < 1:
          raise ValueError(
              "A merge layer should be called "
              "on a list of at least 1 input. "
              f"Received {len(input_shape)} inputs. "
              f"Full input_shape received: {input_shape}"
          )
  
      batch_sizes = {s[0] for s in input_shape if s} - {None}
      if len(batch_sizes) > 1:
          raise ValueError(
              "Cannot merge tensors with different batch sizes. "
              f"Received tensors with shapes {input_shape}"
          )
  
      if input_shape[0] is None:
          output_shape = None
      else:
          output_shape = input_shape[0][1:]
  
      for i in range(1, len(input_shape)):
          if input_shape[i] is None:
              shape = None
          else:
              shape = input_shape[i][1:]
          output_shape = self._compute_elemwise_op_output_shape(
              output_shape, shape
          )
  
      # If the inputs have different ranks, we have to reshape them
      # to make them broadcastable.
      if (
          None not in input_shape
          and len(set(map(len, input_shape))) == 1
      ):
          self._reshape_required = False
      else:
          self._reshape_required = True
      self.built = True
  
file_path: keras/keras/layers/merging/base_merge.py
imports: from keras import backend
  from keras import ops
  from keras.backend.common.keras_tensor import KerasTensor
  from keras.layers.layer import Layer
label_desc: Use image node_id 4 for calling the Merge obj's underlying member method code with example usage: obj.build(input_shape) without return types