diff --git a/graph_net/paddle/__init__.py b/graph_net/paddle/__init__.py new file mode 100644 index 0000000..8e74c76 --- /dev/null +++ b/graph_net/paddle/__init__.py @@ -0,0 +1,8 @@ +""" +GraphNet Paddle Implementation +""" + +from .samples_util import get_default_samples_directory + + +__all__ = ["get_default_samples_directory"] diff --git a/graph_net/paddle/check_redundant_incrementally.py b/graph_net/paddle/check_redundant_incrementally.py new file mode 100644 index 0000000..256cb34 --- /dev/null +++ b/graph_net/paddle/check_redundant_incrementally.py @@ -0,0 +1,84 @@ +from . import utils +import argparse +import importlib.util +import inspect +from pathlib import Path +from typing import Type, Any +import sys +import os +import os.path +from dataclasses import dataclass +from contextlib import contextmanager +import time +import glob + + +def get_recursively_model_pathes(root_dir): + for sub_dir in _get_recursively_model_pathes(root_dir): + yield os.path.realpath(sub_dir) + + +def _get_recursively_model_pathes(root_dir): + if is_single_model_dir(root_dir): + yield root_dir + return + for sub_dir in get_immediate_subdirectory_paths(root_dir): + if is_single_model_dir(sub_dir): + yield sub_dir + else: + yield from get_recursively_model_pathes(sub_dir) + + +def get_immediate_subdirectory_paths(parent_dir): + return [ + sub_dir + for name in os.listdir(parent_dir) + for sub_dir in [os.path.join(parent_dir, name)] + if os.path.isdir(sub_dir) + ] + + +def is_single_model_dir(model_dir): + return os.path.isfile(f"{model_dir}/graph_net.json") + + +def main(args): + assert os.path.isdir(args.model_path) + assert os.path.isdir(args.graph_net_samples_path) + current_model_graph_hash_pathes = set( + graph_hash_path + for model_path in get_recursively_model_pathes(args.model_path) + for graph_hash_path in [f"{model_path}/graph_hash.txt"] + ) + graph_hash2graph_net_model_path = { + graph_hash: graph_hash_path + for model_path in get_recursively_model_pathes(args.graph_net_samples_path) + for graph_hash_path in [f"{model_path}/graph_hash.txt"] + if os.path.isfile(graph_hash_path) + if graph_hash_path not in current_model_graph_hash_pathes + for graph_hash in [open(graph_hash_path).read()] + } + for current_model_graph_hash_path in current_model_graph_hash_pathes: + graph_hash = open(current_model_graph_hash_path).read() + assert ( + graph_hash not in graph_hash2graph_net_model_path + ), f"Redundant models detected. old-model-path:{current_model_graph_hash_path}, new-model-path:{graph_hash2graph_net_model_path[graph_hash]}." + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Test compiler performance.") + parser.add_argument( + "--model-path", + type=str, + required=True, + help="Path to model file(s), each subdirectory containing graph_net.json will be regarded as a model", + ) + parser.add_argument( + "--graph-net-samples-path", + type=str, + required=False, + default="default", + help="Path to GraphNet samples", + ) + args = parser.parse_args() + main(args=args) diff --git a/graph_net/paddle/remove_redundant_incrementally.py b/graph_net/paddle/remove_redundant_incrementally.py new file mode 100644 index 0000000..dcbd455 --- /dev/null +++ b/graph_net/paddle/remove_redundant_incrementally.py @@ -0,0 +1,87 @@ +from . import utils +import argparse +import importlib.util +import inspect +from pathlib import Path +from typing import Type, Any +import sys +import os +import os.path +from dataclasses import dataclass +from contextlib import contextmanager +import time +import glob +import shutil + + +def get_recursively_model_pathes(root_dir): + for sub_dir in _get_recursively_model_pathes(root_dir): + yield os.path.realpath(sub_dir) + + +def _get_recursively_model_pathes(root_dir): + if is_single_model_dir(root_dir): + yield root_dir + return + for sub_dir in get_immediate_subdirectory_paths(root_dir): + if is_single_model_dir(sub_dir): + yield sub_dir + else: + yield from get_recursively_model_pathes(sub_dir) + + +def get_immediate_subdirectory_paths(parent_dir): + return [ + sub_dir + for name in os.listdir(parent_dir) + for sub_dir in [os.path.join(parent_dir, name)] + if os.path.isdir(sub_dir) + ] + + +def is_single_model_dir(model_dir): + return os.path.isfile(f"{model_dir}/graph_net.json") + + +def main(args): + assert os.path.isdir(args.model_path) + assert os.path.isdir(args.graph_net_samples_path) + current_model_graph_hash_pathes = set( + graph_hash_path + for model_path in get_recursively_model_pathes(args.model_path) + for graph_hash_path in [f"{model_path}/graph_hash.txt"] + ) + graph_hash2graph_net_model_path = { + graph_hash: graph_hash_path + for model_path in get_recursively_model_pathes(args.graph_net_samples_path) + for graph_hash_path in [f"{model_path}/graph_hash.txt"] + if os.path.isfile(graph_hash_path) + if graph_hash_path not in current_model_graph_hash_pathes + for graph_hash in [open(graph_hash_path).read()] + } + for current_model_graph_hash_path in current_model_graph_hash_pathes: + graph_hash = open(current_model_graph_hash_path).read() + if graph_hash not in graph_hash2graph_net_model_path: + continue + directory = os.path.dirname(current_model_graph_hash_path) + shutil.rmtree(directory) + os.makedirs(directory, exist_ok=True) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Test compiler performance.") + parser.add_argument( + "--model-path", + type=str, + required=True, + help="Path to model file(s), each subdirectory containing graph_net.json will be regarded as a model", + ) + parser.add_argument( + "--graph-net-samples-path", + type=str, + required=False, + default="default", + help="Path to GraphNet samples", + ) + args = parser.parse_args() + main(args=args) diff --git a/graph_net/paddle/samples_util.py b/graph_net/paddle/samples_util.py new file mode 100644 index 0000000..a6b7870 --- /dev/null +++ b/graph_net/paddle/samples_util.py @@ -0,0 +1,6 @@ +import graph_net +import os + + +def get_default_samples_directory(): + return f"{os.path.dirname(graph_net.__file__)}/../samples" diff --git a/graph_net/paddle/test_compiler.py b/graph_net/paddle/test_compiler.py new file mode 100644 index 0000000..84d96f5 --- /dev/null +++ b/graph_net/paddle/test_compiler.py @@ -0,0 +1,250 @@ +from . import utils +import argparse +import importlib.util +import inspect +import paddle +from pathlib import Path +from typing import Type, Any +import sys +import os +import os.path +from dataclasses import dataclass +from contextlib import contextmanager +import time +import numpy as np + + +def load_class_from_file(file_path: str, class_name: str): + file = Path(file_path).resolve() + module_name = file.stem + + with open(file_path, "r", encoding="utf-8") as f: + original_code = f.read() + import_stmt = "import paddle" + modified_code = f"{import_stmt}\n{original_code}" + spec = importlib.util.spec_from_loader(module_name, loader=None) + module = importlib.util.module_from_spec(spec) + sys.modules[module_name] = module + compiled_code = compile(modified_code, filename=file, mode="exec") + exec(compiled_code, module.__dict__) + + model_class = getattr(module, class_name, None) + return model_class + + +def get_synchronizer_func(args): + assert args.compiler == "default" + return paddle.device.synchronize + + +def get_model(args): + model_class = load_class_from_file( + f"{args.model_path}/model.py", class_name="GraphModule" + ) + return model_class() + + +def get_input_dict(args): + inputs_params = utils.load_converted_from_text(f"{args.model_path}") + params = inputs_params["weight_info"] + inputs = inputs_params["input_info"] + + params.update(inputs) + state_dict = {k: utils.replay_tensor(v) for k, v in params.items()} + return state_dict + + +@dataclass +class DurationBox: + value: int + + +@contextmanager +def naive_timer(duration_box, get_synchronizer_func): + get_synchronizer_func() + start = time.time() + yield + get_synchronizer_func() + end = time.time() + duration_box.value = end - start + + +def get_input_spec(args): + inputs_params_list = utils.load_converted_list_from_text(f"{args.model_path}") + input_spec = [None] * len(inputs_params_list) + for i, v in enumerate(inputs_params_list): + dtype = v["info"]["dtype"] + shape = v["info"]["shape"] + input_spec[i] = paddle.static.InputSpec(shape, dtype) + return input_spec + + +def test_single_model(args): + synchronizer_func = get_synchronizer_func(args) + input_dict = get_input_dict(args) + model_dy = get_model(args) + input_spec = get_input_spec(args) + build_strategy = paddle.static.BuildStrategy() + build_strategy.build_cinn_pass = False + + # eager + model = paddle.jit.to_static( + model_dy, + full_graph=False, + ) + model.eval() + for _ in range(args.warmup if args.warmup > 0 else 0): + model(**input_dict) + eager_duration_box = DurationBox(-1) + with naive_timer(eager_duration_box, synchronizer_func): + expected_out = model(**input_dict) + + # compiled + build_strategy = paddle.static.BuildStrategy() + build_strategy.build_cinn_pass = True + compiled_model = paddle.jit.to_static( + model_dy, + input_spec=input_spec, + build_strategy=build_strategy, + full_graph=True, + ) + compiled_model.eval() + for _ in range(args.warmup if args.warmup > 0 else 0): + compiled_model(**input_dict) + compiled_duration_box = DurationBox(-1) + with naive_timer(compiled_duration_box, synchronizer_func): + compiled_out = compiled_model(**input_dict) + expected_out = expected_out.numpy() + compiled_out = compiled_out.numpy() + + def print_cmp(key, func, **kwargs): + cmp_ret = func(expected_out, compiled_out, **kwargs) + print( + f"{args.log_prompt} {key} model_path:{args.model_path} {cmp_ret}", + file=sys.stderr, + ) + + print_cmp("cmp.equal", get_cmp_equal) + print_cmp("cmp.all_close_atol8_rtol8", get_cmp_all_close, atol=1e-8, rtol=1e-8) + print_cmp("cmp.all_close_atol8_rtol5", get_cmp_all_close, atol=1e-8, rtol=1e-5) + print_cmp("cmp.all_close_atol5_rtol5", get_cmp_all_close, atol=1e-5, rtol=1e-5) + print_cmp("cmp.all_close_atol3_rtol2", get_cmp_all_close, atol=1e-3, rtol=1e-2) + print_cmp("cmp.all_close_atol2_rtol1", get_cmp_all_close, atol=1e-2, rtol=1e-1) + print_cmp("cmp.max_diff", get_cmp_max_diff) + print_cmp("cmp.mean_diff", get_cmp_mean_diff) + print_cmp("cmp.diff_count_atol8_rtol8", get_cmp_diff_count, atol=1e-8, rtol=1e-8) + print_cmp("cmp.diff_count_atol8_rtol5", get_cmp_diff_count, atol=1e-8, rtol=1e-5) + print_cmp("cmp.diff_count_atol5_rtol5", get_cmp_diff_count, atol=1e-5, rtol=1e-5) + print_cmp("cmp.diff_count_atol3_rtol2", get_cmp_diff_count, atol=1e-3, rtol=1e-2) + print_cmp("cmp.diff_count_atol2_rtol1", get_cmp_diff_count, atol=1e-2, rtol=1e-1) + + print( + f"{args.log_prompt} duration model_path:{args.model_path} eager:{eager_duration_box.value} compiled:{compiled_duration_box.value}", + file=sys.stderr, + ) + + +def get_cmp_equal(expected_out, compiled_out): + return " ".join( + str(int(np.sum(np.equal(a, b)))) for a, b in zip(expected_out, compiled_out) + ) + + +def get_cmp_all_close(expected_out, compiled_out, atol, rtol): + return " ".join( + str(int(np.allclose(a, b, atol=atol, rtol=rtol))) + for a, b in zip(expected_out, compiled_out) + ) + + +def get_cmp_max_diff(expected_out, compiled_out): + return " ".join( + str(np.max(np.abs(a - b)).item()) for a, b in zip(expected_out, compiled_out) + ) + + +def get_cmp_mean_diff(expected_out, compiled_out): + return " ".join( + str(np.mean(np.abs(a - b)).item()) for a, b in zip(expected_out, compiled_out) + ) + + +def get_cmp_diff_count(expected_out, compiled_out, atol, rtol): + return " ".join( + str(np.sum(~np.isclose(a, b, atol=atol, rtol=rtol)).item()) + for a, b in zip(expected_out, compiled_out) + ) + + +def test_multi_models(args): + for model_path in get_recursively_model_path(args.model_path): + cmd = "".join( + [ + sys.executable, + "-m graph_net.paddle.test_compiler", + f"--model-path {model_path}", + f"--compiler {args.compiler}", + f"--warmup {args.warmup}", + f"--log-prompt {args.log_prompt}", + ] + ) + cmd_ret = os.system(cmd) + assert cmd_ret == 0, f"{cmd_ret=}, {cmd=}" + + +def get_recursively_model_path(root_dir): + for sub_dir in get_immediate_subdirectory_paths(root_dir): + if is_single_model_dir(sub_dir): + yield sub_dir + else: + yield from get_recursively_model_path(sub_dir) + + +def get_immediate_subdirectory_paths(parent_dir): + return [ + sub_dir + for name in os.listdir(parent_dir) + for sub_dir in [os.path.join(parent_dir, name)] + if os.path.isdir(sub_dir) + ] + + +def is_single_model_dir(model_dir): + return os.path.isfile(f"{model_dir}/graph_net.json") + + +def main(args): + assert os.path.isdir(args.model_path) + if is_single_model_dir(args.model_path): + test_single_model(args) + else: + test_multi_models(args) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Test compiler performance.") + parser.add_argument( + "--model-path", + type=str, + required=True, + help="Path to model file(s), each subdirectory containing graph_net.json will be regarded as a model", + ) + parser.add_argument( + "--compiler", + type=str, + required=False, + default="default", + help="Path to customized compiler python file", + ) + parser.add_argument( + "--warmup", type=int, required=False, default=5, help="Number of warmup steps" + ) + parser.add_argument( + "--log-prompt", + type=str, + required=False, + default="graph-net-test-compiler-log", + help="Log prompt for performance log filtering.", + ) + args = parser.parse_args() + main(args=args) diff --git a/graph_net/paddle/utils.py b/graph_net/paddle/utils.py new file mode 100644 index 0000000..f33c39f --- /dev/null +++ b/graph_net/paddle/utils.py @@ -0,0 +1,173 @@ +import re +from collections import OrderedDict +import uuid +import json +import os +import argparse +import importlib +import inspect +import paddle + + +def get_limited_precision_float_str(value): + if not isinstance(value, float): + return value + return f"{value:.3f}" + + +def convert_state_and_inputs_impl(state_dict, example_inputs): + def tensor_info(tensor): + is_float = tensor.dtype.is_floating_point + mean = float(tensor.mean().item()) if is_float else None + std = float(tensor.std().item()) if is_float else None + return { + "shape": list(tensor.shape), + "dtype": str(tensor.dtype), + "device": str(tensor.device), + "mean": get_limited_precision_float_str(mean), + "std": get_limited_precision_float_str(std), + } + + def process_tensor(tensor): + if not isinstance(tensor, paddle.Tensor): + return {"type": "unknown", "value": tensor} + + info = tensor_info(tensor) + if tensor.dtype in [paddle.int8, paddle.int16, paddle.int32, paddle.int64]: + if tensor.numel() < 1024: + return { + "type": "small_int_tensor", + "data": tensor.clone(), + "info": info, + } + else: + return {"type": "big_int_tensor", "data": tensor.clone(), "info": info} + elif tensor.numel() < 1024: + return {"type": "small_tensor", "data": tensor.clone(), "info": info} + else: + return {"type": "random_tensor", "info": info} + + if isinstance(example_inputs, paddle.Tensor): + processed_inputs = process_tensor(example_inputs) + elif isinstance(example_inputs, (list, tuple)): + processed_inputs = [process_tensor(t) for t in example_inputs] + else: + processed_inputs = {"type": "unknown", "value": example_inputs} + + def handle_named_tensors(tensor): + data_value = None + data_type = "random_tensor" + if tensor.dtype in [paddle.int8, paddle.int16, paddle.int32, paddle.int64]: + if tensor.numel() < 1024: + data_type = "small_int_tensor" + data_value = tensor.clone() + else: + data_type = "big_int_tensor" + info = tensor_info(tensor) + return {"info": info, "data": data_value, "type": data_type} + + processed_weights = { + key: handle_named_tensors(tensor) for key, tensor in state_dict.items() + } + + # dynamic_shapes = extract_dynamic_shapes(example_inputs) + return { + "input_info": processed_inputs, + "weight_info": processed_weights, + "dynamic_shapes": None, + } + + +def convert_state_and_inputs(state_dict, example_inputs): + return convert_state_and_inputs_impl(state_dict, example_inputs) + + +def save_constraints_text(converted, file_path): + lines = [] + if converted["dynamic_shapes"] is not None: + raise NotImplementedError("Handling constraints is not implemented yet.") + with open(file_path, "w") as f: + f.write("\n".join(lines)) + + +def load_converted_from_text(file_path): + input_info = { + data["name"]: data + for data in convert_meta_classes_to_tensors(f"{file_path}/input_meta.py") + } + + weight_info = { + data["name"]: data + for data in convert_meta_classes_to_tensors(f"{file_path}/weight_meta.py") + } + + return { + "input_info": input_info, + "weight_info": weight_info, + "dynamic_shapes": None, + } + + +def load_converted_list_from_text(file_path): + input_info = [ + data for data in convert_meta_classes_to_tensors(f"{file_path}/input_meta.py") + ] + weight_info = [ + data for data in convert_meta_classes_to_tensors(f"{file_path}/weight_meta.py") + ] + + return [*input_info, *weight_info] + + +def convert_meta_classes_to_tensors(file_path): + for name, cls in _get_classes(file_path): + attrs = { + k: v + for k, v in cls.__dict__.items() + if not k.startswith("__") and not callable(v) + } + data_value = None + data_type = getattr(paddle, attrs.get("dtype", "paddle.float").split(".")[-1]) + if attrs.get("data") is not None: + if isinstance(attrs.get("data"), str): + raise ValueError("Unimplemented") + else: + data_value = paddle.tensor(attrs["data"], dtype=data_type).reshape( + attrs.get("shape"), [] + ) + yield { + "info": { + "shape": attrs.get("shape", []), + "dtype": data_type, + "device": attrs.get("device", "gpu"), + "mean": attrs.get("mean", 0.0), + "std": attrs.get("std", 1.0), + }, + "data": data_value, + "name": attrs.get("name"), + } + + +def _get_classes(file_path): + spec = importlib.util.spec_from_file_location("unnamed", file_path) + unnamed = importlib.util.module_from_spec(spec) + spec.loader.exec_module(unnamed) + yield from inspect.getmembers(unnamed, inspect.isclass) + + +def extract_dynamic_shapes(example_inputs): + pass + + +def replay_tensor(info): + device = info["info"]["device"] + dtype = info["info"]["dtype"] + shape = info["info"]["shape"] + if None in shape: + shape = list(map(lambda i: i if i is not None else 1, shape)) + mean = info["info"]["mean"] + std = info["info"]["std"] + if "data" in info and info["data"] is not None: + return info["data"].to(device) + + return paddle.randn(shape).to(dtype).to(device) * std * 1e-3 + 1e-2 diff --git a/graph_net/paddle/validate.py b/graph_net/paddle/validate.py new file mode 100644 index 0000000..e538399 --- /dev/null +++ b/graph_net/paddle/validate.py @@ -0,0 +1,117 @@ +from . import utils +import argparse +import importlib.util +import inspect +from pathlib import Path +from typing import Type, Any +import sys +import hashlib +from contextlib import contextmanager +from collections import ChainMap +import numpy as np +import graph_net +import os +import re + + +def load_class_from_file(file_path: str, class_name: str): + spec = importlib.util.spec_from_file_location("unnamed", file_path) + unnamed = importlib.util.module_from_spec(spec) + spec.loader.exec_module(unnamed) + model_class = getattr(unnamed, class_name, None) + return model_class + + +def _get_sha_hash(content): + m = hashlib.sha256() + m.update(content.encode()) + return m.hexdigest() + + +def _save_to_model_path(dump_dir, hash_text): + file_path = f"{dump_dir}/graph_hash.txt" + with open(file_path, "w") as f: + f.write(hash_text) + + +def extract_from_forward_regex(text, case_sensitive=True): + pattern = r"forward.*" + flags = 0 if case_sensitive else re.IGNORECASE + + match = re.search(pattern, text, flags) + if match: + return match.group(0) + else: + raise ValueError("Erroneous case occurs.") + + +def main(args): + model_path = args.model_path + with open(f"{model_path}/model.py", "r") as fp: + model_str = fp.read() + model_str = extract_from_forward_regex(model_str) + _save_to_model_path(model_path, _get_sha_hash(model_str)) + + model_path = args.model_path + model_class = load_class_from_file( + f"{model_path}/model.py", class_name="GraphModule" + ) + assert model_class is not None + model = model_class() + inputs_params = utils.load_converted_from_text(f"{model_path}") + params = inputs_params["weight_info"] + inputs = inputs_params["input_info"] + + params.update(inputs) + state_dict = {k: utils.replay_tensor(v) for k, v in params.items()} + + y = model(**state_dict)[0] + + print(np.argmin(y), np.argmax(y)) + print(y.shape) + + if not args.no_check_redundancy: + print("Check redundancy ...") + graph_net_samples_path = ( + graph_net.paddle.samples_util.get_default_samples_directory() + ) + cmd = f"{sys.executable} -m graph_net.paddle.check_redundant_incrementally --model-path {args.model_path} --graph-net-samples-path {graph_net_samples_path}" + cmd_ret = os.system(cmd) + rm_cmd = f"{sys.executable} -m graph_net.paddle.remove_redundant_incrementally --model-path {args.model_path} --graph-net-samples-path {graph_net_samples_path}" + assert ( + cmd_ret == 0 + ), f"\nPlease use the following command to remove redundant model directories:\n\n{rm_cmd}\n" + + print(f"Validation success, {model_path=}") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="load and run model") + parser.add_argument( + "--model-path", + type=str, + required=True, + help="Path to folder e.g '../test_dataset'", + ) + + parser.add_argument( + "--no-check-redundancy", + action="store_true", + help="whether check model graph redundancy", + ) + + parser.add_argument( + "--dump-graph-hash-key", + action="store_true", + default=False, + help="Dump graph hash key", + ) + parser.add_argument( + "--graph-net-samples-path", + type=str, + required=False, + default=None, + help="Path to GraphNet samples folder. e.g '../../samples'", + ) + args = parser.parse_args() + main(args=args) diff --git a/samples/paddle/resnet18/graph_hash.txt b/samples/paddle/resnet18/graph_hash.txt new file mode 100644 index 0000000..0ec1a3e --- /dev/null +++ b/samples/paddle/resnet18/graph_hash.txt @@ -0,0 +1 @@ +fe7c7917d1c3fe991d6a27720ebfa0b640695dd578d61f744b9da836eb8289a3 \ No newline at end of file diff --git a/samples/paddle/resnet18/graph_net.json b/samples/paddle/resnet18/graph_net.json new file mode 100644 index 0000000..368ac6f --- /dev/null +++ b/samples/paddle/resnet18/graph_net.json @@ -0,0 +1,5 @@ +{ + "framework": "paddle", + "num_devices_required": 1, + "num_nodes_required": 1 +} \ No newline at end of file diff --git a/samples/paddle/resnet18/input_meta.py b/samples/paddle/resnet18/input_meta.py new file mode 100644 index 0000000..025b748 --- /dev/null +++ b/samples/paddle/resnet18/input_meta.py @@ -0,0 +1,5 @@ +class Program_weight_tensor_data_0: + name = "input0" + shape = [None, 3, 224, 224] + dtype = "float32" + data = None diff --git a/samples/paddle/resnet18/model.py b/samples/paddle/resnet18/model.py new file mode 100644 index 0000000..4c05cf5 --- /dev/null +++ b/samples/paddle/resnet18/model.py @@ -0,0 +1,831 @@ +import paddle + + +class GraphModule(paddle.nn.Layer): + def __init__(self): + super().__init__() + + def forward( + self, + input0: paddle.Tensor, + t0: paddle.Tensor, + t1: paddle.Tensor, + t2: paddle.Tensor, + t3: paddle.Tensor, + t4: paddle.Tensor, + t5: paddle.Tensor, + t6: paddle.Tensor, + t7: paddle.Tensor, + t8: paddle.Tensor, + t9: paddle.Tensor, + t10: paddle.Tensor, + t11: paddle.Tensor, + t12: paddle.Tensor, + t13: paddle.Tensor, + t14: paddle.Tensor, + t15: paddle.Tensor, + t16: paddle.Tensor, + t17: paddle.Tensor, + t18: paddle.Tensor, + t19: paddle.Tensor, + t20: paddle.Tensor, + t21: paddle.Tensor, + t22: paddle.Tensor, + t23: paddle.Tensor, + t24: paddle.Tensor, + t25: paddle.Tensor, + t26: paddle.Tensor, + t27: paddle.Tensor, + t28: paddle.Tensor, + t29: paddle.Tensor, + t30: paddle.Tensor, + t31: paddle.Tensor, + t32: paddle.Tensor, + t33: paddle.Tensor, + t34: paddle.Tensor, + t35: paddle.Tensor, + t36: paddle.Tensor, + t37: paddle.Tensor, + t38: paddle.Tensor, + t39: paddle.Tensor, + t40: paddle.Tensor, + t41: paddle.Tensor, + t42: paddle.Tensor, + t43: paddle.Tensor, + t44: paddle.Tensor, + t45: paddle.Tensor, + t46: paddle.Tensor, + t47: paddle.Tensor, + t48: paddle.Tensor, + t49: paddle.Tensor, + t50: paddle.Tensor, + t51: paddle.Tensor, + t52: paddle.Tensor, + t53: paddle.Tensor, + t54: paddle.Tensor, + t55: paddle.Tensor, + t56: paddle.Tensor, + t57: paddle.Tensor, + t58: paddle.Tensor, + t59: paddle.Tensor, + t60: paddle.Tensor, + t61: paddle.Tensor, + t62: paddle.Tensor, + t63: paddle.Tensor, + t64: paddle.Tensor, + t65: paddle.Tensor, + t66: paddle.Tensor, + t67: paddle.Tensor, + t68: paddle.Tensor, + t69: paddle.Tensor, + t70: paddle.Tensor, + t71: paddle.Tensor, + t72: paddle.Tensor, + t73: paddle.Tensor, + t74: paddle.Tensor, + t75: paddle.Tensor, + t76: paddle.Tensor, + t77: paddle.Tensor, + t78: paddle.Tensor, + t79: paddle.Tensor, + t80: paddle.Tensor, + t81: paddle.Tensor, + t82: paddle.Tensor, + t83: paddle.Tensor, + t84: paddle.Tensor, + t85: paddle.Tensor, + t86: paddle.Tensor, + t87: paddle.Tensor, + t88: paddle.Tensor, + t89: paddle.Tensor, + t90: paddle.Tensor, + t91: paddle.Tensor, + t92: paddle.Tensor, + t93: paddle.Tensor, + t94: paddle.Tensor, + t95: paddle.Tensor, + t96: paddle.Tensor, + t97: paddle.Tensor, + t98: paddle.Tensor, + t99: paddle.Tensor, + t100: paddle.Tensor, + t101: paddle.Tensor, + t102: paddle.Tensor, + t103: paddle.Tensor, + t104: paddle.Tensor, + t105: paddle.Tensor, + ): + # pd_op.conv2d: (-1x64x112x112xf32) <- (-1x3x224x224xf32, 64x3x7x7xf32) + t106 = paddle._C_ops.conv2d( + input0, t0, [2, 2], [3, 3], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del input0, t0 + + # pd_op.batch_norm_: (-1x64x112x112xf32, 64xf32, 64xf32, 64xf32, 64xf32, -1xui8) <- (-1x64x112x112xf32, 64xf32, 64xf32, 64xf32, 64xf32) + t107, t108, t109, t110, t111, t112 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t106, + t1, + t2, + t3, + t4, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t106, t4, t3, t2, t1 + + # pd_op.relu: (-1x64x112x112xf32) <- (-1x64x112x112xf32) + t113 = paddle._C_ops.relu(t107) + del t107 + + # pd_op.full_int_array: (2xi64) <- () + t114 = [3, 3] + + # pd_op.pool2d: (-1x64x56x56xf32) <- (-1x64x112x112xf32, 2xi64) + t115 = paddle._C_ops.pool2d( + t113, + t114, + [2, 2], + [1, 1], + False, + True, + "NCHW", + "max", + False, + False, + "EXPLICIT", + ) + del t114, t113 + + # pd_op.conv2d: (-1x64x56x56xf32) <- (-1x64x56x56xf32, 64x64x3x3xf32) + t116 = paddle._C_ops.conv2d( + t115, t5, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t5 + + # pd_op.batch_norm_: (-1x64x56x56xf32, 64xf32, 64xf32, 64xf32, 64xf32, -1xui8) <- (-1x64x56x56xf32, 64xf32, 64xf32, 64xf32, 64xf32) + t117, t118, t119, t120, t121, t122 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t116, + t6, + t7, + t8, + t9, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t116, t6, t9, t8, t7 + + # pd_op.relu: (-1x64x56x56xf32) <- (-1x64x56x56xf32) + t123 = paddle._C_ops.relu(t117) + del t117 + + # pd_op.conv2d: (-1x64x56x56xf32) <- (-1x64x56x56xf32, 64x64x3x3xf32) + t124 = paddle._C_ops.conv2d( + t123, t10, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t10, t123 + + # pd_op.batch_norm_: (-1x64x56x56xf32, 64xf32, 64xf32, 64xf32, 64xf32, -1xui8) <- (-1x64x56x56xf32, 64xf32, 64xf32, 64xf32, 64xf32) + t125, t126, t127, t128, t129, t130 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t124, + t11, + t12, + t13, + t14, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t124, t14, t13, t12, t11 + + # pd_op.conv2d: (-1x64x56x56xf32) <- (-1x64x56x56xf32, 64x64x1x1xf32) + t131 = paddle._C_ops.conv2d( + t115, t15, [1, 1], [0, 0], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t15, t115 + + # pd_op.batch_norm_: (-1x64x56x56xf32, 64xf32, 64xf32, 64xf32, 64xf32, -1xui8) <- (-1x64x56x56xf32, 64xf32, 64xf32, 64xf32, 64xf32) + t132, t133, t134, t135, t136, t137 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t131, + t16, + t17, + t18, + t19, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t131, t19, t18, t17, t16 + + # pd_op.add: (-1x64x56x56xf32) <- (-1x64x56x56xf32, -1x64x56x56xf32) + t138 = paddle._C_ops.add(t125, t132) + del t125, t132 + + # pd_op.relu: (-1x64x56x56xf32) <- (-1x64x56x56xf32) + t139 = paddle._C_ops.relu(t138) + del t138 + + # pd_op.conv2d: (-1x64x56x56xf32) <- (-1x64x56x56xf32, 64x64x3x3xf32) + t140 = paddle._C_ops.conv2d( + t139, t20, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t20 + + # pd_op.batch_norm_: (-1x64x56x56xf32, 64xf32, 64xf32, 64xf32, 64xf32, -1xui8) <- (-1x64x56x56xf32, 64xf32, 64xf32, 64xf32, 64xf32) + t141, t142, t143, t144, t145, t146 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t140, + t21, + t22, + t23, + t24, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t140, t24, t23, t22, t21 + + # pd_op.relu: (-1x64x56x56xf32) <- (-1x64x56x56xf32) + t147 = paddle._C_ops.relu(t141) + del t141 + + # pd_op.conv2d: (-1x64x56x56xf32) <- (-1x64x56x56xf32, 64x64x3x3xf32) + t148 = paddle._C_ops.conv2d( + t147, t25, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t25, t147 + + # pd_op.batch_norm_: (-1x64x56x56xf32, 64xf32, 64xf32, 64xf32, 64xf32, -1xui8) <- (-1x64x56x56xf32, 64xf32, 64xf32, 64xf32, 64xf32) + t149, t150, t151, t152, t153, t154 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t148, + t26, + t27, + t28, + t29, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t148, t29, t28, t27, t26 + + # pd_op.add: (-1x64x56x56xf32) <- (-1x64x56x56xf32, -1x64x56x56xf32) + t155 = paddle._C_ops.add(t149, t139) + del t149, t139 + + # pd_op.relu: (-1x64x56x56xf32) <- (-1x64x56x56xf32) + t156 = paddle._C_ops.relu(t155) + del t155 + + # pd_op.conv2d: (-1x128x28x28xf32) <- (-1x64x56x56xf32, 128x64x3x3xf32) + t157 = paddle._C_ops.conv2d( + t156, t30, [2, 2], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t30 + + # pd_op.batch_norm_: (-1x128x28x28xf32, 128xf32, 128xf32, 128xf32, 128xf32, -1xui8) <- (-1x128x28x28xf32, 128xf32, 128xf32, 128xf32, 128xf32) + t158, t159, t160, t161, t162, t163 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t157, + t31, + t32, + t33, + t34, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t157, t34, t33, t32, t31 + + # pd_op.relu: (-1x128x28x28xf32) <- (-1x128x28x28xf32) + t164 = paddle._C_ops.relu(t158) + del t158 + + # pd_op.conv2d: (-1x128x28x28xf32) <- (-1x128x28x28xf32, 128x128x3x3xf32) + t165 = paddle._C_ops.conv2d( + t164, t35, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t35, t164 + + # pd_op.batch_norm_: (-1x128x28x28xf32, 128xf32, 128xf32, 128xf32, 128xf32, -1xui8) <- (-1x128x28x28xf32, 128xf32, 128xf32, 128xf32, 128xf32) + t166, t167, t168, t169, t170, t171 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t165, + t36, + t37, + t38, + t39, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t165, t39, t38, t37, t36 + + # pd_op.conv2d: (-1x128x28x28xf32) <- (-1x64x56x56xf32, 128x64x1x1xf32) + t172 = paddle._C_ops.conv2d( + t156, t40, [2, 2], [0, 0], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t40, t156 + + # pd_op.batch_norm_: (-1x128x28x28xf32, 128xf32, 128xf32, 128xf32, 128xf32, -1xui8) <- (-1x128x28x28xf32, 128xf32, 128xf32, 128xf32, 128xf32) + t173, t174, t175, t176, t177, t178 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t172, + t41, + t42, + t43, + t44, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t172, t44, t43, t42, t41 + + # pd_op.add: (-1x128x28x28xf32) <- (-1x128x28x28xf32, -1x128x28x28xf32) + t179 = paddle._C_ops.add(t166, t173) + del t166, t173 + + # pd_op.relu: (-1x128x28x28xf32) <- (-1x128x28x28xf32) + t180 = paddle._C_ops.relu(t179) + del t179 + + # pd_op.conv2d: (-1x128x28x28xf32) <- (-1x128x28x28xf32, 128x128x3x3xf32) + t181 = paddle._C_ops.conv2d( + t180, t45, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t45 + + # pd_op.batch_norm_: (-1x128x28x28xf32, 128xf32, 128xf32, 128xf32, 128xf32, -1xui8) <- (-1x128x28x28xf32, 128xf32, 128xf32, 128xf32, 128xf32) + t182, t183, t184, t185, t186, t187 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t181, + t46, + t47, + t48, + t49, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t181, t49, t48, t47, t46 + + # pd_op.relu: (-1x128x28x28xf32) <- (-1x128x28x28xf32) + t188 = paddle._C_ops.relu(t182) + del t182 + + # pd_op.conv2d: (-1x128x28x28xf32) <- (-1x128x28x28xf32, 128x128x3x3xf32) + t189 = paddle._C_ops.conv2d( + t188, t50, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t50, t188 + + # pd_op.batch_norm_: (-1x128x28x28xf32, 128xf32, 128xf32, 128xf32, 128xf32, -1xui8) <- (-1x128x28x28xf32, 128xf32, 128xf32, 128xf32, 128xf32) + t190, t191, t192, t193, t194, t195 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t189, + t51, + t52, + t53, + t54, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t189, t54, t53, t52, t51 + + # pd_op.add: (-1x128x28x28xf32) <- (-1x128x28x28xf32, -1x128x28x28xf32) + t196 = paddle._C_ops.add(t190, t180) + del t190, t180 + + # pd_op.relu: (-1x128x28x28xf32) <- (-1x128x28x28xf32) + t197 = paddle._C_ops.relu(t196) + del t196 + + # pd_op.conv2d: (-1x256x14x14xf32) <- (-1x128x28x28xf32, 256x128x3x3xf32) + t198 = paddle._C_ops.conv2d( + t197, t55, [2, 2], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t55 + + # pd_op.batch_norm_: (-1x256x14x14xf32, 256xf32, 256xf32, 256xf32, 256xf32, -1xui8) <- (-1x256x14x14xf32, 256xf32, 256xf32, 256xf32, 256xf32) + t199, t200, t201, t202, t203, t204 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t198, + t56, + t57, + t58, + t59, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t198, t59, t58, t57, t56 + + # pd_op.relu: (-1x256x14x14xf32) <- (-1x256x14x14xf32) + t205 = paddle._C_ops.relu(t199) + del t199 + + # pd_op.conv2d: (-1x256x14x14xf32) <- (-1x256x14x14xf32, 256x256x3x3xf32) + t206 = paddle._C_ops.conv2d( + t205, t60, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t60, t205 + + # pd_op.batch_norm_: (-1x256x14x14xf32, 256xf32, 256xf32, 256xf32, 256xf32, -1xui8) <- (-1x256x14x14xf32, 256xf32, 256xf32, 256xf32, 256xf32) + t207, t208, t209, t210, t211, t212 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t206, + t61, + t62, + t63, + t64, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t206, t64, t63, t62, t61 + + # pd_op.conv2d: (-1x256x14x14xf32) <- (-1x128x28x28xf32, 256x128x1x1xf32) + t213 = paddle._C_ops.conv2d( + t197, t65, [2, 2], [0, 0], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t65, t197 + + # pd_op.batch_norm_: (-1x256x14x14xf32, 256xf32, 256xf32, 256xf32, 256xf32, -1xui8) <- (-1x256x14x14xf32, 256xf32, 256xf32, 256xf32, 256xf32) + t214, t215, t216, t217, t218, t219 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t213, + t66, + t67, + t68, + t69, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t213, t69, t68, t67, t66 + + # pd_op.add: (-1x256x14x14xf32) <- (-1x256x14x14xf32, -1x256x14x14xf32) + t220 = paddle._C_ops.add(t207, t214) + del t207, t214 + + # pd_op.relu: (-1x256x14x14xf32) <- (-1x256x14x14xf32) + t221 = paddle._C_ops.relu(t220) + del t220 + + # pd_op.conv2d: (-1x256x14x14xf32) <- (-1x256x14x14xf32, 256x256x3x3xf32) + t222 = paddle._C_ops.conv2d( + t221, t70, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t70 + + # pd_op.batch_norm_: (-1x256x14x14xf32, 256xf32, 256xf32, 256xf32, 256xf32, -1xui8) <- (-1x256x14x14xf32, 256xf32, 256xf32, 256xf32, 256xf32) + t223, t224, t225, t226, t227, t228 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t222, + t71, + t72, + t73, + t74, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t222, t74, t73, t72, t71 + + # pd_op.relu: (-1x256x14x14xf32) <- (-1x256x14x14xf32) + t229 = paddle._C_ops.relu(t223) + del t223 + + # pd_op.conv2d: (-1x256x14x14xf32) <- (-1x256x14x14xf32, 256x256x3x3xf32) + t230 = paddle._C_ops.conv2d( + t229, t75, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t75, t229 + + # pd_op.batch_norm_: (-1x256x14x14xf32, 256xf32, 256xf32, 256xf32, 256xf32, -1xui8) <- (-1x256x14x14xf32, 256xf32, 256xf32, 256xf32, 256xf32) + t231, t232, t233, t234, t235, t236 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t230, + t76, + t77, + t78, + t79, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t230, t79, t78, t77, t76 + + # pd_op.add: (-1x256x14x14xf32) <- (-1x256x14x14xf32, -1x256x14x14xf32) + t237 = paddle._C_ops.add(t231, t221) + del t231, t221 + + # pd_op.relu: (-1x256x14x14xf32) <- (-1x256x14x14xf32) + t238 = paddle._C_ops.relu(t237) + del t237 + + # pd_op.conv2d: (-1x512x7x7xf32) <- (-1x256x14x14xf32, 512x256x3x3xf32) + t239 = paddle._C_ops.conv2d( + t238, t80, [2, 2], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t80 + + # pd_op.batch_norm_: (-1x512x7x7xf32, 512xf32, 512xf32, 512xf32, 512xf32, -1xui8) <- (-1x512x7x7xf32, 512xf32, 512xf32, 512xf32, 512xf32) + t240, t241, t242, t243, t244, t245 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t239, + t81, + t82, + t83, + t84, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t239, t84, t83, t82, t81 + + # pd_op.relu: (-1x512x7x7xf32) <- (-1x512x7x7xf32) + t246 = paddle._C_ops.relu(t240) + del t240 + + # pd_op.conv2d: (-1x512x7x7xf32) <- (-1x512x7x7xf32, 512x512x3x3xf32) + t247 = paddle._C_ops.conv2d( + t246, t85, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t85, t246 + + # pd_op.batch_norm_: (-1x512x7x7xf32, 512xf32, 512xf32, 512xf32, 512xf32, -1xui8) <- (-1x512x7x7xf32, 512xf32, 512xf32, 512xf32, 512xf32) + t248, t249, t250, t251, t252, t253 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t247, + t86, + t87, + t88, + t89, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t247, t89, t88, t87, t86 + + # pd_op.conv2d: (-1x512x7x7xf32) <- (-1x256x14x14xf32, 512x256x1x1xf32) + t254 = paddle._C_ops.conv2d( + t238, t90, [2, 2], [0, 0], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t90, t238 + + # pd_op.batch_norm_: (-1x512x7x7xf32, 512xf32, 512xf32, 512xf32, 512xf32, -1xui8) <- (-1x512x7x7xf32, 512xf32, 512xf32, 512xf32, 512xf32) + t255, t256, t257, t258, t259, t260 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t254, + t91, + t92, + t93, + t94, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t254, t94, t93, t92, t91 + + # pd_op.add: (-1x512x7x7xf32) <- (-1x512x7x7xf32, -1x512x7x7xf32) + t261 = paddle._C_ops.add(t248, t255) + del t248, t255 + + # pd_op.relu: (-1x512x7x7xf32) <- (-1x512x7x7xf32) + t262 = paddle._C_ops.relu(t261) + del t261 + + # pd_op.conv2d: (-1x512x7x7xf32) <- (-1x512x7x7xf32, 512x512x3x3xf32) + t263 = paddle._C_ops.conv2d( + t262, t95, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t95 + + # pd_op.batch_norm_: (-1x512x7x7xf32, 512xf32, 512xf32, 512xf32, 512xf32, -1xui8) <- (-1x512x7x7xf32, 512xf32, 512xf32, 512xf32, 512xf32) + t264, t265, t266, t267, t268, t269 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t263, + t96, + t97, + t98, + t99, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t263, t96, t99, t98, t97 + + # pd_op.relu: (-1x512x7x7xf32) <- (-1x512x7x7xf32) + t270 = paddle._C_ops.relu(t264) + del t264 + + # pd_op.conv2d: (-1x512x7x7xf32) <- (-1x512x7x7xf32, 512x512x3x3xf32) + t271 = paddle._C_ops.conv2d( + t270, t100, [1, 1], [1, 1], "EXPLICIT", [1, 1], 1, "NCHW" + ) + del t100, t270 + + # pd_op.batch_norm_: (-1x512x7x7xf32, 512xf32, 512xf32, 512xf32, 512xf32, -1xui8) <- (-1x512x7x7xf32, 512xf32, 512xf32, 512xf32, 512xf32) + t272, t273, t274, t275, t276, t277 = (lambda x, f: f(x))( + paddle._C_ops.batch_norm( + t271, + t101, + t102, + t103, + t104, + True, + float("0.9"), + float("1e-05"), + "NCHW", + False, + False, + ), + lambda out: out + if isinstance(out, (list, tuple)) + else (out, None, None, None, None, None), + ) + del t271, t104, t103, t102, t101 + + # pd_op.add: (-1x512x7x7xf32) <- (-1x512x7x7xf32, -1x512x7x7xf32) + t278 = paddle._C_ops.add(t272, t262) + del t272, t262 + + # pd_op.relu: (-1x512x7x7xf32) <- (-1x512x7x7xf32) + t279 = paddle._C_ops.relu(t278) + del t278 + + # pd_op.full_int_array: (2xi64) <- () + t280 = [1, 1] + + # pd_op.pool2d: (-1x512x1x1xf32) <- (-1x512x7x7xf32, 2xi64) + t281 = paddle._C_ops.pool2d( + t279, + t280, + [1, 1], + [0, 0], + False, + True, + "NCHW", + "avg", + False, + True, + "EXPLICIT", + ) + del t280, t279 + + # pd_op.flatten: (-1x512xf32) <- (-1x512x1x1xf32) + t282 = paddle._C_ops.flatten(t281, 1, 3) + del t281 + + # pd_op.matmul: (-1x102xf32) <- (-1x512xf32, 512x102xf32) + t283 = paddle._C_ops.matmul(t282, t105, False, False) + del t282, t105 + + return t283 diff --git a/samples/paddle/resnet18/weight_meta.py b/samples/paddle/resnet18/weight_meta.py new file mode 100644 index 0000000..24970b2 --- /dev/null +++ b/samples/paddle/resnet18/weight_meta.py @@ -0,0 +1,740 @@ +class Program_weight_tensor_parameter_106: + name = "t0" + shape = [64, 3, 7, 7] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_105: + name = "t1" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_104: + name = "t2" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_103: + name = "t3" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_102: + name = "t4" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_101: + name = "t5" + shape = [64, 64, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_100: + name = "t6" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_99: + name = "t7" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_98: + name = "t8" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_97: + name = "t9" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_96: + name = "t10" + shape = [64, 64, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_95: + name = "t11" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_94: + name = "t12" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_93: + name = "t13" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_92: + name = "t14" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_91: + name = "t15" + shape = [64, 64, 1, 1] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_90: + name = "t16" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_89: + name = "t17" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_88: + name = "t18" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_87: + name = "t19" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_86: + name = "t20" + shape = [64, 64, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_85: + name = "t21" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_84: + name = "t22" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_83: + name = "t23" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_82: + name = "t24" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_81: + name = "t25" + shape = [64, 64, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_80: + name = "t26" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_79: + name = "t27" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_78: + name = "t28" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_77: + name = "t29" + shape = [64] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_76: + name = "t30" + shape = [128, 64, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_75: + name = "t31" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_74: + name = "t32" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_73: + name = "t33" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_72: + name = "t34" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_71: + name = "t35" + shape = [128, 128, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_70: + name = "t36" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_69: + name = "t37" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_68: + name = "t38" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_67: + name = "t39" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_66: + name = "t40" + shape = [128, 64, 1, 1] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_65: + name = "t41" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_64: + name = "t42" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_63: + name = "t43" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_62: + name = "t44" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_61: + name = "t45" + shape = [128, 128, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_60: + name = "t46" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_59: + name = "t47" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_58: + name = "t48" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_57: + name = "t49" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_56: + name = "t50" + shape = [128, 128, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_55: + name = "t51" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_54: + name = "t52" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_53: + name = "t53" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_52: + name = "t54" + shape = [128] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_51: + name = "t55" + shape = [256, 128, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_50: + name = "t56" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_49: + name = "t57" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_48: + name = "t58" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_47: + name = "t59" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_46: + name = "t60" + shape = [256, 256, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_45: + name = "t61" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_44: + name = "t62" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_43: + name = "t63" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_42: + name = "t64" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_41: + name = "t65" + shape = [256, 128, 1, 1] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_40: + name = "t66" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_39: + name = "t67" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_38: + name = "t68" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_37: + name = "t69" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_36: + name = "t70" + shape = [256, 256, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_35: + name = "t71" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_34: + name = "t72" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_33: + name = "t73" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_32: + name = "t74" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_31: + name = "t75" + shape = [256, 256, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_30: + name = "t76" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_29: + name = "t77" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_28: + name = "t78" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_27: + name = "t79" + shape = [256] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_26: + name = "t80" + shape = [512, 256, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_25: + name = "t81" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_24: + name = "t82" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_23: + name = "t83" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_22: + name = "t84" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_21: + name = "t85" + shape = [512, 512, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_20: + name = "t86" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_19: + name = "t87" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_18: + name = "t88" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_17: + name = "t89" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_16: + name = "t90" + shape = [512, 256, 1, 1] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_15: + name = "t91" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_14: + name = "t92" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_13: + name = "t93" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_12: + name = "t94" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_11: + name = "t95" + shape = [512, 512, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_10: + name = "t96" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_9: + name = "t97" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_8: + name = "t98" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_7: + name = "t99" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_6: + name = "t100" + shape = [512, 512, 3, 3] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_5: + name = "t101" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_4: + name = "t102" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_3: + name = "t103" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_2: + name = "t104" + shape = [512] + dtype = "float32" + data = None + + +class Program_weight_tensor_parameter_1: + name = "t105" + shape = [512, 102] + dtype = "float32" + data = None