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

Method constructor

tfjs-layers/src/layers/advanced_activations.ts:148–170  ·  view source on GitHub ↗
(args?: PReLULayerArgs)

Source from the content-addressed store, hash-verified

146 readonly DEFAULT_ALPHA_INITIALIZER: InitializerIdentifier = 'zeros';
147
148 constructor(args?: PReLULayerArgs) {
149 super(args == null ? {} : args);
150 if (args == null) {
151 args = {};
152 }
153
154 this.supportsMasking = true;
155 this.alphaInitializer =
156 getInitializer(args.alphaInitializer || this.DEFAULT_ALPHA_INITIALIZER);
157 this.alphaRegularizer = getRegularizer(args.alphaRegularizer);
158 this.alphaConstraint = getConstraint(args.alphaConstraint);
159 if (args.sharedAxes == null) {
160 this.sharedAxes = null;
161 } else if (Array.isArray(args.sharedAxes)) {
162 this.sharedAxes = args.sharedAxes;
163 } else if (typeof args.sharedAxes === 'number') {
164 this.sharedAxes = [args.sharedAxes];
165 } else {
166 throw new ValueError(
167 `Expected sharedAxes to be a number or an array of numbers, ` +
168 `but got ${args.sharedAxes}`);
169 }
170 }
171
172 override build(inputShape: Shape|Shape[]) {
173 inputShape = getExactlyOneShape(inputShape);

Callers

nothing calls this directly

Calls 3

getInitializerFunction · 0.90
getRegularizerFunction · 0.90
getConstraintFunction · 0.90

Tested by

no test coverage detected