code: def _validate_network_equality(model_1, model_2):
      # Serializable dict eles same
      assert (
          model_1._get_serializable_dict()
          == model_2._get_serializable_dict()
      )
  
      # Check all weights are the same
      for model_layer, model_2_layer in zip(
          model_1.encoder_.layers, model_2.encoder_.layers
      ):
          model_layer_weights = model_layer.get_weights()
          model_2_layer_weights = model_2_layer.get_weights()
          for i in range(len(model_layer_weights)):
              assert np.all(
                  model_layer_weights[i] == model_2_layer_weights[i]
              )
  
      # Check optimizer weights are the same
      for w1, w2 in zip(
          model_1.model_.optimizer.get_weights(),
          model_2.model_.optimizer.get_weights(),
      ):
          assert np.all(w1 == w2)
  
imports: import os
  import tempfile
  import pytest
  import pickle
  import dill
  from functools import partial
  from sklearn import datasets
  import numpy
  import tensorflow
  from ivis import Ivis
label_desc: Use image node_id 2 for calling a global function with example usage: _validate_network_equality(model_1, model_2) without return types