Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Collect valid values of classname into a type #424

Merged
merged 20 commits into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
af1ab81
Field names should be snake_case, not CamelCase, throughout
davidsoergel Jan 11, 2019
0d77b31
Actually enforce JSON-like type on BaseSerialization.
davidsoergel Jan 13, 2019
a2e5c08
Add missing layers; clea up more CamelCase vs snake_case issues.
davidsoergel Jan 13, 2019
eb6c8fe
Typos; docstrings
davidsoergel Jan 13, 2019
171f9a9
Collect valid values of classname into a type
davidsoergel Jan 14, 2019
eb747fd
Reviewer comments & typo
davidsoergel Jan 14, 2019
6268bd7
Merge branch 'serialization8' into collect-class-names
davidsoergel Jan 14, 2019
389766d
Keras class names are CamelCase regardless of context
davidsoergel Jan 14, 2019
66f7af8
Merge branch 'serialization8' into collect-class-names
davidsoergel Jan 14, 2019
5d7d9c5
minor oops
davidsoergel Jan 14, 2019
c4956b4
Merge branch 'serialization8' into collect-class-names
davidsoergel Jan 14, 2019
6b8e9d6
Reviewer comment
davidsoergel Jan 14, 2019
70a1923
Merge branch 'serialization8' into collect-class-names
davidsoergel Jan 14, 2019
5dbb5f4
Establish the PyJson nature of LayerConfig subtypes.
davidsoergel Jan 14, 2019
5503365
Merge branch 'serialization8' into collect-class-names
davidsoergel Jan 14, 2019
dfd54d3
One more fix to JsonLayer type
davidsoergel Jan 14, 2019
89e9f05
Merge branch 'serialization8' into collect-class-names
davidsoergel Jan 14, 2019
da6cad7
Merge branch 'master' into collect-class-names
davidsoergel Jan 14, 2019
a792284
typos
davidsoergel Jan 14, 2019
03a945e
typo
davidsoergel Jan 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/keras_format/constraint_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ export type MinMaxNormSerialization =

export type ConstraintSerialization = MaxNormSerialization|NonNegSerialization|
UnitNormSerialization|MinMaxNormSerialization;

export type ConstraintClassName = ConstraintSerialization['class_name'];
2 changes: 2 additions & 0 deletions src/keras_format/initializer_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ export type InitializerSerialization = ZerosSerialization|OnesSerialization|
ConstantSerialization|RandomUniformSerialization|RandomNormalSerialization|
TruncatedNormalSerialization|IdentitySerialization|
VarianceScalingSerialization|OrthogonalSerialization;

export type InitializerClassName = InitializerSerialization['class_name'];
22 changes: 22 additions & 0 deletions src/keras_format/keras_class_names.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/

import {ConstraintClassName} from './constraint_config';
import {InitializerClassName} from './initializer_config';
import {LayerClassName} from './layers/layer_serialization';
import {RegularizerClassName} from './regularizer_config';

/**
* A type representing all valid values of `class_name` in a Keras JSON file
* (regardless of context, which will naturally further restrict the valid
* values).
*/
export type KerasClassName = LayerClassName|ConstraintClassName|
InitializerClassName|RegularizerClassName;
1 change: 0 additions & 1 deletion src/keras_format/layers/pooling_serialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,3 @@ export type PoolingLayerSerialization = MaxPooling1DLayerSerialization|
GlobalMaxPooling1DLayerSerialization|
GlobalAveragePooling2DLayerSerialization|
GlobalMaxPooling2DLayerSerialization;
;
2 changes: 2 additions & 0 deletions src/keras_format/regularizer_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ export type L2Serialization = BaseSerialization<'L2', L2Config>;

export type RegularizerSerialization =
L1L2Serialization|L1Serialization|L2Serialization;

export type RegularizerClassName = RegularizerSerialization['class_name'];