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