class_docstr: Negative sampling based skip-gram
class_docstr_tok: ["Negative","sampling","based","skip-gram"]
docstr: set gpu device
docstr_tok: ["set","gpu","device"]
code: def set_device(self, gpu_id):
      """set gpu device"""
      self.device = torch.device("cuda:%d" % gpu_id)
      print("The device is", self.device)
      self.lookup_table = self.lookup_table.to(self.device)
      if self.record_loss:
          self.logsigmoid_table = self.logsigmoid_table.to(self.device)
      self.index_emb_posu = self.index_emb_posu.to(self.device)
      self.index_emb_posv = self.index_emb_posv.to(self.device)
      self.index_emb_negu = self.index_emb_negu.to(self.device)
      self.index_emb_negv = self.index_emb_negv.to(self.device)
      self.grad_u = self.grad_u.to(self.device)
      self.grad_v = self.grad_v.to(self.device)
      if self.use_context_weight:
          self.context_weight = self.context_weight.to(self.device)
  
imports: import random
  import numpy
  import torch
  import torch.multiprocessing
  import torch.nn
  import torch.nn.functional
  from torch.multiprocessing import Queue
  from torch.nn import init
label_desc: Use image node_id 5 for calling the SkipGramModel obj's underlying member method code with example usage: obj.set_device(gpu_id) without return types