mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-06 12:20:11 +01:00
Add call in eager mode for error logging.
PiperOrigin-RevId: 515437167
This commit is contained in:
parent
b01db583ac
commit
a35eb03c6d
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
from tensorflow.python import pywrap_tfe
|
||||
from tensorflow.python.framework import errors
|
||||
from tensorflow.python.platform import tf_logging as logging
|
||||
|
||||
# Trace of execution and memory usage.
|
||||
_active_trace = None
|
||||
|
|
@ -24,10 +25,15 @@ _active_trace = None
|
|||
def _status_to_exception(status):
|
||||
try:
|
||||
error_class = errors.exception_type_from_error_code(status.code)
|
||||
return error_class(None, None, status.message, status.payloads)
|
||||
e = error_class(None, None, status.message, status.payloads)
|
||||
logging.error_log("%s: %s" % (e.__class__.__name__, e))
|
||||
return e
|
||||
except KeyError:
|
||||
return errors.UnknownError(None, None, status.message, status.code,
|
||||
status.payloads)
|
||||
e = errors.UnknownError(
|
||||
None, None, status.message, status.code, status.payloads
|
||||
)
|
||||
logging.error_log("%s: %s" % (e.__class__.__name__, e))
|
||||
return e
|
||||
|
||||
|
||||
class _NotOkStatusException(Exception):
|
||||
|
|
|
|||
|
|
@ -364,3 +364,8 @@ tf_export(v1=['logging.ERROR']).export_constant(__name__, 'ERROR')
|
|||
tf_export(v1=['logging.FATAL']).export_constant(__name__, 'FATAL')
|
||||
tf_export(v1=['logging.INFO']).export_constant(__name__, 'INFO')
|
||||
tf_export(v1=['logging.WARN']).export_constant(__name__, 'WARN')
|
||||
|
||||
|
||||
def error_log(error_msg, level=ERROR):
|
||||
"""Empty helper method."""
|
||||
del error_msg, level
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user