mirror of
https://github.com/clearml/clearml
synced 2025-06-23 01:55:38 +00:00
Clean up TF binding graph execution operator
This commit is contained in:
parent
6778b982a7
commit
0d89497cc9
@ -1257,12 +1257,12 @@ class PatchTensorFlowEager(object):
|
|||||||
from tensorflow.python.eager import context as _context
|
from tensorflow.python.eager import context as _context
|
||||||
if not _context.executing_eagerly():
|
if not _context.executing_eagerly():
|
||||||
from tensorflow import py_function
|
from tensorflow import py_function
|
||||||
from tensorflow.python.framework import ops
|
# just creating the operator is enough (for some reason)
|
||||||
with ops.device("cpu:0"):
|
# to make sure it is added into the execution tree.
|
||||||
p_op = py_function(
|
# the operator itself, will do the reporting to the backend
|
||||||
_report_summary_op,
|
py_function(
|
||||||
inp=[writer, step, tag, value, name], Tout=[])
|
_report_summary_op,
|
||||||
ops.add_to_collection(ops.GraphKeys._SUMMARY_COLLECTION, p_op)
|
inp=[writer, step, tag, value, name], Tout=[])
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LoggerRoot.get_base_logger(TensorflowBinding).warning(str(ex))
|
LoggerRoot.get_base_logger(TensorflowBinding).warning(str(ex))
|
||||||
|
|
||||||
@ -1299,12 +1299,12 @@ class PatchTensorFlowEager(object):
|
|||||||
from tensorflow.python.eager import context as _context
|
from tensorflow.python.eager import context as _context
|
||||||
if not _context.executing_eagerly():
|
if not _context.executing_eagerly():
|
||||||
from tensorflow import py_function
|
from tensorflow import py_function
|
||||||
from tensorflow.python.framework import ops
|
# just creating the operator is enough (for some reason)
|
||||||
with ops.device("cpu:0"):
|
# to make sure it is added into the execution tree.
|
||||||
p_op = py_function(
|
# the operator itself, will do the reporting to the backend
|
||||||
_report_summary_op,
|
py_function(
|
||||||
inp=[writer, step, tag, value, name], Tout=[])
|
_report_summary_op,
|
||||||
ops.add_to_collection(ops.GraphKeys._SUMMARY_COLLECTION, p_op)
|
inp=[writer, step, tag, value, name], Tout=[])
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LoggerRoot.get_base_logger(TensorflowBinding).warning(str(ex))
|
LoggerRoot.get_base_logger(TensorflowBinding).warning(str(ex))
|
||||||
|
|
||||||
@ -1338,12 +1338,12 @@ class PatchTensorFlowEager(object):
|
|||||||
from tensorflow.python.eager import context as _context
|
from tensorflow.python.eager import context as _context
|
||||||
if not _context.executing_eagerly():
|
if not _context.executing_eagerly():
|
||||||
from tensorflow import py_function
|
from tensorflow import py_function
|
||||||
from tensorflow.python.framework import ops
|
# just creating the operator is enough (for some reason)
|
||||||
with ops.device("cpu:0"):
|
# to make sure it is added into the execution tree.
|
||||||
p_op = py_function(
|
# the operator itself, will do the reporting to the backend
|
||||||
_report_summary_op,
|
py_function(
|
||||||
inp=[writer, step, tag, tensor, bad_color, max_images, name], Tout=[])
|
_report_summary_op,
|
||||||
ops.add_to_collection(ops.GraphKeys._SUMMARY_COLLECTION, p_op)
|
inp=[writer, step, tag, tensor, bad_color, max_images, name], Tout=[])
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LoggerRoot.get_base_logger(TensorflowBinding).warning(str(ex))
|
LoggerRoot.get_base_logger(TensorflowBinding).warning(str(ex))
|
||||||
|
|
||||||
@ -1370,6 +1370,12 @@ class PatchTensorFlowEager(object):
|
|||||||
img_data_np=img_data_np,
|
img_data_np=img_data_np,
|
||||||
max_keep_images=kwargs.get('max_images'))
|
max_keep_images=kwargs.get('max_images'))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _nothing_op(*_, **__):
|
||||||
|
"""Convenient else branch for when summaries do not record."""
|
||||||
|
from tensorflow.python.framework import constant_op
|
||||||
|
return constant_op.constant(False)
|
||||||
|
|
||||||
|
|
||||||
# noinspection PyPep8Naming,SpellCheckingInspection
|
# noinspection PyPep8Naming,SpellCheckingInspection
|
||||||
class PatchKerasModelIO(object):
|
class PatchKerasModelIO(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user