Skip to content

Enable test_optim unit tests … #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
'multiprocessing',
'nccl',
'nn',
'optim',
'sparse',
'torch',
'utils',
Expand Down
8 changes: 8 additions & 0 deletions test/test_optim.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ def _build_params_dict(self, weight, bias, **kwargs):
def _build_params_dict_single(self, weight, bias, **kwargs):
return [dict(params=bias, **kwargs)]

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_sgd(self):
self._test_rosenbrock(
lambda params: optim.SGD(params, lr=1e-3),
Expand Down Expand Up @@ -272,6 +273,7 @@ def test_sgd_sparse(self):
lambda params: optim.SGD(params, lr=5e-3)
)

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_adam(self):
self._test_rosenbrock(
lambda params: optim.Adam(params, lr=1e-2),
Expand Down Expand Up @@ -309,6 +311,7 @@ def test_sparse_adam(self):
with self.assertRaisesRegex(ValueError, "Invalid beta parameter at index 0: 1.0"):
optim.SparseAdam(None, lr=1e-2, betas=(1.0, 0.0))

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_adadelta(self):
self._test_rosenbrock(
lambda params: optim.Adadelta(params),
Expand All @@ -332,6 +335,7 @@ def test_adadelta(self):
with self.assertRaisesRegex(ValueError, "Invalid rho value: 1.1"):
optim.Adadelta(None, lr=1e-2, rho=1.1)

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_adagrad(self):
self._test_rosenbrock(
lambda params: optim.Adagrad(params, lr=1e-1),
Expand Down Expand Up @@ -365,6 +369,7 @@ def test_adagrad_sparse(self):
lambda params: optim.Adagrad(params, lr=1e-1)
)

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_adamax(self):
self._test_rosenbrock(
lambda params: optim.Adamax(params, lr=1e-1),
Expand All @@ -389,6 +394,7 @@ def test_adamax(self):
with self.assertRaisesRegex(ValueError, "Invalid beta parameter at index 1: 1.0"):
optim.Adamax(None, lr=1e-2, betas=(0.0, 1.0))

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_rmsprop(self):
self._test_rosenbrock(
lambda params: optim.RMSprop(params, lr=1e-2),
Expand All @@ -413,6 +419,7 @@ def test_rmsprop(self):
with self.assertRaisesRegex(ValueError, "Invalid momentum value: -1.0"):
optim.RMSprop(None, lr=1e-2, momentum=-1.0)

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_asgd(self):
self._test_rosenbrock(
lambda params: optim.ASGD(params, lr=1e-3),
Expand Down Expand Up @@ -462,6 +469,7 @@ def test_rprop(self):
with self.assertRaisesRegex(ValueError, "Invalid eta values: 1.0, 0.5"):
optim.Rprop(None, lr=1e-2, etas=(1.0, 0.5))

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_lbfgs(self):
self._test_rosenbrock(
lambda params: optim.LBFGS(params),
Expand Down