pgm_head
Bases: head
A probabilistic graphical model (PGM)-based head for implementing multi-channel modules.
This head supports combinatorial normal expansion and optional parameter reconciliation and residual connections. It is tailored for use with probabilistic graphical models.
Attributes:
Name | Type | Description |
---|---|---|
m |
int
|
Input dimension of the head. |
n |
int
|
Output dimension of the head. |
d |
int
|
Degree for combinatorial expansion. |
with_replacement |
bool
|
Whether combinations are generated with replacement. |
channel_num |
int
|
Number of channels for multi-channel processing. |
parameters_init_method |
str
|
Initialization method for parameters. |
device |
str
|
Device to host the head (e.g., 'cpu' or 'cuda'). |
Methods:
Name | Description |
---|---|
__init__ |
Initializes the PGM head with specified configurations. |
Source code in tinybig/head/basic_heads.py
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 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 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 |
|
__init__(m, n, name='perceptron_head', distribution='normal', d=2, with_replacement=False, enable_bias=False, with_lorr=False, r=3, with_residual=False, channel_num=1, parameters_init_method='xavier_normal', device='cpu', *args, **kwargs)
Initializes the PGM head.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
m
|
int
|
Input dimension. |
required |
n
|
int
|
Output dimension. |
required |
name
|
str
|
Name of the PGM head, default is 'pgm_head'. |
'perceptron_head'
|
distribution
|
str
|
Distribution type for combinatorial expansion, default is 'normal'. |
'normal'
|
d
|
int
|
Degree for combinatorial expansion, default is 2. |
2
|
with_replacement
|
bool
|
Whether combinations are generated with replacement, default is False. |
False
|
enable_bias
|
bool
|
Whether to enable bias in reconciliation functions, default is False. |
False
|
with_lorr
|
bool
|
Whether to use LORR reconciliation, default is False. |
False
|
r
|
int
|
Parameter for reconciliation functions, default is 3. |
3
|
with_residual
|
bool
|
Whether to include a residual connection, default is False. |
False
|
channel_num
|
int
|
Number of channels for multi-channel processing, default is 1. |
1
|
parameters_init_method
|
str
|
Initialization method for parameters, default is 'xavier_normal'. |
'xavier_normal'
|
device
|
str
|
Device to host the head, default is 'cpu'. |
'cpu'
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in tinybig/head/basic_heads.py
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 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 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 |
|