docstr: Tests loading pretrained model.
docstr_tok: ["Tests","loading","pretrained","model","."]
code: def test_load_from_pretrained(self):
      """Tests loading pretrained model."""
      source_model = MLP(
          hidden_layer_size=self.hidden_layer_size,
          feature_dim=self.feature_dim,
          batch_size=10,
      )
  
      source_model.fit(
          self.dataset, nb_epoch=1000, checkpoint_interval=0
      )
  
      dest_model = MLP(
          feature_dim=self.feature_dim,
          hidden_layer_size=self.hidden_layer_size,
          n_tasks=10,
      )
  
      assignment_map = dict()
      value_map = dict()
      dest_vars = dest_model.model.trainable_variables[:-2]
  
      for idx, dest_var in enumerate(dest_vars):
          source_var = source_model.model.trainable_variables[idx]
          assignment_map[source_var.experimental_ref()] = dest_var
          value_map[source_var.experimental_ref()] = source_var.numpy()
  
      dest_model.load_from_pretrained(
          source_model=source_model,
          assignment_map=assignment_map,
          value_map=value_map,
      )
  
      for source_var, dest_var in assignment_map.items():
          source_val = source_var.deref().numpy()
          dest_val = dest_var.numpy()
          np.testing.assert_array_almost_equal(source_val, dest_val)
  
file_path: deepchem/deepchem/models/tests/test_pretrained_keras.py
imports: import unittest
  import pytest
  import deepchem
  import numpy
  from deepchem.feat.mol_graphs import ConvMol
label_desc: Use image node_id 2 for calling the TestPretrained obj's underlying member method code with example usage: obj.test_load_from_pretrained() without return types