qml.numpy.wrap_arrays¶
- class wrap_arrays(old, new)[source]¶
Bases:
Loop through an object’s symbol table, wrapping each function with
tensor_wrapper()
.This is useful if you would like to wrap every function provided by an imported module.
- Parameters
old (dict) – The symbol table to be wrapped. Note that callable classes are ignored; only functions are wrapped.
new (dict) – The symbol table that contains the wrapped values.
See also
Example
This function is used to wrap the imported
autograd.numpy
module, to enable all functions to supportrequires_grad
arguments, and to outputtensor
objects:>>> from autograd import numpy as _np >>> wrap_arrays(_np.__dict__, globals())
code/api/pennylane.numpy.wrap_arrays
Download Python script
Download Notebook
View on GitHub