"vscode:/vscode.git/clone" did not exist on "93cdbaf591ffbf0df30cc880f7ac8491507d3c62"
Commit 7ae6bfdd authored by Hongkun Yu's avatar Hongkun Yu Committed by A. Unique TensorFlower
Browse files

PY3 migration. Autograph compatible.

PiperOrigin-RevId: 287619398
parent 0b87b8b0
......@@ -111,10 +111,10 @@ class ParamsDict(object):
the value of the key.
Raises:
KeyError: if k is not defined in the ParamsDict.
AttributeError: if k is not defined in the ParamsDict.
"""
if k not in self.__dict__.keys():
raise KeyError('The key `{}` does not exist. '.format(k))
raise AttributeError('The key `{}` does not exist. '.format(k))
return self.__dict__[k]
def __contains__(self, key):
......
......@@ -27,7 +27,7 @@ class ParamsDictTest(tf.test.TestCase):
def test_init_from_an_empty_dict(self):
params = params_dict.ParamsDict()
with self.assertRaises(KeyError):
with self.assertRaises(AttributeError):
_ = params.a
with self.assertRaises(KeyError):
......
......@@ -64,7 +64,7 @@ class InputFn(object):
self._input_sharding = params.train.input_sharding
else:
self._input_sharding = params.eval.input_sharding
except KeyError:
except AttributeError:
pass
def __call__(self, ctx=None, batch_size: int = None):
......
......@@ -39,7 +39,7 @@ class OptimizerFactory(object):
nesterov = False
try:
nesterov = params.nesterov
except KeyError:
except AttributeError:
pass
self._optimizer = functools.partial(
tf.keras.optimizers.SGD,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment