class_docstr: Record of spaces (i.e., raw action, observation, and associated data) from a single sub-step.
class_docstr_tok: ["Record","of","spaces","(","i.e.",",","raw","action",",","observation",",","and","associated","data",")","from","a","single","sub-step","."]
docstr: Convert the record to Torch.
  
  :param device: Device to move the tensors to.
docstr_tok: ["Convert","the","record","to","Torch",".",":","param","device",":","Device","to","move","the","tensors","to","."]
code: def to_torch(self, device: str) -> "SpacesRecord":
      """Convert the record to Torch.
  
      :param device: Device to move the tensors to.
      """
      self.observation = convert_to_torch(
          self.observation, device=device, cast=None, in_place=True
      )
      self.action = convert_to_torch(
          self.action, device=device, cast=None, in_place=True
      )
      self.reward = torch.from_numpy(np.asarray(self.reward)).to(device)
      self.done = torch.from_numpy(np.asarray(self.done)).to(device)
  
      if self.next_observation is not None:
          self.next_observation = convert_to_torch(
              self.next_observation,
              device=device,
              cast=None,
              in_place=True,
          )
  
      if self.logits is not None:
          self.logits = convert_to_torch(
              self.logits, device=device, cast=None, in_place=True
          )
  
      return self
  
file_path: maze/maze/core/trajectory_recording/records/spaces_record.py
imports: from dataclasses import dataclass
  from typing import Dict, Union, Optional, List, Any
  import numpy
  import torch
  from maze.core.env.structured_env import ActorID
  from maze.perception.perception_utils import convert_to_numpy, convert_to_torch
  from maze.train.utils.train_utils import stack_numpy_dict_list, stack_torch_dict_list
label_desc: Use image node_id 5 for calling the SpacesRecord obj's underlying member method code with example usage: obj.to_torch(device) and returns: self