code: def __init__(
      self,
      net_params,
      batch_size,
      num_features,
      num_classes,
      prediction_window,
      seq_len,
      seed,
  ):
      _utils.suppress_tensorflow_warnings()
  
      self.num_classes = num_classes
      self.batch_size = batch_size
  
      tf = _lazy_import_tensorflow()
      keras = tf.keras
  
      #############################################
      # Define the Neural Network
      #############################################
      inputs = keras.Input(
          shape=(prediction_window * seq_len, num_features)
      )
  
      # First dense layer
      dense = keras.layers.Conv1D(
          filters=CONV_H,
          kernel_size=(prediction_window),
          padding="same",
          strides=prediction_window,
          use_bias=True,
          activation="relu",
      )
      cur_outputs = dense(inputs)
  
      # First dropout layer
      dropout = keras.layers.Dropout(
          rate=0.2,
          seed=seed,
      )
      cur_outputs = dropout(cur_outputs)
  
      # LSTM layer
      lstm = keras.layers.LSTM(
          units=LSTM_H,
          return_sequences=True,
          use_bias=True,
      )
      cur_outputs = lstm(cur_outputs)
  
      # Second dense layer
      dense2 = keras.layers.Dense(DENSE_H)
      cur_outputs = dense2(cur_outputs)
  
      # Batch norm layer
      batch_norm = keras.layers.BatchNormalization()
      cur_outputs = batch_norm(cur_outputs)
  
      # ReLU layer
      relu = keras.layers.ReLU()
      cur_outputs = relu(cur_outputs)
  
      # Final dropout layer
      dropout = keras.layers.Dropout(rate=0.5, seed=seed)
      cur_outputs = dropout(cur_outputs)
  
      # Final dense layer
      dense3 = keras.layers.Dense(num_classes, use_bias=False)
      cur_outputs = dense3(cur_outputs)
  
      # Softmax layer
      softmax = keras.layers.Softmax()
      cur_outputs = softmax(cur_outputs)
  
      self.model = keras.Model(inputs=inputs, outputs=cur_outputs)
      self.model.compile(
          loss=tf.losses.categorical_crossentropy,
          optimizer=keras.optimizers.Adam(learning_rate=1e-3),
          sample_weight_mode="temporal",
      )
  
      #############################################
      # Load the Weights of the Neural Network
      #############################################
      for key in net_params.keys():
          net_params[key] = _utils.convert_shared_float_array_to_numpy(
              net_params[key]
          )
  
      # Set weight for first dense layer
      l = self.model.layers[1]
      l.set_weights(
          (
              _utils.convert_conv1d_coreml_to_tf(
                  net_params["conv_weight"]
              ),
              net_params["conv_bias"],
          )
      )
  
      # Set LSTM weights
      i2h, h2h, bias = [], [], []
      for i in ("i", "f", "c", "o"):
          i2h.append(eval('net_params["lstm_i2h_%s_weight"]' % i))
          h2h.append(eval('net_params["lstm_h2h_%s_weight"]' % i))
          bias.append(eval('net_params["lstm_h2h_%s_bias"]' % i))
      i2h = _np.concatenate(i2h, axis=0)
      h2h = _np.concatenate(h2h, axis=0)
      bias = _np.concatenate(bias, axis=0)
      i2h = _np.swapaxes(i2h, 1, 0)
      h2h = _np.swapaxes(h2h, 1, 0)
      l = self.model.layers[3]
      l.set_weights((i2h, h2h, bias))
  
      # Set weight for second dense layer
      l = self.model.layers[4]
      l.set_weights(
          (
              net_params["dense0_weight"]
              .reshape(DENSE_H, LSTM_H)
              .swapaxes(0, 1),
              net_params["dense0_bias"],
          )
      )
  
      # Set batch Norm weights
      l = self.model.layers[5]
      l.set_weights(
          (
              net_params["bn_gamma"],
              net_params["bn_beta"],
              net_params["bn_running_mean"],
              net_params["bn_running_var"],
          )
      )
  
      # Set weights for last dense layer
      l = self.model.layers[8]
      l.set_weights(
          (
              net_params["dense1_weight"]
              .reshape((self.num_classes, DENSE_H))
              .swapaxes(0, 1),
          )
      )
  
file_path: turicreate/src/python/turicreate/toolkits/activity_classifier/_tf_model_architecture.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import turicreate.toolkits._tf_utils
  from .._tf_model import TensorFlowModel
  import numpy
  from turicreate._deps.minimal_package import _minimal_package_import_check
label_desc: Use image node_id 1 to create a new ActivityTensorFlowModel object from inherited base classes: TensorFlowModel with example: obj = ActivityTensorFlowModel(net_params, batch_size, num_features, num_classes, prediction_window, seq_len, seed)