quimb.tensor.interface
¶
Tools for interfacing the tensor and tensor network objects with other libraries.
Module Contents¶
Classes¶
Functions¶
|
Take a tensor or tensor network like object and return a skeleton needed |
|
Take a skeleton of a tensor or tensor network like object and a pytree |
|
|
|
|
|
Attributes¶
- quimb.tensor.interface.pack(obj)[source]¶
Take a tensor or tensor network like object and return a skeleton needed to reconstruct it, and a pytree of raw parameters.
- Parameters:
obj (Tensor, TensorNetwork, or similar) – Something that has
copy
,set_params
, andget_params
methods.- Returns:
params (pytree) – A pytree of raw parameter arrays.
skeleton (Tensor, TensorNetwork, or similar) – A copy of
obj
with all references to the original data removed.
- quimb.tensor.interface.unpack(params, skeleton)[source]¶
Take a skeleton of a tensor or tensor network like object and a pytree of raw parameters and return a new reconstructed object with those parameters inserted.
- Parameters:
params (pytree) – A pytree of raw parameter arrays, with the same structure as the output of
skeleton.get_params()
.skeleton (Tensor, TensorNetwork, or similar) – Something that has
copy
,set_params
, andget_params
methods.
- Returns:
obj – A copy of
skeleton
with parameters inserted.- Return type:
Tensor, TensorNetwork, or similar
- quimb.tensor.interface._JAX_REGISTERED_TN_CLASSES¶