def test_return_attention_scores_true_tuple_then_unpack(self):
        """Test that outputs can be unpacked correctly."""
        # Generate dummy input data
        query = np.random.random((2, 8, 16)).astype(np.float32)
        value = np.random.random((2, 4, 16)).astype(np.float32)

        # Initialize the Attention layer
        layer = layers.Attention()

        # Call the layer with return_attention_scores=True
        outputs = layer([query, value], return_attention_scores=True)

        # Unpack the outputs
        output, attention_scores = outputs

        # Check the shape of the unpacked outputs
        self.assertEqual(output.shape, (2, 8, 16))  # Output shape
        self.assertEqual(
            attention_scores.shape, (2, 8, 4)
        )  # Attention scores shape
Test that outputs can be unpacked correctly.
keras/src/layers/attention/attention_test.py