tensorcircuit.simplify#
Tensornetwork Simplification
- tensorcircuit.simplify.infer_new_shape(a: tensornetwork.network_components.Node, b: tensornetwork.network_components.Node, include_old: bool = True) Any [源代码]#
Get the new shape of two nodes, also supporting to return original shapes of two nodes.
- Example
>>> a = tn.Node(np.ones([2, 3, 5])) >>> b = tn.Node(np.ones([3, 5, 7])) >>> a[1] ^ b[0] >>> a[2] ^ b[1] >>> tc.simplify.infer_new_shape(a, b) >>> ((2, 7), (2, 3, 5), (3, 5, 7)) >>> # (shape of a, shape of b, new shape)
- 参数
a (tn.Node) -- node one
b (tn.Node) -- node two
include_old (bool) -- Whether to include original shape of two nodes, default is True.
- 返回
The new shape of the two nodes.
- 返回类型
Union[Tuple[int, ...], Tuple[Tuple[int, ...], Tuple[int, ...], Tuple[int, ...]]]
- tensorcircuit.simplify.infer_new_size(a: tensornetwork.network_components.Node, b: tensornetwork.network_components.Node, include_old: bool = True) Any [源代码]#
- tensorcircuit.simplify.pseudo_contract_between(a: tensornetwork.network_components.Node, b: tensornetwork.network_components.Node, **kws: Any) tensornetwork.network_components.Node [源代码]#
Contract between Node
a
andb
, with correct shape only and no calculation- 参数
a (tn.Node) -- [description]
b (tn.Node) -- [description]
- 返回
[description]
- 返回类型
tn.Node