code: def _get_model_device(model):
      r"""
      传入一个nn.Module的模型，获取它所在的device
  
      :param model: nn.Module
      :return: torch.device,None 如果返回值为None，说明这个模型没有任何参数。
      """
      assert isinstance(model, nn.Module)
  
      parameters = list(model.parameters())
      if len(parameters) == 0:
          return None
      else:
          return parameters[0].device
  
file_path: fastNLP/fastNLP/modules/torch/generator/seq2seq_generator.py
imports: import torch
  from torch import nn
  import torch.nn.functional
  from ..decoder.seq2seq_decoder import Seq2SeqDecoder, State
  from functools import partial
label_desc: Use image node_id 1 for calling a global function with example usage: _get_model_device(model) and returns: None, parameters