class_docstr: Encrypted tensor object that uses binary sharing to perform computations.
  
  Binary shares are computed by splitting each value of the input tensor
  into n separate random values that xor together to the input tensor value,
  where n is the number of parties present in the protocol (world_size).
docstr: Selects elements from self or y based on condition
  
  Args:
      condition (torch.bool or BinarySharedTensor): when True yield self,
          otherwise yield y. Note condition is not bitwise.
      y (torch.tensor or BinarySharedTensor): selected when condition is
          False.
  
  Returns: BinarySharedTensor or torch.tensor.
docstr_tok: ["Selects","elements","from","self","or","y","based","on","condition","Args",":","condition","(","torch.bool","or","BinarySharedTensor",")",":","when","True","yield","self",",","otherwise","yield","y",".","Note","condition","is","not","bitwise",".","y","(","torch.tensor","or","BinarySharedTensor",")",":","selected","when","condition","is","False",".","Returns",":","BinarySharedTensor","or","torch.tensor","."]
code: def where(self, condition, y):
      """Selects elements from self or y based on condition
  
      Args:
          condition (torch.bool or BinarySharedTensor): when True yield self,
              otherwise yield y. Note condition is not bitwise.
          y (torch.tensor or BinarySharedTensor): selected when condition is
              False.
  
      Returns: BinarySharedTensor or torch.tensor.
      """
      if is_tensor(condition):
          condition = condition.long()
          is_binary = ((condition == 1) | (condition == 0)).all()
          assert is_binary, "condition values must be 0 or 1"
          # -1 mult expands 0 into binary 00...00 and 1 into 11...11
          condition_expanded = -condition
          y_masked = y & (~condition_expanded)
      elif isinstance(condition, BinarySharedTensor):
          condition_expanded = condition.clone()
          # -1 mult expands binary while & 1 isolates first bit
          condition_expanded.share = -(condition_expanded.share & 1)
          # encrypted tensor must be first operand
          y_masked = (~condition_expanded) & y
      else:
          msg = f"condition {condition} must be torch.bool, or BinarySharedTensor"
          raise ValueError(msg)
  
      return (self & condition_expanded) ^ y_masked
  
imports: import torch
  import fate.arch.protocol.mpc.communicator
  from fate.arch.protocol.mpc.common.rng import generate_kbit_random_tensor
  from fate.arch.protocol.mpc.common.tensor_types import is_tensor
  from fate.arch.protocol.mpc.common.util import torch_cat, torch_stack
  from fate.arch.protocol.mpc.cuda import CUDALongTensor
  from fate.arch.protocol.mpc.encoder import FixedPointEncoder
  from fate.arch.protocol.mpc.functions import regular
  from .None import beaver, circuit
label_desc: Use image node_id 46 for calling the BinarySharedTensor obj's underlying member method code with example usage: obj.where(condition, y) and returns: unknown