Skip to content
Advertisement

Argument parser object does not contain attribute defined in parser

I am working on a program that works on hyperspectral image super-resolution by using Neural Networks, Now in here the Mains directory of the program contains multiple parsers. The parsers and subparsers seem to have been defined correctly

JavaScript

however, upon using the args object, the compiler throws an error saying that the object has no attribute gpus. Though, the test parser does contain the attribute ‘gpus’

JavaScript

I cannot figure out as to why this is happening, as I believe I am parsing the arguments correctly before using args, I tried to find similar issues on forums, but failed to do so.

Advertisement

Answer

All you need to do is:

JavaScript

Just beware that train and test will get different args. train won’t get any of the test values.

Try different command line values and note the differences in the args.

if you use

JavaScript

you don’t need to do your own test for args.subcommand is None. The parser will do that for you.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement