code: def _B2A(binary_tensor, precision=None, bits=None):
      if bits is None:
          bits = torch.iinfo(torch.long).bits
  
      if bits == 1:
          binary_bit = binary_tensor & 1
          arithmetic_tensor = beaver.B2A_single_bit(binary_bit)
      else:
          binary_bits = BinarySharedTensor.stack(
              [binary_tensor >> i for i in range(bits)]
          )
          binary_bits = binary_bits & 1
          arithmetic_bits = beaver.B2A_single_bit(binary_bits)
  
          multiplier = torch.cat(
              [
                  torch.tensor(
                      [1], dtype=torch.long, device=binary_tensor.device
                  )
                  << i
                  for i in range(bits)
              ]
          )
          while multiplier.dim() < arithmetic_bits.dim():
              multiplier = multiplier.unsqueeze(1)
  
          arithmetic_tensor = arithmetic_bits.mul_(multiplier).sum(0)
  
      arithmetic_tensor.encoder = FixedPointEncoder(
          precision_bits=precision
      )
      scale = (
          arithmetic_tensor.encoder._scale
          // binary_tensor.encoder._scale
      )
      arithmetic_tensor *= scale
      return arithmetic_tensor
  
file_path: FATE/python/fate/arch/protocol/mpc/primitives/converters.py
imports: import torch
  from fate.arch.protocol.mpc.encoder import FixedPointEncoder
  from .None import beaver
  from .arithmetic import ArithmeticSharedTensor
  from .binary import BinarySharedTensor
  from ..None import communicator
  from ..ptype import ptype
label_desc: Use image node_id 2 for calling a global function with example usage: _B2A(binary_tensor, precision, bits) and returns: arithmetic_tensor