declearn.model.api.register_vector_type
Decorate a Vector subclass to make it buildable with Vector.build
.
Decorating a Vector subclass with this has three effects:
- Add the class to registered type (in the "Vector" group).
See
declearn.utils.register_type
for details. - Make instances of that class JSON-serializable, embarking
the wrapped data by using the
pack
andunpack
methods of the class. Seedeclearn.utils.add_json_support
. - Make the subclass buildable through
Vector.build(coefs)
, based on the analysis of wrapped coefficients' type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v_type |
Type[Any]
|
Type of wrapped data that is to trigger using |
required |
*types |
Type[Any]
|
Additional |
()
|
name |
Optional[str]
|
Optional name under which to register the type, shared
by |
None
|
Returns:
Name | Type | Description |
---|---|---|
register |
func(cls) -
|
A closure that performs the registration operations.
Hence |
Source code in declearn/model/api/_vector.py
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 |
|