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 when respect_trainable is off, then we will ignore
  any 'trainable' layers of the original network.
docstr_tok: ["Test","to","ensure","that","when","respect_trainable","is","off",",","then","we","will","ignore","any","'trainable","'","layers","of","the","original","network","."]
code: def test_updatable_model_flag_off(self):
      """
      Test to ensure that when respect_trainable is off, then we will ignore
      any 'trainable' layers of the original network.
      """
      import coremltools
      from keras.layers import Dense
      from keras.losses import categorical_crossentropy
      from keras.optimizers import SGD
  
      input = ["data"]
      output = ["output"]
      # First, set respect_trainable to False and then check to make sure the
      # converted model is NOT updatable.
      not_updatable = Sequential()
      not_updatable.add(Dense(128, input_shape=(16,)))
      # layer is updatable, but the flag during convert is false, so that bit
      # must get dropped on the floor.
      not_updatable.add(
          Dense(10, name="foo", activation="softmax", trainable=True)
      )
      not_updatable.compile(
          loss=categorical_crossentropy,
          optimizer=SGD(lr=0.01),
          metrics=["accuracy"],
      )
      cml = coremltools.converters.keras.convert(
          not_updatable, input, output, respect_trainable=False
      )
      spec = cml.get_spec()
      self.assertFalse(spec.isUpdatable)
      layers = spec.neuralNetwork.layers
      self.assertIsNotNone(layers[1].innerProduct)
      self.assertTrue(layers[1].innerProduct)
      self.assertFalse(layers[1].isUpdatable)
  
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 30 for calling the KerasSingleLayerTest obj's underlying member method code with example usage: obj.test_updatable_model_flag_off() without return types