class_docstr: A base class that applies compression algorithm to a pytorch tensor
class_docstr_tok: ["A","base","class","that","applies","compression","algorithm","to","a","pytorch","tensor"]
docstr: Applies compression algorithm to a tensor based on their meta-parameters
  
  :param tensor: a pytorch tensor to compress; depending on the application, it is a full tensor or a part
  :param info: meta-information about the tensor; if partitioning is used, this still describes the full tensor
  :param allow_inplace: if True, compression can (but doesn't have to) to modify tensor in-place for efficiency
  :returns: a protobuf message that encodes the tensor
docstr_tok: ["Applies","compression","algorithm","to","a","tensor","based","on","their","meta-parameters",":","param","tensor",":","a","pytorch","tensor","to","compress",";","depending","on","the","application",",","it","is","a","full","tensor","or","a","part",":","param","info",":","meta-information","about","the","tensor",";","if","partitioning","is","used",",","this","still","describes","the","full","tensor",":","param","allow_inplace",":","if","True",",","compression","can","(","but","does","n't","have","to",")","to","modify","tensor","in-place","for","efficiency",":","returns",":","a","protobuf","message","that","encodes","the","tensor"]
code: def compress(
      self,
      tensor: torch.Tensor,
      info: CompressionInfo,
      allow_inplace: bool = False,
  ) -> runtime_pb2.Tensor:
      """
      Applies compression algorithm to a tensor based on their meta-parameters
  
      :param tensor: a pytorch tensor to compress; depending on the application, it is a full tensor or a part
      :param info: meta-information about the tensor; if partitioning is used, this still describes the full tensor
      :param allow_inplace: if True, compression can (but doesn't have to) to modify tensor in-place for efficiency
      :returns: a protobuf message that encodes the tensor
      """
      ...
  
imports: import dataclasses
  import os
  import warnings
  from abc import ABC, abstractmethod
  from enum import Enum, auto
  from typing import Any, Optional
  import numpy
  import torch
  from hivemind.proto import runtime_pb2
  from hivemind.utils.tensor_descr import TensorDescriptor
label_desc: Use image node_id 1 for calling the CompressionBase obj's underlying member method code with example usage: obj.compress(tensor, info, allow_inplace) without return types