code: def test_black_box_keras_loss(art_warning, get_iris_dataset):
      try:
          (x_train, y_train), (_, _) = get_iris_dataset
  
          # This test creates a framework-specific (keras) model because it needs to check both the case of a string-based
          # loss and a class-based loss, and therefore cannot use the generic fixture get_tabular_classifier_list
          model = keras.models.Sequential()
          model.add(
              keras.layers.Dense(8, input_dim=4, activation="relu")
          )
          model.add(keras.layers.Dense(3, activation="softmax"))
          model.compile(
              loss="categorical_crossentropy",
              optimizer="adam",
              metrics=["accuracy"],
          )
          model.fit(x_train, y_train, epochs=150, batch_size=10)
  
          classifier = KerasClassifier(model)
          attack = MembershipInferenceBlackBox(
              classifier, input_type="loss"
          )
          backend_check_membership_accuracy(
              attack, get_iris_dataset, attack_train_ratio, 0.25
          )
  
          model2 = keras.models.Sequential()
          model2.add(
              keras.layers.Dense(12, input_dim=4, activation="relu")
          )
          model2.add(keras.layers.Dense(3, activation="softmax"))
          model2.compile(
              loss=keras.losses.CategoricalCrossentropy(),
              optimizer="adam",
              metrics=["accuracy"],
          )
          model2.fit(x_train, y_train, epochs=150, batch_size=10)
  
          classifier = KerasClassifier(model2)
          attack = MembershipInferenceBlackBox(
              classifier, input_type="loss"
          )
          backend_check_membership_accuracy(
              attack, get_iris_dataset, attack_train_ratio, 0.25
          )
      except ARTTestException as e:
          art_warning(e)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import pytest
  import numpy
  import keras
  from art.attacks.inference.membership_inference.black_box import MembershipInferenceBlackBox
  from art.estimators.classification.keras import KerasClassifier
  from art.estimators.estimator import BaseEstimator
  from art.estimators.classification.classifier import ClassifierMixin
  from art.estimators.regression import ScikitlearnRegressor, RegressorMixin
  from tests.attacks.utils import backend_test_classifier_type_check_fail
  from tests.utils import ARTTestException
label_desc: Use image node_id 9 for calling a global function with example usage: test_black_box_keras_loss(art_warning, get_iris_dataset) without return types