def test_embed_layer_norm_fusion(self): onnx_files = [] for i in [3, 8, 9]: onnx_files.append(f"embed_layer_norm_format{i}.onnx") onnx_files.append(f"embed_layer_norm_format{i}_opset13.onnx") onnx_files.append('embed_layer_norm_format3_no_cast.onnx') onnx_files.append('embed_layer_norm_format3_no_cast_opset13.onnx') for file in onnx_files: input_model_path = get_fusion_test_model(file) model = optimize_model(input_model_path, 'bert') expected_node_count = {'EmbedLayerNormalization': 1, 'Attention': 1, 'ReduceSum': 0} self.verify_node_count(model, expected_node_count, file)
def _get_test_model_path(name): sub_dir, file = TEST_MODELS[name] if sub_dir == "FUSION": return get_fusion_test_model(file) else: return get_test_data_path(sub_dir, file)