Skip to content

Commit 0e19561

Browse files
cyyeverpytorchmergebot
authored andcommitted
Add back Windows and macOS to tensorboard tests (pytorch#166389)
This PR adds back tensorboard tests on Windows and macOS because the dependency issue is resolved. Pull Request resolved: pytorch#166389 Approved by: https://github.com/Skylion007
1 parent 1fa520e commit 0e19561

File tree

1 file changed

+10
-33
lines changed

1 file changed

+10
-33
lines changed

test/test_tensorboard.py

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
import torch
4141
from torch.testing._internal.common_utils import (
4242
instantiate_parametrized_tests,
43+
parametrize,
4344
IS_MACOS,
4445
IS_WINDOWS,
45-
parametrize,
4646
run_tests,
4747
skipIfTorchDynamo,
4848
TEST_WITH_CROSSREF,
@@ -487,38 +487,23 @@ def test_video(self):
487487
summary.video("dummy", np.random.rand(16, 48, 1, 28, 28))
488488
summary.video("dummy", np.random.rand(20, 7, 1, 8, 8))
489489

490-
@unittest.skipIf(
491-
IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 "
492-
)
493490
@xfailIfS390X
494491
def test_audio(self):
495492
self.assertProto(summary.audio("dummy", tensor_N(shape=(42,))))
496493

497-
@unittest.skipIf(
498-
IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 "
499-
)
500494
def test_text(self):
501495
self.assertProto(summary.text("dummy", "text 123"))
502496

503-
@unittest.skipIf(
504-
IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 "
505-
)
506497
def test_histogram_auto(self):
507498
self.assertProto(
508499
summary.histogram("dummy", tensor_N(shape=(1024,)), bins="auto", max_bins=5)
509500
)
510501

511-
@unittest.skipIf(
512-
IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 "
513-
)
514502
def test_histogram_fd(self):
515503
self.assertProto(
516504
summary.histogram("dummy", tensor_N(shape=(1024,)), bins="fd", max_bins=5)
517505
)
518506

519-
@unittest.skipIf(
520-
IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 "
521-
)
522507
def test_histogram_doane(self):
523508
self.assertProto(
524509
summary.histogram(
@@ -538,9 +523,6 @@ def test_custom_scalars(self):
538523
layout
539524
) # only smoke test. Because protobuf in python2/3 serialize dictionary differently.
540525

541-
@unittest.skipIf(
542-
IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 "
543-
)
544526
def test_mesh(self):
545527
v = np.array([[[1, 1, 1], [-1, -1, 1], [1, -1, -1], [-1, 1, -1]]], dtype=float)
546528
c = np.array(
@@ -550,9 +532,6 @@ def test_mesh(self):
550532
mesh = summary.mesh("my_mesh", vertices=v, colors=c, faces=f, config_dict=None)
551533
self.assertProto(mesh)
552534

553-
@unittest.skipIf(
554-
IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 "
555-
)
556535
def test_scalar_new_style(self):
557536
scalar = summary.scalar("test_scalar", 1.0, new_style=True)
558537
self.assertProto(scalar)
@@ -799,11 +778,15 @@ def test_figure_list(self):
799778
figures.append(figure)
800779

801780
writer.add_figure("add_figure/figure_list", figures, 0, close=False)
802-
self.assertTrue(all(plt.fignum_exists(figure.number) is True for figure in figures)) # noqa: F812
781+
self.assertTrue(
782+
all(plt.fignum_exists(figure.number) is True for figure in figures)
783+
) # noqa: F812
803784

804785
writer.add_figure("add_figure/figure_list", figures, 1)
805786
if matplotlib.__version__ != "3.3.0":
806-
self.assertTrue(all(plt.fignum_exists(figure.number) is False for figure in figures)) # noqa: F812
787+
self.assertTrue(
788+
all(plt.fignum_exists(figure.number) is False for figure in figures)
789+
) # noqa: F812
807790
else:
808791
print(
809792
"Skipping fignum_exists, see https://github.com/matplotlib/matplotlib/issues/18163"
@@ -813,22 +796,16 @@ def test_figure_list(self):
813796

814797

815798
class TestTensorBoardNumpy(BaseTestCase):
816-
@unittest.skipIf(
817-
IS_WINDOWS,
818-
"Skipping on windows, see https://github.com/pytorch/pytorch/pull/109349 ",
819-
)
820-
@unittest.skipIf(
821-
IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 "
822-
)
823799
def test_scalar(self):
824800
res = make_np(1.1)
825801
self.assertIsInstance(res, np.ndarray) and self.assertEqual(res.shape, (1,))
826802
res = make_np(1 << 64 - 1) # uint64_max
827803
self.assertIsInstance(res, np.ndarray) and self.assertEqual(res.shape, (1,))
828804
res = make_np(np.float16(1.00000087))
829805
self.assertIsInstance(res, np.ndarray) and self.assertEqual(res.shape, (1,))
830-
res = make_np(np.float128(1.00008 + 9))
831-
self.assertIsInstance(res, np.ndarray) and self.assertEqual(res.shape, (1,))
806+
if not IS_MACOS and not IS_WINDOWS:
807+
res = make_np(np.float128(1.00008 + 9))
808+
self.assertIsInstance(res, np.ndarray) and self.assertEqual(res.shape, (1,))
832809
res = make_np(np.int64(100000000000))
833810
self.assertIsInstance(res, np.ndarray) and self.assertEqual(res.shape, (1,))
834811

0 commit comments

Comments
 (0)