MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / create_quant_model

Function create_quant_model

test/ir/inference/program_config.py:513–710  ·  view source on GitHub ↗
(
    model,
    params,
    activation_quantize_type='moving_average_abs_max',
    weight_quantize_type='channel_wise_abs_max',
    save=False,
)

Source from the content-addressed store, hash-verified

511
512
513def create_quant_model(
514 model,
515 params,
516 activation_quantize_type='moving_average_abs_max',
517 weight_quantize_type='channel_wise_abs_max',
518 save=False,
519):
520 place = paddle.CUDAPlace(0)
521 scope = global_scope()
522 exe = paddle.static.Executor(place)
523 [
524 inference_program,
525 feed_target_names,
526 fetch_targets,
527 ] = paddle.static.io.load_inference_model(
528 path_prefix=None,
529 executor=exe,
530 model_filename=model,
531 params_filename=params,
532 )
533 graph = IrGraph(core.Graph(inference_program.desc), for_test=True)
534
535 out_scale_op_list = [
536 "conv2d",
537 "depthwise_conv2d",
538 "mul",
539 "matmul",
540 "relu",
541 "leaky_relu",
542 "relu6",
543 "sigmoid",
544 "tanh",
545 "prelu",
546 "swish",
547 "softmax",
548 "batch_norm",
549 "layer_norm",
550 "elementwise_add",
551 "pool2d",
552 "reshape2",
553 "transpose2",
554 "concat",
555 "elementwise_mul",
556 "scale",
557 "slice",
558 "hard_swish",
559 "hard_sigmoid",
560 "conv2d_transpose",
561 "gru",
562 "bilinear_interp",
563 "nearest_interp",
564 "trilinear_interp",
565 "flatten",
566 "flatten2",
567 "transpose",
568 "pad2d",
569 "reshape",
570 "layer_norm",

Callers 3

run_testMethod · 0.90
run_testMethod · 0.90
run_testMethod · 0.90

Calls 15

applyMethod · 0.95
all_op_nodesMethod · 0.95
_find_node_by_nameMethod · 0.95
applyMethod · 0.95
to_programMethod · 0.95
global_scopeFunction · 0.90
IrGraphClass · 0.90
CUDAPlaceMethod · 0.80
load_inference_modelMethod · 0.80
global_blockMethod · 0.80

Tested by 3

run_testMethod · 0.72
run_testMethod · 0.72
run_testMethod · 0.72