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