tensornetwork.CopyNode¶
-
class
tensornetwork.
CopyNode
(rank: int, dimension: int, name: Optional[str] = None, axis_names: Optional[List[str]] = None, backend: Optional[str] = None, dtype: Type[numpy.number] = <class 'numpy.float64'>)¶ -
__init__
(rank: int, dimension: int, name: Optional[str] = None, axis_names: Optional[List[str]] = None, backend: Optional[str] = None, dtype: Type[numpy.number] = <class 'numpy.float64'>) → None¶ Initialize a CopyNode:
Parameters: - rank – The rank of the tensor.
- dimension – The dimension of each leg.
- name – A name for the node.
- axis_names – axis_names for the node.
- backend – An optional backend for the node. If
None
, a default backend is used - dtype – The dtype used to initialize a numpy-copy node.
Note that this dtype has to be a numpy dtype, and it has to be
compatible with the dtype of the backend, e.g. for a tensorflow
backend with a tf.Dtype=tf.floa32,
dtype
has to benp.float32
.
Methods
__init__
(rank, dimension, name, axis_names, …)Initialize a CopyNode: add_axis_names
(axis_names)Add axis names to a Node. add_edge
(edge, axis, str], override)Add an edge to the node on the given axis. compute_contracted_tensor
()Compute tensor corresponding to contraction of self with neighbors. copy
(conjugate)disable
()fresh_edges
(axis_names)get_all_dangling
()Return the set of dangling edges connected to this node. get_all_edges
()get_all_nondangling
()Return the set of nondangling edges connected to this node. get_axis_number
(axis, int])Get the axis number for a given axis name or value. get_dimension
(axis, int])Get the dimension of the given axis. get_edge
(axis, str])get_partners
()get_rank
()Return rank of tensor represented by self. get_tensor
()has_dangling_edge
()has_nondangling_edge
()make_copy_tensor
(rank, dimension, dtype)reorder_axes
(perm)Reorder axes of the node’s tensor. reorder_edges
(edge_order)Reorder the edges for this given Node. set_name
(name)set_tensor
(tensor)tensor_from_edge_order
(perm)Attributes
axis_names
dtype
edges
name
shape
sparse_shape
tensor
-
compute_contracted_tensor
() → Any¶ Compute tensor corresponding to contraction of self with neighbors.
-
classmethod
from_serial_dict
(serial_dict) → tensornetwork.network_components.CopyNode¶ Return a node given a serialized dict representing it.
Parameters: serial_dict – A python dict representing a serialized node. Returns: A node.
-
to_serial_dict
() → Dict[KT, VT]¶ Return a serializable dict representing the node.
Returns: A dict object.
-