code: def test_val_net():
      """test estimator with different training and validation networks"""
      net = _get_test_network()
      val_net = _get_test_network(params=net.collect_params())
      dataloader, dataiter = _get_test_data()
      num_epochs = 1
      device = mx.cpu()
      loss = gluon.loss.L2Loss()
      val_loss = gluon.loss.L2Loss()
      acc = mx.gluon.metric.Accuracy()
      net.initialize(device=device)
      trainer = gluon.Trainer(
          net.collect_params(), "sgd", {"learning_rate": 0.001}
      )
      est = Estimator(
          net=net,
          loss=loss,
          train_metrics=acc,
          trainer=trainer,
          device=device,
          val_loss=val_loss,
          val_net=val_net,
      )
  
      est.fit(
          train_data=dataloader, val_data=dataloader, epochs=num_epochs
      )
  
      """ test partial weight sharing of two resnets """
      net = gluon.model_zoo.vision.resnet18_v1(
          pretrained=False, device=device
      )
      net.output = gluon.nn.Dense(10)
      val_net = gluon.model_zoo.vision.resnet18_v1(
          pretrained=False, device=device
      )
      val_net.output = net.output
      dataset = gluon.data.ArrayDataset(
          mx.np.zeros((10, 3, 224, 224)), mx.np.zeros((10, 10))
      )
      dataloader = gluon.data.DataLoader(dataset=dataset, batch_size=5)
      net.initialize(device=device)
      val_net.initialize(device=device)
      trainer = gluon.Trainer(
          net.collect_params(), "sgd", {"learning_rate": 0.001}
      )
      est = Estimator(
          net=net,
          loss=loss,
          train_metrics=acc,
          trainer=trainer,
          device=device,
          val_loss=val_loss,
          val_net=val_net,
      )
  
      est.fit(
          train_data=dataloader, val_data=dataloader, epochs=num_epochs
      )
  
imports: import sys
  import unittest
  import warnings
  import pytest
  import mxnet
  from mxnet import gluon
  from mxnet.gluon import nn
  from mxnet.gluon.contrib.estimator import *
  from mxnet.gluon.contrib.estimator.event_handler import *
label_desc: Use image node_id 12 for calling a global function with example usage: test_val_net() without return types