Skip to content

Commit

Permalink
Merge branch 'Tencent:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
inspireMeNow authored Jul 2, 2024
2 parents 4e60f22 + d264b63 commit 4db4e41
Show file tree
Hide file tree
Showing 11 changed files with 1,993 additions and 79 deletions.
4 changes: 4 additions & 0 deletions tools/pnnx/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ set(pnnx_pass_level2_SRCS
pass_level2/torch_fft_fftn.cpp

pass_level2/nn_quantized_FloatFunctional.cpp

pass_level2/nn_GRU.cpp
pass_level2/nn_LSTM.cpp
pass_level2/nn_RNN.cpp
)

set(pnnx_pass_level3_SRCS
Expand Down
80 changes: 8 additions & 72 deletions tools/pnnx/src/load_onnx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,85 +545,20 @@ int load_onnx(const std::string& onnxpath, Graph& pnnx_graph,

onnx2pnnx::ModelStat oldstat = onnx2pnnx::get_model_stat(model);

fprintf(stderr, "%-34s", "inline_containers ... ");
double t0 = 0;
double t1 = 0;

double t0 = get_current_time();
int inlined = 0;

onnx2pnnx::inline_containers(model);

double t1 = get_current_time();

fprintf(stderr, "%8.2fms\n", t1 - t0);

fprintf(stderr, "%-34s", "eliminate_noop ... ");

t0 = get_current_time();

onnx2pnnx::eliminate_noop(model);

t1 = get_current_time();

fprintf(stderr, "%8.2fms\n", t1 - t0);

fprintf(stderr, "%-34s", "fold_constants ... ");

t0 = get_current_time();

onnx2pnnx::fold_constants(model, input_shapes, input_types, input_shapes2, input_types2);

t1 = get_current_time();

fprintf(stderr, "%8.2fms\n", t1 - t0);

fprintf(stderr, "%-34s", "canonicalize ... ");

t0 = get_current_time();

onnx2pnnx::canonicalize(model);

t1 = get_current_time();

fprintf(stderr, "%8.2fms\n", t1 - t0);

fprintf(stderr, "%-34s", "shape_inference ... ");

t0 = get_current_time();

onnx2pnnx::shape_inference(model, input_shapes, input_types, input_shapes2, input_types2);

t1 = get_current_time();

fprintf(stderr, "%8.2fms\n", t1 - t0);

fprintf(stderr, "%-34s", "fold_constants_dynamic_shape ... ");

t0 = get_current_time();

onnx2pnnx::fold_constants_dynamic_shape(model, input_shapes, input_types);

t1 = get_current_time();

fprintf(stderr, "%8.2fms\n", t1 - t0);

fprintf(stderr, "%-34s", "inline_if_graph ... ");

t0 = get_current_time();

int inlined = onnx2pnnx::inline_if_graph(model);

t1 = get_current_time();

fprintf(stderr, "%8.2fms\n", t1 - t0);

while (inlined)
do
{
fprintf(stderr, "%-34s", "inline_containers ... ");

double t0 = get_current_time();
t0 = get_current_time();

onnx2pnnx::inline_containers(model);

double t1 = get_current_time();
t1 = get_current_time();

fprintf(stderr, "%8.2fms\n", t1 - t0);

Expand Down Expand Up @@ -686,7 +621,8 @@ int load_onnx(const std::string& onnxpath, Graph& pnnx_graph,
t1 = get_current_time();

fprintf(stderr, "%8.2fms\n", t1 - t0);
}

} while (inlined);

fprintf(stderr, "%-34s", "fuse_constant_as_attribute ... ");

Expand Down
Loading

0 comments on commit 4db4e41

Please sign in to comment.