class_docstr: Compress a tensor based on its role in training. Any non-specified compressions will use the "default" option
code: def __init__(
      self,
      *,
      activation: CompressionBase = None,
      parameter: CompressionBase = None,
      gradient: CompressionBase = None,
      optimizer: CompressionBase = None,
      default: CompressionBase = NoCompression(),
  ):
      self.role_compressions = {
          TensorRole.ACTIVATION: activation or default,
          TensorRole.PARAMETER: parameter or default,
          TensorRole.GRADIENT: gradient or default,
          TensorRole.OPTIMIZER: optimizer or default,
          TensorRole.UNSPECIFIED: default,
      }
  
imports: from abc import ABC, abstractmethod
  from typing import Mapping, Sequence, Union
  import torch
  from hivemind.compression.base import CompressionBase, CompressionInfo, Key, NoCompression, TensorRole
  from hivemind.compression.serialization import deserialize_torch_tensor
  from hivemind.proto import runtime_pb2
label_desc: Use image node_id 1 to create a new RoleAdaptiveCompression object from inherited base classes: AdaptiveCompressionBase with example: obj = RoleAdaptiveCompression()