parameters
parameters
¤
BinaryParameterOp
¤
Bases: ParameterOp, ABC
A symbolic parameter operator that represents a binary operation.
Source code in cirkit/symbolic/parameters.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
config
property
¤
in_shape1
property
¤
in_shape2
property
¤
__init__(in_shape1, in_shape2)
¤
Initializes a symbolic binary parameter operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape1
|
tuple[int, ...]
|
The shape of the first input. |
required |
in_shape2
|
tuple[int, ...]
|
The shape of the second input. |
required |
Source code in cirkit/symbolic/parameters.py
222 223 224 225 226 227 228 229 | |
ClampParameter
¤
Bases: EntrywiseParameterOp
A symbolic parameter operator representing the element-wise clamping operator.
Source code in cirkit/symbolic/parameters.py
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
config
property
¤
vmax
property
¤
Retrieves the maximum clamping value.
Returns:
| Type | Description |
|---|---|
float | None
|
The maximum clamping value. |
vmin
property
¤
Retrieves the minimum clamping value.
Returns:
| Type | Description |
|---|---|
float | None
|
The minimum clamping value. |
__init__(in_shape, *, vmin=None, vmax=None)
¤
Initializes a symbolic clamp parameter operator. At least one between the minimum and maximum value must be specified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape
|
tuple[int, ...]
|
The shape of the input. |
required |
vmin
|
float | None
|
The minimum value to clamp to. If it is None, then clamping for the minimum value is not performed. |
None
|
vmax
|
float | None
|
The maximum value to clamp to. If it is None, then clamping for the maximum value is not performed. |
None
|
Source code in cirkit/symbolic/parameters.py
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
ConjugateParameter
¤
Bases: EntrywiseParameterOp
A symbolic parameter operator representing the element-wise complex conjugation operation of its input.
Source code in cirkit/symbolic/parameters.py
617 618 619 620 | |
ConstantParameter
¤
Bases: TensorParameter
A symbolic tensor parameter representing a constant tensor, i.e., a tensor that is not learnable.
Source code in cirkit/symbolic/parameters.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
config
property
¤
value = value
instance-attribute
¤
__init__(*shape, value=0.0)
¤
Initializes a constant symbolic parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*shape
|
int
|
The shape of the parameter. |
()
|
value
|
int | float | complex | number | ndarray
|
The values stored in the parameter. It can be either a number or a Numpy array having the same shape of the given one. |
0.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the given value is a Numpy array having a different shape than the given one. |
Source code in cirkit/symbolic/parameters.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
EntrywiseParameterOp
¤
Bases: UnaryParameterOp, ABC
A symbolic parameter operator that represents a unary function that is applied entrywise to the input parameter tensor.
Source code in cirkit/symbolic/parameters.py
254 255 256 257 258 259 260 261 | |
shape
property
¤
EntrywiseReduceParameterOp
¤
Bases: EntrywiseParameterOp, ABC
A symbolic parameter operator that represents a unary function that is applied entrywise to the input parameter tensor, and this unary function is obtained by reducing one input dimension.
Source code in cirkit/symbolic/parameters.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
axis
property
¤
config
property
¤
__init__(in_shape, *, axis=-1)
¤
Initializes an entrywise reduce parameter operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape
|
tuple[int, ...]
|
The shape of the input. |
required |
axis
|
int
|
The axis of the input being reduced. |
-1
|
Source code in cirkit/symbolic/parameters.py
306 307 308 309 310 311 312 313 314 315 316 | |
ExpParameter
¤
Bases: EntrywiseParameterOp
A symbolic parameter operator representing the exponential of a parameter tensor.
Source code in cirkit/symbolic/parameters.py
496 497 | |
GaussianProductLogPartition
¤
Bases: ParameterOp
A symbolic parameter operator computing the log partition function of the product of two Gaussians, given the means and standard deviations of the input Gaussians.
Source code in cirkit/symbolic/parameters.py
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | |
config
property
¤
shape
property
¤
__init__(in_mean1_shape, in_stddev1_shape, in_mean2_shape, in_stddev2_shape)
¤
Initializes a symbolic Gaussian product log partition function, given the shape of the input means and standard deviations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_mean1_shape
|
tuple[int, ...]
|
The shape of the mean of the first univariate Gaussians. |
required |
in_stddev1_shape
|
tuple[int, ...]
|
The shape of the standard deviations of the first univariate Gaussians. |
required |
in_mean2_shape
|
tuple[int, ...]
|
The shape of the mean of the second univariate Gaussians. |
required |
in_stddev2_shape
|
tuple[int, ...]
|
The shape of the standard deviations of the second univariate Gaussians. |
required |
Source code in cirkit/symbolic/parameters.py
743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | |
GaussianProductMean
¤
Bases: ParameterOp
A symbolic parameter operator computing the mean of the product of two Gaussians, given the means and standard deviations of the input Gaussians. Note that we assume Gaussians being univariate.
Source code in cirkit/symbolic/parameters.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | |
config
property
¤
shape
property
¤
__init__(in_mean1_shape, in_stddev1_shape, in_mean2_shape, in_stddev2_shape)
¤
Initializes a symbolic Gaussian product mean, given the shape of the input means and standard deviations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_mean1_shape
|
tuple[int, ...]
|
The shape of the mean of the first univariate Gaussians. |
required |
in_stddev1_shape
|
tuple[int, ...]
|
The shape of the standard deviations of the first univariate Gaussians. |
required |
in_mean2_shape
|
tuple[int, ...]
|
The shape of the mean of the second univariate Gaussians. |
required |
in_stddev2_shape
|
tuple[int, ...]
|
The shape of the standard deviations of the second univariate Gaussians. |
required |
Source code in cirkit/symbolic/parameters.py
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | |
GaussianProductStddev
¤
Bases: BinaryParameterOp
A symbolic parameter operator computing the standard deviation of the product of two Gaussians, given the standard deviations of the input Gaussians.
Source code in cirkit/symbolic/parameters.py
712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | |
config
property
¤
shape
property
¤
__init__(in_stddev1_shape, in_stddev2_shape)
¤
Initializes a symbolic Gaussian product standard deviation, given the shape of the input standard deviations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_stddev1_shape
|
tuple[int, ...]
|
The shape of the standard deviations of the first univariate Gaussians. |
required |
in_stddev2_shape
|
tuple[int, ...]
|
The shape of the standard deviations of the second univariate Gaussians. |
required |
Source code in cirkit/symbolic/parameters.py
717 718 719 720 721 722 723 724 725 726 727 | |
HadamardParameter
¤
Bases: BinaryParameterOp
A symbolic parameter operator representing the element-wise product of its inputs.
Source code in cirkit/symbolic/parameters.py
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
shape
property
¤
__init__(in_shape1, in_shape2)
¤
Initializes a symbolic Hadamard parameter operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape1
|
tuple[int, ...]
|
The shape of the first input. |
required |
in_shape2
|
tuple[int, ...]
|
The shape of the second input. |
required |
Source code in cirkit/symbolic/parameters.py
409 410 411 412 413 414 415 416 417 | |
IndexParameter
¤
Bases: UnaryParameterOp
A symbolic parameter operator that indexes an input parameter tensor along one axis.
Source code in cirkit/symbolic/parameters.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
config
property
¤
shape
property
¤
__init__(in_shape, *, indices, axis=-1)
¤
Initializes a symbolc index parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape
|
tuple[int, ...]
|
The shape of the input. |
required |
indices
|
list[int]
|
The indices to index. |
required |
axis
|
int
|
The axis of the input tensor being indexed. |
-1
|
Source code in cirkit/symbolic/parameters.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
KroneckerParameter
¤
Bases: BinaryParameterOp
A symbolic parameter operator representing the Kronecker product of its inputs.
Source code in cirkit/symbolic/parameters.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | |
shape
cached
property
¤
__init__(in_shape1, in_shape2)
¤
Initializes a symbolic Kronecker parameter operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape1
|
tuple[int, ...]
|
The shape of the first input. |
required |
in_shape2
|
tuple[int, ...]
|
The shape of the second input. |
required |
Source code in cirkit/symbolic/parameters.py
427 428 429 430 431 432 433 434 435 | |
LogParameter
¤
Bases: EntrywiseParameterOp
A symbolic parameter operator representing the logarithm of a parameter tensor.
Source code in cirkit/symbolic/parameters.py
500 501 | |
LogSoftmaxParameter
¤
Bases: EntrywiseReduceParameterOp
A symoblic parameter operator representing the application of the LogSoftmax function along one dimension.
Source code in cirkit/symbolic/parameters.py
641 642 643 644 | |
MixingWeightParameter
¤
Bases: UnaryParameterOp
The symbolic mixing weights parameter node, which takes as input a matrix \(\mathbf{V}\) of shape \((K, H)\), where \(K\) is the number of units and \(H\) is the arity of a SumLayer, and returns a matrix \(\mathbf{W}\) of shape \((K, K * H)\), where \(\mathbf{W}\) is the column-wise concatenation of matrices \(\{ \mathrm{diag}(\mathbf{v}_{:i}) \}_{i=1}^H\), \(\mathbf{v}_{:i}\) denotes the \(i\)-th column of $\mathbf{V} and \(\mathrm{diag}\) transforms a vector to a diagonal matrix.
This parameter node is used in mixing_weight_factory as to parameterize a sum layer encoding a weighted combination of its input vectors.
Source code in cirkit/symbolic/parameters.py
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | |
OuterParameterOp
¤
Bases: BinaryParameterOp
A symbolic parameter operator computing a function applied over all possible combinations of entries along one axis of the input tensors.
Source code in cirkit/symbolic/parameters.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | |
config
property
¤
shape
property
¤
__init__(in_shape1, in_shape2, *, axis=-1)
¤
Initializes a symbolic parameter outer operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape1
|
tuple[int, ...]
|
The shape of the first input. |
required |
in_shape2
|
tuple[int, ...]
|
The shape of the second input. |
required |
axis
|
int
|
The axis of both inputs along which the function is applied. |
-1
|
Source code in cirkit/symbolic/parameters.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
OuterProductParameter
¤
Bases: OuterParameterOp
A symbolic parameter operator represeting the outer product of two parameter tensors along one axis.
Source code in cirkit/symbolic/parameters.py
484 485 486 487 | |
OuterSumParameter
¤
Bases: OuterParameterOp
A symbolic parameter operator represeting the outer sum of two parameter tensors along one axis.
Source code in cirkit/symbolic/parameters.py
490 491 492 493 | |
Parameter
¤
Bases: RootedDiAcyclicGraph[ParameterNode]
The symbolic parameter computational graph. A symbolic parameter is a computational graph consisting of symbolic nodes, which represent how to compute a tensor parameter.
Source code in cirkit/symbolic/parameters.py
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 | |
shape
property
¤
__init__(nodes, in_nodes, outputs)
¤
Source code in cirkit/symbolic/parameters.py
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | |
__repr__()
¤
Source code in cirkit/symbolic/parameters.py
989 990 | |
from_binary(n, p1, p2)
classmethod
¤
Constructs a parameter by using a binary parameter operation node and by specifying its inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
BinaryParameterOp
|
The binary parameter operation node. |
required |
p1
|
Union[ParameterInput, Parameter]
|
The first symbolic parameter input node, or another parameter. |
required |
p2
|
Union[ParameterInput, Parameter]
|
The second symbolic parameter input node, or another parameter. |
required |
Returns:
| Type | Description |
|---|---|
Parameter
|
A symbolic parameter that encodes the application of the given parameter operation node to the two outputs given by the symbolic parameter inputs or parameters. |
Source code in cirkit/symbolic/parameters.py
944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 | |
from_input(p)
classmethod
¤
Constructs a parameter from a leaf symbolic node only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
ParameterInput
|
The symbolic parameter input. |
required |
Returns:
| Type | Description |
|---|---|
Parameter
|
A symbolic parameter encapsulating the given parameter input. |
Source code in cirkit/symbolic/parameters.py
872 873 874 875 876 877 878 879 880 881 882 | |
from_nary(n, *ps)
classmethod
¤
Constructs a parameter by using a parameter operation node and by specifying its inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
ParameterOp
|
The parameter operation node. |
required |
*ps
|
Union[ParameterInput, Parameter]
|
A sequence of symbolic parameter input nodes or parameters. |
()
|
Returns:
| Type | Description |
|---|---|
Parameter
|
A symbolic parameter that encodes the application of the given parameter operation node to the outputs given by the symbolic parameter input nodes or parameters. |
Source code in cirkit/symbolic/parameters.py
907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 | |
from_sequence(p, *ns)
classmethod
¤
Constructs a parameter from a composition of symbolic parameter nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
Union[ParameterInput, Parameter]
|
The entry point of the sequence, which can be either a symbolic parameter input or another symbolic parameter. |
required |
*ns
|
ParameterNode
|
A sequence of symbolic parameter nodes. |
()
|
Returns:
| Type | Description |
|---|---|
Parameter
|
A symbolic parameter that encodes the composition of the symbolic parameter nodes, starting from the given entry point of the sequence. |
Source code in cirkit/symbolic/parameters.py
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 | |
from_unary(n, p)
classmethod
¤
Constructs a parameter by using a unary parameter operation node and by specifying its inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
UnaryParameterOp
|
The unary parameter operation node. |
required |
p
|
Union[ParameterInput, Parameter]
|
The symbolic parameter input node, or another parameter. |
required |
Returns:
| Type | Description |
|---|---|
Parameter
|
A symbolic parameter that encodes the application of the given parameter operation node to the output given by the symbolic parameter input node or parameter. |
Source code in cirkit/symbolic/parameters.py
929 930 931 932 933 934 935 936 937 938 939 940 941 942 | |
ref()
¤
Constructs a shallow copy of the parameter, where the tensor parameters are replace with reference parameters to them.
Returns:
| Type | Description |
|---|---|
Parameter
|
A shallow copy of the parameter nodes, with the exception that tensor parameter nodes are replaced with symbolic references to them. |
Source code in cirkit/symbolic/parameters.py
965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 | |
ParameterFactory
¤
Bases: Protocol
A factory that constucts symbolic parameter given a shape.
Source code in cirkit/symbolic/parameters.py
993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | |
__call__(shape)
¤
Constructs a symbolic parameter given the parameter shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
tuple[int, ...]
|
The shape. |
required |
Returns:
| Type | Description |
|---|---|
Parameter
|
A parameter whose output shape is equal to the given shape. |
Source code in cirkit/symbolic/parameters.py
996 997 998 999 1000 1001 1002 1003 1004 | |
ParameterInput
¤
Bases: ParameterNode, ABC
The abstract parameter input class. A parameter input is a parameter node in the computational graph that comptues parameter that does not have inputs. See Parameter for more details.
Source code in cirkit/symbolic/parameters.py
50 51 52 53 | |
ParameterNode
¤
Bases: ABC
The abstract parameter node class. A parameter node is a node in the computational graph that computes parameters. See Parameter for more details.
Source code in cirkit/symbolic/parameters.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
config
abstractmethod
property
¤
Retrieves the configuration of the parameter node, i.e., a dictionary mapping
hyperparameters of the parameter node to their values. The hyperparameter names must
match the argument names in the __init__ method.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict[str, Any]: A dictionary from hyperparameter names to their value. |
shape
abstractmethod
property
¤
__copy__()
¤
The shallow copy operation of a parameter node.
Returns:
| Type | Description |
|---|---|
ParameterNode
|
The copy of the parameter node. |
Source code in cirkit/symbolic/parameters.py
20 21 22 23 24 25 26 27 | |
ParameterOp
¤
Bases: ParameterNode, ABC
A symbolic parameter operator, i.e., an inner node of the symbolic parameter computational graph.
Source code in cirkit/symbolic/parameters.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
in_shapes
property
¤
__init__(*in_shapes)
¤
Initializes a symbolic parameter operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*in_shapes
|
tuple[int, ...]
|
A sequence of the shapes of each input. The length of this sequence is the arity of the parameter operator. |
()
|
Source code in cirkit/symbolic/parameters.py
175 176 177 178 179 180 181 182 | |
PolynomialDifferential
¤
Bases: UnaryParameterOp
A symbolic parameter operator representing the coefficients of a polynomial resulting from the differentiation of a polynomial.
Source code in cirkit/symbolic/parameters.py
792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | |
config
property
¤
order = order
instance-attribute
¤
shape
property
¤
__init__(in_shape, *, order=1)
¤
Initializes a symbolic polynomial differential coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape
|
tuple[int, ...]
|
The shape of the coefficients of the input polynomial. |
required |
order
|
int
|
The differentiation order. |
1
|
Raises:
| Type | Description |
|---|---|
ValuerError
|
if the differentiation order is not a positive integer. |
Source code in cirkit/symbolic/parameters.py
797 798 799 800 801 802 803 804 805 806 807 808 809 810 | |
PolynomialProduct
¤
Bases: BinaryParameterOp
A symbolic parameter operator representing the coefficients of a polynomial resulting from the product of two polynomial.
Source code in cirkit/symbolic/parameters.py
779 780 781 782 783 784 785 786 787 788 789 | |
shape
property
¤
ReduceLSEParameter
¤
Bases: ReduceParameterOp
A symbolic parameter operator representing the LogSumExp reduction along one dimension.
Source code in cirkit/symbolic/parameters.py
631 632 | |
ReduceParameterOp
¤
Bases: UnaryParameterOp, ABC
A symbolic parameter operator that represents a unary function that is a reduction along one dimension of the input parameter tensor.
Source code in cirkit/symbolic/parameters.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
axis
property
¤
config
property
¤
shape
property
¤
__init__(in_shape, *, axis=-1)
¤
Initializes a symbolic reduce parameter operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape
|
tuple[int, ...]
|
The shape of the input. |
required |
axis
|
int
|
The axis of the input being reduced. |
-1
|
Source code in cirkit/symbolic/parameters.py
269 270 271 272 273 274 275 276 277 278 | |
ReduceProductParameter
¤
Bases: ReduceParameterOp
A symbolic parameter operator representing the product reduction along one dimension.
Source code in cirkit/symbolic/parameters.py
627 628 | |
ReduceSumParameter
¤
Bases: ReduceParameterOp
A symbolic parameter operator representing the sum reduction along one dimension.
Source code in cirkit/symbolic/parameters.py
623 624 | |
ReferenceParameter
¤
Bases: ParameterInput
A symbolic reference parameter representing a symbolic link to a tensor parameter.
Source code in cirkit/symbolic/parameters.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
config
property
¤
shape
property
¤
__init__(parameter)
¤
Initializes a reference parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter
|
TensorParameter
|
The tensor parameter to point to. |
required |
Source code in cirkit/symbolic/parameters.py
144 145 146 147 148 149 150 151 | |
deref()
¤
Dereference the pointer.
Returns:
| Type | Description |
|---|---|
TensorParameter
|
The tensor paramter being pointed to. |
Source code in cirkit/symbolic/parameters.py
161 162 163 164 165 166 167 | |
ScaledSigmoidParameter
¤
Bases: EntrywiseParameterOp
A symbolic parameter operator representing the entry-wise application of the rescaled sigmoid function to a parameter tensor.
Source code in cirkit/symbolic/parameters.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | |
config
property
¤
vmax
property
¤
vmin
property
¤
__init__(in_shape, vmin, vmax)
¤
Initializes a symbolic scaled sigmoid parameter operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape
|
tuple[int, ...]
|
The shape of the input. |
required |
vmin
|
float
|
The minimum output value. |
required |
vmax
|
float
|
The maximum output value |
required |
Source code in cirkit/symbolic/parameters.py
527 528 529 530 531 532 533 534 535 536 537 538 | |
SigmoidParameter
¤
Bases: EntrywiseParameterOp
A symbolic parameter operator representing the entry-wise application of the sigmoid function to a parameter tensor.
Source code in cirkit/symbolic/parameters.py
516 517 518 519 | |
SoftmaxParameter
¤
Bases: EntrywiseReduceParameterOp
A symbolic parameter operator representing the application of the Softmax function along one dimension.
Source code in cirkit/symbolic/parameters.py
635 636 637 638 | |
SoftplusParameter
¤
Bases: EntrywiseParameterOp
A symbolic parameter operator representing the entry-wise application of the softplus function to a parameter tensor.
Source code in cirkit/symbolic/parameters.py
510 511 512 513 | |
SquareParameter
¤
Bases: EntrywiseParameterOp
A symbolic parameter operator representing the entry-wise square of a parameter tensor.
Source code in cirkit/symbolic/parameters.py
504 505 506 507 | |
SumParameter
¤
Bases: BinaryParameterOp
A symbolic parameter operator representing the element-wise sum of its inputs.
Source code in cirkit/symbolic/parameters.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
shape
property
¤
__init__(in_shape1, in_shape2)
¤
Initializes a symbolic sum parameter operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape1
|
tuple[int, ...]
|
The shape of the first input. |
required |
in_shape2
|
tuple[int, ...]
|
The shape of the second input. |
required |
Source code in cirkit/symbolic/parameters.py
391 392 393 394 395 396 397 398 399 | |
TensorParameter
¤
Bases: ParameterInput
A symbolic tensor parameter is an object storing information about a dense tensor parameter, i.e., its shape, its initialization method, whether it is learnable (or if it is a constant tensor), and its data type. Note that the symbolic tensor parmater does not allocate any tensor, but only stores the mentioned information about it.
Source code in cirkit/symbolic/parameters.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
config
property
¤
dtype = dtype
instance-attribute
¤
initializer = initializer
instance-attribute
¤
learnable = learnable
instance-attribute
¤
shape
property
¤
__init__(*shape, initializer, learnable=True, dtype=DataType.REAL)
¤
Initializes a symbolic tensor parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*shape
|
int
|
The shape of the tensor parameter. |
()
|
initializer
|
Initializer
|
The initializer object. |
required |
learnable
|
bool
|
Whether the tensor parameter is learnable or not. |
True
|
dtype
|
DataType
|
The data type. |
REAL
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the shape is empty or contains dimensions that are not positive. |
ValueError
|
If the initializer does not allow the parameter shape. |
Source code in cirkit/symbolic/parameters.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
UnaryParameterOp
¤
Bases: ParameterOp, ABC
A symbolic parameter operator that represents a unary operation.
Source code in cirkit/symbolic/parameters.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
config
property
¤
in_shape
property
¤
__init__(in_shape)
¤
Initializes a symbolic unary parameter operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_shape
|
tuple[int, ...]
|
The shape of the input. |
required |
Source code in cirkit/symbolic/parameters.py
197 198 199 200 201 202 203 | |
mixing_weight_factory(shape, *, param_factory)
¤
Construct the parameters of a sum layer with arity > 1 such that it encodes a linear combination of the input vectors it receives. A sum layer with this semantics is also referred to as "mixing layer" in some papers (see references below). A mixing layer is parameterized by a parameter matrix \(\mathbf{W}\in\bbR^{K\times H}\), where \(K\) is the number of sum units, and H is the number of input vectors; and it computes \(\sum_{i=1}^H \mathbf{w}_{:i} \mathbf{x}_i\). This function firstly constructs \(\mathbf{W}\) given a parameter factory, and then reshapes it into a \(K\times KH\) parameter matrix for a sum layer that mimics a mixing layer.
References
- R. Peharz et al. (2020), Einsum Networks: Fast and Scalable Learning of Tractable Probabilistic Circuits
- Loconte et al. (2024), What is the Relationship between Tensor Factorizations and Circuits (and How Can We Exploit it)?
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
tuple[int, ...]
|
The shape of the parameter. It must be (num_units, arity * num_units), where num_units is the number of sum units or, equivalently the size of the input vectors, and arity is the number of them. |
required |
param_factory
|
ParameterFactory
|
The parameter factory used to construct the mixing weights of shape (num_units, arity). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Parameter |
Parameter
|
A symbolic parameter. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the given shape is not of the form (num_units, arity * num_units). |
Source code in cirkit/symbolic/parameters.py
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | |