pyjuice.nodes.SumNodes

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

A class representing vectors of sum nodes. It is created by pyjuice.summate.

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

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

  • edge_ids (Optional[Tensor]) – a matrix of size [2, # edges] - every size-2 column vector [i,j] defines a set of edges that fully connect the ith sum node block and the jth child node block

  • block_size (int) – block size

__init__(num_node_blocks: int, chs: Sequence[CircuitNodes], edge_ids: Tensor | Sequence[Tensor] | None = None, params: Tensor | None = None, zero_param_mask: 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).

gather_parameters(params)

Update parameters from the current node to the compiled pyjuice.TensorCircuit.

get_params()

Get the sum node parameters.

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

Randomly initialize node parameters.

num_parameters([count_input_params, recursive])

set_params(params[, normalize, pseudocount])

Set the sum node parameters.

update_param_flows(param_flows[, ...])

Update parameter flows from pyjuice.TensorCircuit to the current node.

update_parameters(params[, clone])

Update parameters from pyjuice.TensorCircuit to the current node.