Skip to content

Commit 5aa2311

Browse files
committed
Add zero loss
1 parent e7e5276 commit 5aa2311

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

deepxde/losses.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import division
33
from __future__ import print_function
44

5+
from . import config
56
from .backend import tf
67

78

@@ -15,6 +16,10 @@ def mean_squared_error(y_true, y_pred):
1516
return tf.reduce_mean(tf.math.square(y_true - y_pred))
1617

1718

19+
def zero(*_):
20+
return tf.constant(0, dtype=config.real(tf))
21+
22+
1823
mean_absolute_error = tf.keras.losses.MeanAbsoluteError()
1924
mean_absolute_percentage_error = tf.keras.losses.MeanAbsolutePercentageError()
2025
softmax_cross_entropy = tf.losses.softmax_cross_entropy
@@ -35,6 +40,7 @@ def get(identifier):
3540
"MAPE": mean_absolute_percentage_error,
3641
"mape": mean_absolute_percentage_error,
3742
"softmax cross entropy": softmax_cross_entropy,
43+
"zero": zero,
3844
}
3945

4046
if isinstance(identifier, str):

0 commit comments

Comments
 (0)