Ejemplo n.º 1
0
    rpc_info = RpcInfo(args.host, args.port, args.target_host, args.device_key,
                       args.use_rpc, args.fcompile, args.timeout)

    shapes = conv1d_shapes
    if args.to < 0:
        end = len(shapes)
    else:
        end = args.to

    if args.test != "":
        with open(args.test, "r") as fin:
            for line in fin:
                name, string = line.split(":", 1)
                obj = json.loads(string)
                configs = Config(obj[0], obj[1])
                test(name, configs, args.device, rpc_info, args.check)

    elif args.log != "":
        with open(args.log, "a") as flog:
            ret = optimize(
                shapes[args.from_:end],
                slevel=args.slevel,
                rlevel=args.rlevel,
                target=args.target,
                dev_id=args.device,
                timeout=args.timeout,
                trials=args.trials,
                parallel=args.parallel,
                use_model=args.use_model,
                method=args.method,
                logfile=flog,
                    method=args.method,
                    use_model=args.use_model,
                    rpc_info=rpc_info,
                    force_inline=args.force_inline,
                    logfile=flog,
                )
        else:
            ret = optimize(
                args.shapes,
                args.from_,
                shapes[args.from_:end],
                target=args.target,
                dev_id=args.device,
                timeout=args.timeout,
                trials=args.trials,
                parallel=args.parallel,
                method=args.method,
                use_model=args.use_model,
                rpc_info=rpc_info,
                force_inline=args.force_inline,
                logfile=sys.stdout,
            )
    if args.test != "":
        with open(args.test, "r") as fin:
            for line in fin:
                name, string = line.split(":", 1)
                obj = json.loads(string)
                configs = Config(obj[0], obj[1])
                test(name, configs, dev_id=args.device,
                     rpc_info=rpc_info, check_result=args.check)