paddle_quantum.ansatz.container
The source file of the Sequential class.
- class paddle_quantum.ansatz.container.Sequential(*operators)
Bases:
Operator
Sequential container.
- Parameters:
*operators (Operator) – initial operators ready to be a sequential
Note
Sublayers will be added to this container in the order of argument in the constructor. The argument passed to the constructor can be iterable Layers or iterable name Layer pairs.
- property oper_history: List[Dict[str, str | List[int] | Tensor]]
Return the operator history of this Sequential
- append(operator)
append an operator
- Parameters:
operator (Iterable | Operator) – operator with a name or just an operator
- extend(operators)
append a list of operators
- Parameters:
operator – list of operators
- insert(index, operator)
insert an operator at
index
- Parameters:
index (int) – index to be inserted
operator (Operator) – an operator
- pop(index=None, operator=None)
remove the operator at
index
or matched withoperator
- Parameters:
index (int | None) – at which the operator will be popped
operator (Operator | None) – matched with which the operator will be popped
- forward(state)
forward the input
- Parameters:
state (Any) – initial state
- Returns:
output state
- Return type:
Any