code: def check_structure_test(pretrain_file, args1, args2):
      """
      Test that the "copy" method copies the parameters from one model to another
  
      Also check that the copied models produce the same results
      """
      set_random_seed(1000)
      other = build_model(pretrain_file, *args1)
      other.eval()
  
      set_random_seed(1001)
      model = build_model(pretrain_file, *args2)
      model.eval()
  
      assert not torch.allclose(
          model.delta_embedding.weight, other.delta_embedding.weight
      )
      assert not torch.allclose(
          model.output_layers[0].weight, other.output_layers[0].weight
      )
  
      model.copy_with_new_structure(other)
  
      assert torch.allclose(
          model.delta_embedding.weight, other.delta_embedding.weight
      )
      assert torch.allclose(
          model.output_layers[0].weight, other.output_layers[0].weight
      )
      # the norms will be the same, as the non-zero values are all the same
      assert torch.allclose(
          torch.linalg.norm(model.word_lstm.weight_ih_l0),
          torch.linalg.norm(other.word_lstm.weight_ih_l0),
      )
  
      # now, check that applying one transition to an initial state
      # results in the same values in the output states for both models
      # as the pattn layer inputs are 0, the output values should be equal
      shift = [parse_transitions.Shift()]
      model_states = test_parse_transitions.build_initial_state(
          model, 1
      )
      model_states = parse_transitions.bulk_apply(
          model, model_states, shift
      )
  
      other_states = test_parse_transitions.build_initial_state(
          other, 1
      )
      other_states = parse_transitions.bulk_apply(
          other, other_states, shift
      )
  
      for i, j in zip(
          other_states[0].word_queue, model_states[0].word_queue
      ):
          assert torch.allclose(i.hx, j.hx, atol=1e-07)
      for i, j in zip(
          other_states[0].transitions, model_states[0].transitions
      ):
          assert torch.allclose(i.lstm_hx, j.lstm_hx)
          assert torch.allclose(i.lstm_cx, j.lstm_cx)
      for i, j in zip(
          other_states[0].constituents, model_states[0].constituents
      ):
          assert (i.value is None) == (j.value is None)
          if i.value is not None:
              assert torch.allclose(
                  i.value.tree_hx, j.value.tree_hx, atol=1e-07
              )
          assert torch.allclose(i.lstm_hx, j.lstm_hx)
          assert torch.allclose(i.lstm_cx, j.lstm_cx)
  
imports: import os
  import pytest
  import torch
  from stanza.models.common import pretrain
  from stanza.models.common.utils import set_random_seed
  from stanza.models.constituency import parse_transitions
  from stanza.tests import *
  from stanza.tests.constituency import test_parse_transitions
  from stanza.tests.constituency.test_trainer import build_trainer
label_desc: Use image node_id 38 for calling a global function with example usage: check_structure_test(pretrain_file, args1, args2) without return types