sharktide commited on
Commit
6f82c72
·
verified ·
1 Parent(s): 38368e3

Create custom_objects.py

Browse files
Files changed (1) hide show
  1. custom_objects.py +12 -0
custom_objects.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tensorflow as tf
2
+ from tensorflow.keras import layers, models
3
+ from tensorflow.keras.saving import register_keras_serializable
4
+
5
+ @register_keras_serializable()
6
+ def trust_activation(x):
7
+ return 0.5 + tf.sigmoid(x)
8
+
9
+ CUSTOM_OBJECTS = {
10
+ 'mse': tf.keras.losses.MeanSquaredError,
11
+ 'trust_activation': trust_activation
12
+ }