[DebuggerV2] Enable debug_v2_ops_test & debug_events_writer_test on Windows

- A test in debug_v2_ops_test previously called `np.power(2, 53)` without specifying
  dtype. As a result, the output had the int32 dtype on Windows and caused
  overflowing. This apparently does not happen on Linux or Mac.
  - This CL fixes that by explicitly specifying `dtype=np.int64` in the call.
- In debug_events_write.cc, check for whether the DebugEventsWriter instance
  is initialized and return early if not so.
  - This resolves a directory-not-empty test failure in debug_events_writer_test
    on Windows

This is a step towards fixing #43608

PiperOrigin-RevId: 349569528
Change-Id: I8112f8faebe662542e80c03d5d95e8e089446fe8
This commit is contained in:
Shanqing Cai 2020-12-30 09:45:55 -08:00 committed by TensorFlower Gardener
parent 7ef1822f35
commit e545d87911
4 changed files with 8 additions and 5 deletions

View File

@ -783,7 +783,6 @@ tf_cc_test(
"//conditions:default": [],
}),
linkstatic = tf_kernel_tests_linkstatic(),
tags = ["no_windows"], # b/150411480
deps = [
"//tensorflow/core:framework",
"//tensorflow/core:lib",

View File

@ -403,6 +403,13 @@ string DebugEventsWriter::FileName(DebugEventFileType type) {
}
Status DebugEventsWriter::Close() {
{
mutex_lock l(initialization_mu_);
if (!is_initialized_) {
return Status::OK();
}
}
std::vector<string> failed_to_close_files;
if (metadata_writer_ != nullptr) {

View File

@ -776,9 +776,6 @@ cuda_py_test(
size = "medium",
srcs = ["lib/debug_v2_ops_test.py"],
python_version = "PY3",
tags = [
"no_windows", # b/142475891
],
deps = [
":debug_events_reader",
":debug_events_writer",

View File

@ -339,7 +339,7 @@ class DebugNumericSummaryV2Test(test_util.TensorFlowTestCase):
debug_event_pb2.TensorDebugMode.SHAPE,
]
# Maximum allowed tensor_id
tensor_id = np.power(2, 53)
tensor_id = np.power(2, 53, dtype=np.int64)
for mode in modes:
self.evaluate(
gen_debug_ops.debug_numeric_summary_v2(