code: def convert_network(network, dtype):
      """
      Converts a network's parameters and buffers to dtype.
      """
      for module in network.modules():
          if (
              isinstance(module, torch.nn.modules.batchnorm._BatchNorm)
              and module.affine is True
          ):
              continue
          convert_module(module, dtype)
          if isinstance(module, torch.nn.RNNBase) or isinstance(
              module, torch.nn.modules.rnn.RNNBase
          ):
              module.flatten_parameters()
      return network
  
imports: import torch
  import torch.nn
  from torch.autograd import Variable
  from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
label_desc: Use image node_id 4 for calling a global function with example usage: convert_network(network, dtype) and returns: network