Iterate through an iterable, and extract any PennyLane tensors that appear.
x (tensor or Sequence) – an input tensor or sequence
tensor – the next tensor in the sequence. If the input was a single tensor, than the tensor is yielded and the iterator completes.
>>> from pennylane import numpy as np >>> import numpy as onp >>> iterator = np.extract_tensors([0.1, np.array(0.1), "string", onp.array(0.5)]) >>> list(iterator) [tensor(0.1, requires_grad=True)]
- What is PennyLane?
- Quantum circuits
- Gradients and training
- Quantum operators
- Inspecting circuits
- Compiling circuits
- Quantum Chemistry