Skip to content

Commit 515b5ac

Browse files
authored
[custom-layer] Update API usage for serialization (#273)
* [custom-layer] Update API usage for serialization
1 parent a698a4e commit 515b5ac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

custom-layer/custom_layer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ class Antirectifier extends tf.layers.Layer {
7979
}
8080

8181
/**
82-
* Layers must implement "getClassName".
82+
* If a custom layer class is to support serialization, it must implement
83+
* the `className` static getter.
8384
*/
84-
getClassName() {
85+
static get className() {
8586
return 'Antirectifier';
8687
}
8788
}
89+
tf.serialization.registerClass(Antirectifier); // Needed for serialization.
8890

8991
export function antirectifier() {
9092
return new Antirectifier();

0 commit comments

Comments
 (0)