parameters: (self, device, dtype=None, keep_alignment=True)
docstring: Move the underlying buffer
docstring_summary: Move the underlying buffer
docstring_tokens: Move the underlying buffer
function: def to(self, device, dtype=None, keep_alignment=True):
          """
          Move the underlying buffer
          """
          assert self.buffer is not None, "Cannot move a collapsed bucket, please rebuild it"
          assert (dtype == Type.fp32.value or
                  Type.fp16.value), "Conversion type is not supported now"
  
          dev_id = 0 if paddle.get_device() == "cpu" else int(paddle.get_device()
                                                              .split(":")[1])
  
          if self._device != device:
              tmp_buffer = self.buffer.cuda(
                  dev_id) if device == "gpu" else self.buffer.cpu()
              for param in self._params:
                  param.clear_gradient(False)
                  param._gradient_set_empty(False)
              self.buffer.value().get_tensor()._clear()
              self.buffer = tmp_buffer
              self._device = device
  
          if dtype is not None:
              self.buffer = self.buffer.cast(dtype=dtype)
              self._dtype = dtype
function_tokens: def to ( self , device , dtype = None , keep_alignment = True ) : assert self . buffer is not None , "Cannot move a collapsed bucket, please rebuild it" assert ( dtype == Type . fp32 . value or Type . fp16 . value ) , "Conversion type is not supported now" dev_id = 0 if paddle . get_device ( ) == "cpu" else int ( paddle . get_device ( ) . split ( ":" ) [ 1 ] ) if self . _device != device : tmp_buffer = self . buffer . cuda ( dev_id ) if device == "gpu" else self . buffer . cpu ( ) for param in self . _params : param . clear_gradient ( False ) param . _gradient_set_empty ( False ) self . buffer . value ( ) . get_tensor ( ) . _clear ( ) self . buffer = tmp_buffer self . _device = device if dtype is not None : self . buffer = self . buffer . cast ( dtype = dtype ) self . _dtype = dtype