code: def _convert_type(self, data, dtype="float32"):
      if isinstance(data, t.Tensor):
          if dtype == "float32":
              data = data.float()
          elif dtype == "float64":
              data = data.double()
          else:
              raise ValueError(
                  "Invalid dtype. Choose either 'float32' or 'float64'"
              )
  
          numpy_array = data.detach().cpu().numpy()
  
      elif isinstance(data, np.ndarray):
          if dtype == "float32":
              numpy_array = data.astype(np.float32)
          elif dtype == "float64":
              numpy_array = data.astype(np.float64)
          else:
              raise ValueError(
                  "Invalid dtype. Choose either 'float32' or 'float64'"
              )
      else:
          raise ValueError(
              "Invalid data type. Only numpy ndarray and PyTorch tensor are supported."
          )
  
      return numpy_array
  
imports: import logging
  from typing import Optional
  import numpy
  import torch
  from fate.arch import Context
  from fate.arch.protocol.secure_aggregation._secure_aggregation import SecureAggregatorClient
  from fate.arch.protocol.secure_aggregation._secure_aggregation import SecureAggregatorServer
label_desc: Use image node_id 2 for calling the BaseAggregatorClient obj's underlying member method code with example usage: obj._convert_type(data, dtype) and returns: numpy_array