mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[TB] Add support for hparam domain_discrete (#40720)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/40720 Add support for populating domain_discrete field in TensorBoard add_hparams API Test Plan: Unit test test_hparams_domain_discrete Reviewed By: edward-io Differential Revision: D22291347 fbshipit-source-id: 78db9f62661c9fe36cd08d563db0e7021c01428d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
53af9df557
commit
01e2099bb8
@ -465,6 +465,22 @@ class TestTensorBoardSummary(BaseTestCase):
|
||||
mt = {'accuracy': 0.1}
|
||||
self.assertTrue(compare_proto(summary.hparams(hp, mt), self))
|
||||
|
||||
def test_hparams_domain_discrete(self):
|
||||
hp = {"lr": 0.1, "bool_var": True, "string_var": "hi"}
|
||||
mt = {"accuracy": 0.1}
|
||||
hp_domain = {"lr": [0.1], "bool_var": [True], "string_var": ["hi"]}
|
||||
|
||||
# hparam_domain_discrete keys needs to be subset of hparam_dict keys
|
||||
with self.assertRaises(TypeError):
|
||||
summary.hparams(hp, mt, hparam_domain_discrete={"wrong_key": []})
|
||||
|
||||
# hparam_domain_discrete values needs to be same type as hparam_dict values
|
||||
with self.assertRaises(TypeError):
|
||||
summary.hparams(hp, mt, hparam_domain_discrete={"lr": [True]})
|
||||
|
||||
# only smoke test. Because protobuf map serialization is nondeterministic.
|
||||
summary.hparams(hp, mt, hparam_domain_discrete=hp_domain)
|
||||
|
||||
def test_mesh(self):
|
||||
v = np.array([[[1, 1, 1], [-1, -1, 1], [1, -1, -1], [-1, 1, -1]]], dtype=float)
|
||||
c = np.array([[[255, 0, 0], [0, 255, 0], [0, 0, 255], [255, 0, 255]]], dtype=int)
|
||||
|
Reference in New Issue
Block a user