def METHOD_NAME(self):
    ragged_data = tf.ragged.constant(
        [[[1.0, 1.0], [2.0, 2.0], [3.0, 3.0]], [[1.0, 1.0], [2.0, 2.0]]],
        ragged_rank=1,
    )
    dense_data = ragged_data.to_tensor()
    inputs = keras.Input(shape=(None, 2), dtype="float32", ragged=True)
    out = keras.layers.GlobalAveragePooling1D()(inputs)
    model = keras.models.Model(inputs=inputs, outputs=out)
    output_ragged = model.predict(ragged_data, steps=1)
    inputs = keras.Input(shape=(None, 2), dtype="float32")
    masking = keras.layers.Masking(mask_value=0.0, input_shape=(3, 2))(
        inputs
    )
    out = keras.layers.GlobalAveragePooling1D()(masking)
    model = keras.models.Model(inputs=inputs, outputs=out)
    output_dense = model.predict(dense_data, steps=1)
    self.assertAllEqual(output_ragged, output_dense)