MCPcopy
hub / github.com/tensorflow/tfjs / getInitializer

Function getInitializer

tfjs-layers/src/initializers.ts:636–668  ·  view source on GitHub ↗
(identifier: InitializerIdentifier|Initializer|
                               serialization.ConfigDict)

Source from the content-addressed store, hash-verified

634}
635
636export 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}

Callers 15

addWeightFunction · 0.90
constructorFunction · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90

Calls 1

deserializeInitializerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…