paddle_quantum.base

The basic function of the paddle quantum.

paddle_quantum.base.set_device(device)

Set the device to save the tensor.

Parameters:

device (str) – The name of the device.

paddle_quantum.base.get_device()

Get the current device to save the tensor.

Returns:

The name of the current device.

Return type:

str

paddle_quantum.base.set_backend(backend)

Set the backend implementation of paddle quantum.

Parameters:

backend (str | Backend) – The name of the backend.

paddle_quantum.base.get_backend()

Get the current backend of paddle quantum.

Returns:

The name of currently used backend.

Return type:

Backend

paddle_quantum.base.set_dtype(dtype)

Set the data type .

Parameters:

dtype (str) – The dtype can be complex64 and complex128.

Raises:

ValueError – The dtype should be complex64 or complex128.

paddle_quantum.base.get_dtype()

Return currently used data type.

Returns:

Currently used data type.

Return type:

str

class paddle_quantum.base.Operator(backend=None, dtype=None, name_scope=None)

Bases: Layer

The basic class to implement the operation in Paddle Quantum.

Parameters:
  • backend (Backend | None) – The backend implementation of the operator. Defaults to None, which means to use the default backend implementation.

  • dtype (str | None) – The data type of the operator. Defaults to None, which means to use the default data type.

  • name_scope (str | None) – Prefix name used by the operator to name parameters. Defaults to None.

to(backend=None, device=None, dtype=None, blocking=None)
forward(*inputs, **kwargs)