pyjuice.nodes.ProdNodes

class pyjuice.nodes.ProdNodes(num_node_blocks: int, chs: Sequence[CircuitNodes], edge_ids: ndarray | Tensor | None = None, block_size: int = 0, **kwargs)

A class representing vectors of product nodes. It is created by pyjuice.multiply.

Parameters:
  • num_node_blocks (int) – number of node blocks

  • chs (Sequence[CircuitNodes]) – sequence of child nodes

  • edge_ids (Optional[Tensor]) – a matrix of size [# product node blocks, # children] - the ith product node block is connected to the `edge_ids[i,j]`th node block in the jth child

  • block_size (int) – block size

__init__(num_node_blocks: int, chs: Sequence[CircuitNodes], edge_ids: ndarray | Tensor | None = None, block_size: int = 0, **kwargs) None

Methods

duplicate(*args[, tie_params, ...])

Create a duplication of the current node with the same specification (i.e., number of nodes, block size).

init_parameters([perturbation, recursive, ...])

Randomly initialize node parameters.

is_block_sparse()

Whether the edge type is BLOCK_SPARSE.

is_sparse()

Whether the edge type is SPARSE.

num_parameters([count_input_params, recursive])