How to use the netron.solvers.RandomSearch function in netron

To help you get started, we’ve selected a few netron examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yankov / netron / server.py View on Github external
args = parser.parse_args()

input_shape = [int(dim) for dim in args.input_shape.split(",")]

# TODO: cleanup repetative code
print "Starting a server with %s solver and %s dataset" % (args.solver, args.data)
if args.solver == "GridSearch":
    solver = GridSearch(args.grid, input_shape, args.output_dim, "keras", args.data)
    job_manager = JobManager(solver)
    server = JobHTTPServer(args.port, job_manager, args.mongo_uri)
    server.start()
elif args.solver == "RandomSearch":
    if not args.params_sample_size or not args.structure_sample_size:
        raise ValueError("--params_sample_size  and --structure_sample_size must be used with RandomSearch")
    solver = RandomSearch(args.grid, input_shape, args.output_dim, "keras", args.data, args.params_sample_size,
                          args.structure_sample_size)
    job_manager = JobManager(solver)
    server = JobHTTPServer(args.port, job_manager, args.mongo_uri)
    server.start()
elif args.solver == "HyperOpt":
    h = HyperOptSearch(input_shape=input_shape, output_dim=args.output_dim)
    h.start_search_server(args.mongo_uri, args.data, int(args.layers_num), args.max_evals, args.nb_epoch, args.patience)
else:
    raise ValueError("This solver is not supported. Only possible values for --solver right now are GridSearch or RandomSearch")