class_docstr: The serializer that utilizes :func:`torch.save` and :func:`torch.load` to save and load data.
  
  This serializer should work in most scenarios, including cases when strategies have some tensors in their states (e.g., DRL).
  The downside is that it relies on torch to be installed.
  
  Parameters
  ----------
  map_location
      The ``map_location`` argument to be passed to :func:`torch.load`.
class_docstr_tok: ["The","serializer","that","utilizes",":","func",":","`","torch.save","`","and",":","func",":","`","torch.load","`","to","save","and","load","data",".","This","serializer","should","work","in","most","scenarios",",","including","cases","when","strategies","have","some","tensors","in","their","states","(","e.g.",",","DRL",")",".","The","downside","is","that","it","relies","on","torch","to","be","installed",".","Parameters","--","--","--","--","--","map_location","The","``","map_location","``","argument","to","be","passed","to",":","func",":","`","torch.load","`","."]
code: def __init__(self, map_location: Any = None):
      try:
          import torch  # pylint: disable=unused-import
      except ImportError:
          raise RuntimeError(
              "TorchSerializer requires torch to be installed. "
              "Either install torch or set a different serializer. "
              "For example, `nni.nas.serializer.set_default_serializer(nni.nas.serializer.JsonSerializer())`."
          )
  
      self._map_location = map_location
  
file_path: nni/nni/nas/utils/serializer.py
imports: from __future__ import annotations
  import logging
  from pathlib import Path
  from typing import Any, ClassVar, Type, cast
label_desc: Use image node_id 1 to create a new TorchSerializer object from inherited base classes: Serializer with example: obj = TorchSerializer(map_location)