'Tensorflow "name is not defined"
I'm using TF 2.8.0 on ubuntu linux in a jupyter notebook on a gtx 1660 gpu. The model seems to work fine until I change the name of a simple variable. This line was:
HP_NUM_UNITS_ONE = hp.HParam('num_units', hp.Discrete([8, 16]))
however switching this to another name, for example:
HP_NUM_UNITS_ONE = hp.HParam('jam', hp.Discrete([8, 16]))
now it throws this error in the grid search running of the model
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [12], in <cell line: 3>()
5 for dropout_rate in (HP_DROPOUT.domain.min_value, HP_DROPOUT.domain.max_value):
6 for optimizer in HP_OPTIMIZER.domain.values:
7 hparams = {
----> 8 HP_NUM_UNITS_ONE: jam,
9 HP_NUM_SEC: stuff,
10 HP_DROPOUT: dropout_rate,
11 HP_OPTIMIZER: optimizer,
12 }
13 run_name = "run-%d" % session_num
14 print('--- Starting trial: %s' % run_name)
NameError: name 'jam' is not defined
Are there some sort of naming conventions or restrictions on what these variables can be called, or what they can not be called. I need to use different names to set the number of nodes for different layers. I have restarted the kernel, and reloaded the whole notebook many times but still get the same error. Thx. J
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
