MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _set_metric_attributes

Method _set_metric_attributes

tensorflow/python/keras/engine/training.py:1961–1988  ·  view source on GitHub ↗

Sets the metric attributes on the model for all the model outputs.

(self)

Source from the content-addressed store, hash-verified

1959 return updated_metrics_dict
1960
1961 def _set_metric_attributes(self):
1962 """Sets the metric attributes on the model for all the model outputs."""
1963 updated_per_output_metrics = []
1964 updated_per_output_weighted_metrics = []
1965 for i, endpoint in enumerate(self._training_endpoints):
1966 if endpoint.should_skip_target():
1967 updated_per_output_metrics.append(self._per_output_metrics[i])
1968 updated_per_output_weighted_metrics.append(
1969 self._per_output_weighted_metrics[i])
1970 continue
1971 updated_per_output_metrics.append(
1972 self._set_per_output_metric_attributes(self._per_output_metrics[i],
1973 i))
1974 updated_per_output_weighted_metrics.append(
1975 self._set_per_output_metric_attributes(
1976 self._per_output_weighted_metrics[i], i))
1977
1978 # Create a metric wrapper for each output loss. This computes mean of an
1979 # output loss across mini-batches (irrespective of how we reduce within a
1980 # batch).
1981 if len(self._training_endpoints) > 1:
1982 for endpoint in self._training_endpoints:
1983 if not endpoint.should_skip_target():
1984 endpoint.output_loss_metric = metrics_module.Mean(
1985 name=endpoint.loss_name())
1986
1987 self._per_output_metrics = updated_per_output_metrics
1988 self._per_output_weighted_metrics = updated_per_output_weighted_metrics
1989
1990 def _handle_per_output_metrics(self,
1991 metrics_dict,

Callers 2

compileMethod · 0.95
_compile_eagerlyMethod · 0.95

Calls 5

should_skip_targetMethod · 0.80
loss_nameMethod · 0.80
appendMethod · 0.45
MeanMethod · 0.45

Tested by

no test coverage detected