docstr: Obtain the predictions of the NN implemented in the FPGA.
  
  Args:
      X (ndarray): The input tensor.
      y_shape (list): The shape of the output tensor, needed by the accelerator to set the TLAST bit properly.
      dtype (dtype, optional): The data type of the elements of the input/output tensors. Must be an instance of
          numpy dtype. Defaults to np.float32.
      debug (bool, optional): If set, the function will print information about the data transfers status.
          Defaults to False.
      profile (bool, optional): If set, the function will print the performance of the algorithm in terms of
          inference/s. Defaults to False.
      encode (Callable, optional): Function to transform the input tensor. Defaults to None.
      decode (Callable, optional): Function to transform the output tensor. Defaults to None.
  
  Returns:
      _type_: A ``np.ndarray`` with a shape equal of ``y_shape`` and ``dtype`` data type.
docstr_tok: ["Obtain","the","predictions","of","the","NN","implemented","in","the","FPGA",".","Args",":","X","(","ndarray",")",":","The","input","tensor",".","y_shape","(","list",")",":","The","shape","of","the","output","tensor",",","needed","by","the","accelerator","to","set","the","TLAST","bit","properly",".","dtype","(","dtype",",","optional",")",":","The","data","type","of","the","elements","of","the","input\/output","tensors",".","Must","be","an","instance","of","numpy","dtype",".","Defaults","to","np.float32",".","debug","(","bool",",","optional",")",":","If","set",",","the","function","will","print","information","about","the","data","transfers","status",".","Defaults","to","False",".","profile","(","bool",",","optional",")",":","If","set",",","the","function","will","print","the","performance","of","the","algorithm","in","terms","of","inference\/s",".","Defaults","to","False",".","encode","(","Callable",",","optional",")",":","Function","to","transform","the","input","tensor",".","Defaults","to","None",".","decode","(","Callable",",","optional",")",":","Function","to","transform","the","output","tensor",".","Defaults","to","None",".","Returns",":","_type_",":","A","``","np.ndarray","``","with","a","shape","equal","of","``","y_shape","``","and","``","dtype","``","data","type","."]
code: def predict(
      self,
      X,
      y_shape,
      dtype=np.float32,
      debug=False,
      profile=False,
      encode=None,
      decode=None,
  ):
      """Obtain the predictions of the NN implemented in the FPGA.
  
      Args:
          X (ndarray): The input tensor.
          y_shape (list): The shape of the output tensor, needed by the accelerator to set the TLAST bit properly.
          dtype (dtype, optional): The data type of the elements of the input/output tensors. Must be an instance of
              numpy dtype. Defaults to np.float32.
          debug (bool, optional): If set, the function will print information about the data transfers status.
              Defaults to False.
          profile (bool, optional): If set, the function will print the performance of the algorithm in terms of
              inference/s. Defaults to False.
          encode (Callable, optional): Function to transform the input tensor. Defaults to None.
          decode (Callable, optional): Function to transform the output tensor. Defaults to None.
  
      Returns:
          _type_: A ``np.ndarray`` with a shape equal of ``y_shape`` and ``dtype`` data type.
      """
      self.allocate_mem(X_shape=X.shape, y_shape=y_shape, dtype=dtype)
      if profile:
          timea = datetime.now()
      if encode is not None:
          X = encode(X)
      in_size = np.prod(X.shape)
      out_size = np.prod(y_shape)
      self.input_buffer[:] = X
      self.input_buffer.sync_to_device()
      if debug:
          print("Send OK")
      self.krnl_rtl_1.call(
          self.input_buffer, self.output_buffer, in_size, out_size
      )
      if debug:
          print("Kernel call OK")
      self.output_buffer.sync_from_device()
      if debug:
          print("Recieve OK")
      result = self.output_buffer.copy()
      if profile:
          timeb = datetime.now()
          dts, rate = self._print_dt(timea, timeb, len(X))
          self.input_buffer.flush()
          self.output_buffer.flush()
          self.free()
          return result, dts, rate
      self.input_buffer.flush()
      self.output_buffer.flush()
      return result
  
file_path: hls4ml/hls4ml/templates/vivado_accelerator/alveo/python_drivers/axi_stream_driver.py
imports: from datetime import datetime
  import numpy
  from pynq import Overlay, allocate
label_desc: Use image node_id 3 for calling the NeuralNetworkOverlay obj's underlying member method code with example usage: obj.predict(X, y_shape, dtype, debug, profile, encode, decode) and returns: result, result,  dts,  rate