class_docstr: Unit test class for testing scikit-learn converter.
class_docstr_tok: ["Unit","test","class","for","testing","scikit-learn","converter","."]
docstr: Test to ensure that respect_trainable is honored during convert of a
  model with mean squared error loss and the Adam optimizer.
docstr_tok: ["Test","to","ensure","that","respect_trainable","is","honored","during","convert","of","a","model","with","mean","squared","error","loss","and","the","Adam","optimizer","."]
code: def test_updatable_model_flag_mse_adam(self):
      """
      Test to ensure that respect_trainable is honored during convert of a
      model with mean squared error loss and the Adam optimizer.
      """
      import coremltools
      from keras.layers import Dense
      from keras.losses import mean_squared_error
      from keras.optimizers import Adam
  
      input = ["data"]
      output = ["output"]
  
      # Again, this should give an updatable model.
      updatable = Sequential()
      updatable.add(Dense(128, input_shape=(16,)))
      updatable.add(
          Dense(10, name="foo", activation="softmax", trainable=True)
      )
      updatable.compile(
          loss=mean_squared_error,
          optimizer=Adam(lr=1.0, beta_1=0.5, beta_2=0.75, epsilon=0.25),
          metrics=["accuracy"],
      )
      cml = coremltools.converters.keras.convert(
          updatable, input, output, respect_trainable=True
      )
      spec = cml.get_spec()
      self.assertTrue(spec.isUpdatable)
      layers = spec.neuralNetwork.layers
      self.assertIsNotNone(layers[1].innerProduct)
      self.assertTrue(layers[1].innerProduct)
      self.assertTrue(layers[1].isUpdatable)
      self.assertEqual(
          len(spec.neuralNetwork.updateParams.lossLayers), 1
      )
      adopt = spec.neuralNetwork.updateParams.optimizer.adamOptimizer
      self.assertEqual(adopt.learningRate.defaultValue, 1.0)
      self.assertEqual(adopt.beta1.defaultValue, 0.5)
      self.assertEqual(adopt.beta2.defaultValue, 0.75)
      self.assertEqual(adopt.eps.defaultValue, 0.25)
  
imports: import unittest
  from coremltools._deps import _HAS_KERAS2_TF
  from coremltools.proto import Model_pb2
  from coremltools.proto import FeatureTypes_pb2
  from coremltools.proto import NeuralNetwork_pb2
  import pytest
label_desc: Use image node_id 33 for calling the KerasSingleLayerTest obj's underlying member method code with example usage: obj.test_updatable_model_flag_mse_adam() without return types