class_docstr: torch.Tensor with a variable 0-th dimension, used to describe batched data
class_docstr_tok: ["torch.Tensor","with","a","variable","0-th","dimension",",","used","to","describe","batched","data"]
code: def from_tensor(
      cls, tensor: torch.Tensor, compression=CompressionType.NONE
  ) -> BatchTensorDescriptor:
      return cls(
          *tensor.shape[1:],
          dtype=tensor.dtype,
          layout=tensor.layout,
          device=tensor.device,
          requires_grad=tensor.requires_grad,
          pin_memory=_safe_check_pinned(tensor),
          compression=compression
          if tensor.is_floating_point()
          else CompressionType.NONE,
      )
  
imports: from __future__ import annotations
  import warnings
  from dataclasses import asdict, dataclass
  from typing import Tuple
  import numpy
  import torch
  from hivemind.proto.runtime_pb2 import CompressionType
  from hivemind.utils.serializer import MSGPackSerializer
label_desc: Use image node_id 2 for calling the BatchTensorDescriptor obj's underlying member method code with example usage: obj.from_tensor(cls, tensor, compression) and returns: cls