(identifier: InitializerIdentifier|Initializer|
serialization.ConfigDict)
| 634 | } |
| 635 | |
| 636 | export function getInitializer(identifier: InitializerIdentifier|Initializer| |
| 637 | serialization.ConfigDict): Initializer { |
| 638 | if (typeof identifier === 'string') { |
| 639 | const className = identifier in INITIALIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP ? |
| 640 | INITIALIZER_IDENTIFIER_REGISTRY_SYMBOL_MAP[identifier] : |
| 641 | identifier; |
| 642 | /* We have four 'helper' classes for common initializers that |
| 643 | all get serialized as 'VarianceScaling' and shouldn't go through |
| 644 | the deserializeInitializer pathway. */ |
| 645 | if (className === 'GlorotNormal') { |
| 646 | return new GlorotNormal(); |
| 647 | } else if (className === 'GlorotUniform') { |
| 648 | return new GlorotUniform(); |
| 649 | } else if (className === 'HeNormal') { |
| 650 | return new HeNormal(); |
| 651 | } else if (className === 'HeUniform') { |
| 652 | return new HeUniform(); |
| 653 | } else if (className === 'LeCunNormal') { |
| 654 | return new LeCunNormal(); |
| 655 | } else if (className === 'LeCunUniform') { |
| 656 | return new LeCunUniform(); |
| 657 | } else { |
| 658 | const config: serialization.ConfigDict = {}; |
| 659 | config['className'] = className; |
| 660 | config['config'] = {}; |
| 661 | return deserializeInitializer(config); |
| 662 | } |
| 663 | } else if (identifier instanceof Initializer) { |
| 664 | return identifier; |
| 665 | } else { |
| 666 | return deserializeInitializer(identifier); |
| 667 | } |
| 668 | } |
no test coverage detected
searching dependent graphs…