Compat fix
This commit is contained in:
parent
1d81c47283
commit
93e3eb6b43
@ -107,14 +107,7 @@ class CustomModel(keras.Model):
|
|||||||
metric.update_state(y, y_pred)
|
metric.update_state(y, y_pred)
|
||||||
|
|
||||||
# Return a dict mapping metric names to current value
|
# Return a dict mapping metric names to current value
|
||||||
metric_values = {}
|
return {m.name: m.result() for m in self.metrics}
|
||||||
for metric in self.metrics:
|
|
||||||
result = metric.result()
|
|
||||||
if isinstance(result, dict):
|
|
||||||
metric_values.update(result)
|
|
||||||
else:
|
|
||||||
metric_values[metric.name] = result
|
|
||||||
return metric_values
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -258,14 +251,7 @@ class CustomModel(keras.Model):
|
|||||||
|
|
||||||
# Return a dict mapping metric names to current value.
|
# Return a dict mapping metric names to current value.
|
||||||
# Note that it will include the loss (tracked in self.metrics).
|
# Note that it will include the loss (tracked in self.metrics).
|
||||||
metric_values = {}
|
return {m.name: m.result() for m in self.metrics}
|
||||||
for metric in self.metrics:
|
|
||||||
result = metric.result()
|
|
||||||
if isinstance(result, dict):
|
|
||||||
metric_values.update(result)
|
|
||||||
else:
|
|
||||||
metric_values[metric.name] = result
|
|
||||||
return metric_values
|
|
||||||
|
|
||||||
|
|
||||||
# Construct and compile an instance of CustomModel
|
# Construct and compile an instance of CustomModel
|
||||||
@ -304,14 +290,7 @@ class CustomModel(keras.Model):
|
|||||||
metric.update_state(y, y_pred)
|
metric.update_state(y, y_pred)
|
||||||
# Return a dict mapping metric names to current value.
|
# Return a dict mapping metric names to current value.
|
||||||
# Note that it will include the loss (tracked in self.metrics).
|
# Note that it will include the loss (tracked in self.metrics).
|
||||||
metric_values = {}
|
return {m.name: m.result() for m in self.metrics}
|
||||||
for metric in self.metrics:
|
|
||||||
result = metric.result()
|
|
||||||
if isinstance(result, dict):
|
|
||||||
metric_values.update(result)
|
|
||||||
else:
|
|
||||||
metric_values[metric.name] = result
|
|
||||||
return metric_values
|
|
||||||
|
|
||||||
|
|
||||||
# Construct an instance of CustomModel
|
# Construct an instance of CustomModel
|
||||||
|
@ -115,14 +115,7 @@ class CustomModel(keras.Model):
|
|||||||
|
|
||||||
# Return a dict mapping metric names to current value
|
# Return a dict mapping metric names to current value
|
||||||
# Note that it will include the loss (tracked in self.metrics).
|
# Note that it will include the loss (tracked in self.metrics).
|
||||||
metric_values = {}
|
return {m.name: m.result() for m in self.metrics}
|
||||||
for metric in self.metrics:
|
|
||||||
result = metric.result()
|
|
||||||
if isinstance(result, dict):
|
|
||||||
metric_values.update(result)
|
|
||||||
else:
|
|
||||||
metric_values[metric.name] = result
|
|
||||||
return metric_values
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -278,14 +271,7 @@ class CustomModel(keras.Model):
|
|||||||
|
|
||||||
# Return a dict mapping metric names to current value
|
# Return a dict mapping metric names to current value
|
||||||
# Note that it will include the loss (tracked in self.metrics).
|
# Note that it will include the loss (tracked in self.metrics).
|
||||||
metric_values = {}
|
return {m.name: m.result() for m in self.metrics}
|
||||||
for metric in self.metrics:
|
|
||||||
result = metric.result()
|
|
||||||
if isinstance(result, dict):
|
|
||||||
metric_values.update(result)
|
|
||||||
else:
|
|
||||||
metric_values[metric.name] = result
|
|
||||||
return metric_values
|
|
||||||
|
|
||||||
|
|
||||||
# Construct and compile an instance of CustomModel
|
# Construct and compile an instance of CustomModel
|
||||||
@ -324,14 +310,7 @@ class CustomModel(keras.Model):
|
|||||||
metric.update_state(y, y_pred)
|
metric.update_state(y, y_pred)
|
||||||
# Return a dict mapping metric names to current value.
|
# Return a dict mapping metric names to current value.
|
||||||
# Note that it will include the loss (tracked in self.metrics).
|
# Note that it will include the loss (tracked in self.metrics).
|
||||||
metric_values = {}
|
return {m.name: m.result() for m in self.metrics}
|
||||||
for metric in self.metrics:
|
|
||||||
result = metric.result()
|
|
||||||
if isinstance(result, dict):
|
|
||||||
metric_values.update(result)
|
|
||||||
else:
|
|
||||||
metric_values[metric.name] = result
|
|
||||||
return metric_values
|
|
||||||
|
|
||||||
|
|
||||||
# Construct an instance of CustomModel
|
# Construct an instance of CustomModel
|
||||||
|
@ -714,11 +714,14 @@ class Trainer:
|
|||||||
def _pythonify_logs(self, logs):
|
def _pythonify_logs(self, logs):
|
||||||
result = {}
|
result = {}
|
||||||
for key, value in sorted(logs.items()):
|
for key, value in sorted(logs.items()):
|
||||||
try:
|
if isinstance(value, dict):
|
||||||
value = float(value)
|
result.update(self._pythonify_logs(value))
|
||||||
except:
|
else:
|
||||||
pass
|
try:
|
||||||
result[key] = value
|
value = float(value)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
result[key] = value
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _flatten_metrics_in_order(self, logs):
|
def _flatten_metrics_in_order(self, logs):
|
||||||
|
Loading…
Reference in New Issue
Block a user