def METHOD_NAME():
    x_masked = x
    spatial_len = spatial_dim.get_dim_value_tensor()
    # time mask
    x_masked = random_mask(
        x_masked,
        mask_axis=spatial_dim,
        broadcast_axis=feature_dim,
        min_num=rf.minimum(step1 + step2, spatial_len),
        max_num=rf.minimum(
            rf.maximum(spatial_len // num_spatial_mask_factor, 2) * (1 + step1 + step2 * 2), spatial_len
        ),
        max_dims=max_consecutive_spatial_dims,
    )
    # feature mask
    x_masked = random_mask(
        x_masked,
        mask_axis=feature_dim,
        broadcast_axis=spatial_dim,
        min_num=step1 + step2,
        max_num=2 + step1 + step2 * 2,
        max_dims=max_consecutive_feature_dims,
    )
    return x_masked