class_docstr: Serialize torch.Tensor to a buffer by converting tensor to numpy and call NumpySerializer.
  
  Args:
      data (object): Data to be serialized. The data must be of torch.Tensor type.
  Returns:
      raw-bytes: The data serialized as raw-bytes from the input.
docstr: Serialize torch.Tensor to a buffer.
  
  Args:
      data (object): Data to be serialized. The data must be of torch.Tensor type.
  
  Returns:
      raw-bytes: The data serialized as raw-bytes from the input.
docstr_tok: ["Serialize","torch.Tensor","to","a","buffer",".","Args",":","data","(","object",")",":","Data","to","be","serialized",".","The","data","must","be","of","torch.Tensor","type",".","Returns",":","raw-bytes",":","The","data","serialized","as","raw-bytes","from","the","input","."]
code: def serialize(self, data):
      """Serialize torch.Tensor to a buffer.
  
      Args:
          data (object): Data to be serialized. The data must be of torch.Tensor type.
  
      Returns:
          raw-bytes: The data serialized as raw-bytes from the input.
      """
      if isinstance(data, self.torch_tensor):
          try:
              return self.numpy_serializer.serialize(
                  data.detach().numpy()
              )
          except Exception as e:
              raise ValueError(
                  "Unable to serialize your data because: %s.\
                          Please provide custom serialization in InferenceSpec. "
                  % e
              )
  
      raise ValueError(
          "Object of type %s is not a torch.Tensor" % type(data)
      )
  
imports: from __future__ import absolute_import
  import abc
  from collections.abc import Iterable
  import csv
  import io
  import json
  import numpy
  from pandas import DataFrame
  from six import with_metaclass
  from sagemaker.utils import DeferredError
label_desc: Use image node_id 2 for calling the TorchTensorSerializer obj's underlying member method code with example usage: obj.serialize(data) and returns: self