-1

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)
2
  • 1
    if you use import Myenum then you need to use Myenum.GradDescType.STOCHASTIC Commented Feb 20, 2018 at 22:25
  • 1
    Did you import "enum file" into "another file"? Commented Feb 20, 2018 at 22:25

1 Answer 1

1

In "another file" you need to import the two Enums you have defined:

from <enum_file> import GradDescType, ActivationFunction
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.