Reputation: 43
I made an enum file and tried to import in the file showing next code (another file) But showing this error following :
File "C:/Users/1/PycharmProjects/assignment3/Program.py", line 61, in Program
NN.TrainByBackProp(100000, 0.1, GradDescType.STOCHASTIC)
NameError: name 'GradDescType' is not defined
and this host file seems not recognize import when I imported like import Myenum which is belonged enum file. What should I correct to deal with this issue? Thank you for your response in advance. If you need more information, let me know I will respond as soon as possible.
enum file
import enum
class GradDescType(enum.Enum):
BATCH=1
STOCHASTIC=2
MINIBATCH=2
class ActivationFunction(enum.Enum):
SIGMOID=1
SOFTMAX=2
another file
NN.TrainByBackProp(100000, 0.1, GradDescType.STOCHASTIC)
Upvotes: 0
Views: 62
Reputation: 69021
In "another file" you need to import the two Enums you have defined:
from <enum_file> import GradDescType, ActivationFunction
Upvotes: 1