docstr: Test computed shape is equal to the layer output's shape.
docstr_tok: ["Test","computed","shape","is","equal","to","the","layer","output","'s","shape","."]
code: def test_compute_output_shape(
      self, query_dims, value_dims, key_dims, output_shape
  ):
      """Test computed shape is equal to the layer output's shape."""
      layer = layers.MultiHeadAttention(
          num_heads=2,
          key_dim=2,
          value_dim=2,
          output_shape=output_shape,
      )
      batch_size = 7
      query_shape = (batch_size,) + query_dims
      value_shape = (batch_size,) + value_dims
      key_shape = (batch_size,) + key_dims if key_dims else None
  
      query = np.ones(query_shape)
      value = np.ones(value_shape)
      key = np.ones(key_shape) if key_shape else None
      output = layer(query=query, value=value, key=key)
      comp_output_shape = layer.compute_output_shape(
          query_shape, value_shape, key_shape
      )
      self.assertEqual(output.shape, comp_output_shape)
  
imports: import os
  import numpy
  import pytest
  from absl.testing import parameterized
  from keras import backend
  from keras import constraints
  from keras import initializers
  from keras import layers
  from keras import models
  from keras import saving
  from keras import testing
label_desc: Use image node_id 3 for calling the MultiHeadAttentionTest obj's underlying member method code with example usage: obj.test_compute_output_shape(query_dims, value_dims, key_dims, output_shape) without return types