class_docstr: Generic vision network.
code: def import_from_h5(self, import_file):
      # Override this to define custom weight loading behavior from h5 files.
      f = h5py.File(import_file)
      layer1 = f["layer1"][DEFAULT_POLICY_ID]["layer1"]
      out = f["out"][DEFAULT_POLICY_ID]["out"]
      value = f["value"][DEFAULT_POLICY_ID]["value"]
  
      try:
          self.layer_1.load_state_dict(
              {
                  "weight": torch.Tensor(
                      np.transpose(layer1["kernel:0"])
                  ),
                  "bias": torch.Tensor(np.transpose(layer1["bias:0"])),
              }
          )
          self.layer_out.load_state_dict(
              {
                  "weight": torch.Tensor(np.transpose(out["kernel:0"])),
                  "bias": torch.Tensor(np.transpose(out["bias:0"])),
              }
          )
          self.value_branch.load_state_dict(
              {
                  "weight": torch.Tensor(
                      np.transpose(value["kernel:0"])
                  ),
                  "bias": torch.Tensor(np.transpose(value["bias:0"])),
              }
          )
      except AttributeError:
          self.layer_1.load_state_dict(
              {
                  "weight": torch.Tensor(
                      np.transpose(layer1["kernel:0"].value)
                  ),
                  "bias": torch.Tensor(
                      np.transpose(layer1["bias:0"].value)
                  ),
              }
          )
          self.layer_out.load_state_dict(
              {
                  "weight": torch.Tensor(
                      np.transpose(out["kernel:0"].value)
                  ),
                  "bias": torch.Tensor(
                      np.transpose(out["bias:0"].value)
                  ),
              }
          )
          self.value_branch.load_state_dict(
              {
                  "weight": torch.Tensor(
                      np.transpose(value["kernel:0"].value)
                  ),
                  "bias": torch.Tensor(
                      np.transpose(value["bias:0"].value)
                  ),
              }
          )
  
imports: import h5py
  import numpy
  from pathlib import Path
  import unittest
  import ray
  from ray.rllib.algorithms.ppo import PPOConfig
  from ray.rllib.models.catalog import ModelCatalog
  from ray.rllib.models.tf.misc import normc_initializer
  from ray.rllib.models.tf.tf_modelv2 import TFModelV2
  from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
  from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.test_utils import check, framework_iterator
label_desc: Use image node_id 4 for calling the MyTorchModel obj's underlying member method code with example usage: obj.import_from_h5(import_file) without return types