This reverts commit c45655413d.
			
			
This commit is contained in:
		
							parent
							
								
									c45655413d
								
							
						
					
					
						commit
						ae297f14ee
					
				|  | @ -13,9 +13,6 @@ ONNF modified this script to import ONNX specifications into ONNF. There are two | ||||||
| 5. copy the two file into your ONNF: cp onnxop.inc your_ONNF/src/dialect/onnx/onnxop.inc; cp op_build_table.inc your_ONNF/src/builder | 5. copy the two file into your ONNF: cp onnxop.inc your_ONNF/src/dialect/onnx/onnxop.inc; cp op_build_table.inc your_ONNF/src/builder | ||||||
| 6. go to your ONNF and build | 6. go to your ONNF and build | ||||||
| 
 | 
 | ||||||
| ## Consistency |  | ||||||
| The Operators.md generated by gen_doc.py is copied into doc. Please refer to this specification, not the one in onnx github, to make sure operators are consistent in version with onnxop.inc. |  | ||||||
| 
 |  | ||||||
| ## Customization | ## Customization | ||||||
| In addition to following the ONNF specification, the modified gen_doc.py provides some mechanism for you to customize the output.  | In addition to following the ONNF specification, the modified gen_doc.py provides some mechanism for you to customize the output.  | ||||||
| Several tables are defined at the beginning of the script: | Several tables are defined at the beginning of the script: | ||||||
|  |  | ||||||
							
								
								
									
										18969
									
								
								doc/Operators.md
								
								
								
								
							
							
						
						
									
										18969
									
								
								doc/Operators.md
								
								
								
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -44,15 +44,7 @@ class Directive(object): | ||||||
|         :param directive_config: a list used to output parsed directive configuration. |         :param directive_config: a list used to output parsed directive configuration. | ||||||
|         :return: parse result. |         :return: parse result. | ||||||
|         """ |         """ | ||||||
|         try: |         line = ctx.doc_file.next_non_empty_line() | ||||||
|             line = ctx.doc_file.next_non_empty_line() |  | ||||||
|         except RuntimeError as e: |  | ||||||
|             # Do not raise exception when next non-empty line |  | ||||||
|             # does not exist. Instead, return failure. |  | ||||||
|             if str(e) != "Enf of file.": |  | ||||||
|                 raise |  | ||||||
|             return failure() |  | ||||||
| 
 |  | ||||||
|         matches = self.ext_to_patterns[ctx.doc_file_ext()].findall(line) |         matches = self.ext_to_patterns[ctx.doc_file_ext()].findall(line) | ||||||
|         if len(matches) > 1: |         if len(matches) > 1: | ||||||
|             raise ValueError("more than one directives in a line") |             raise ValueError("more than one directives in a line") | ||||||
|  |  | ||||||
|  | @ -120,11 +120,6 @@ def display_version_link(name, version):  # type: (Text, int) -> Text | ||||||
|     name_with_ver = '{}-{}'.format(name, version) |     name_with_ver = '{}-{}'.format(name, version) | ||||||
|     return '<a href="{}#{}">{}</a>'.format(changelog_md, name_with_ver, name_with_ver) |     return '<a href="{}#{}">{}</a>'.format(changelog_md, name_with_ver, name_with_ver) | ||||||
| 
 | 
 | ||||||
| def get_unique_output_name(schema, name): |  | ||||||
|     for input in schema.inputs : |  | ||||||
|         if input.name == name : |  | ||||||
|             return 'out_'+name |  | ||||||
|     return name |  | ||||||
| 
 | 
 | ||||||
| def display_schema(schema, versions):  # type: (OpSchema, Sequence[OpSchema]) -> Text | def display_schema(schema, versions):  # type: (OpSchema, Sequence[OpSchema]) -> Text | ||||||
|     s = '' |     s = '' | ||||||
|  | @ -228,7 +223,7 @@ def display_schema(schema, versions):  # type: (OpSchema, Sequence[OpSchema]) -> | ||||||
|                     option_str = " (variadic)" |                     option_str = " (variadic)" | ||||||
|                 else: |                 else: | ||||||
|                     option_str = " (variadic, heterogeneous)" |                     option_str = " (variadic, heterogeneous)" | ||||||
|             s += '<dt><tt>{}</tt>{} : {}</dt>\n'.format(get_unique_output_name(schema, output.name), option_str, output.typeStr) |             s += '<dt><tt>{}</tt>{} : {}</dt>\n'.format(output.name, option_str, output.typeStr) | ||||||
|             s += '<dd>{}</dd>\n'.format(output.description) |             s += '<dd>{}</dd>\n'.format(output.description) | ||||||
|         s += '</dl>\n' |         s += '</dl>\n' | ||||||
| 
 | 
 | ||||||
|  | @ -307,6 +302,7 @@ def  collect_types(schema, input) : | ||||||
|     return allowedTypeStr |     return allowedTypeStr | ||||||
| 
 | 
 | ||||||
| def gen_schema(schema) : | def gen_schema(schema) : | ||||||
|  |     skip_attr_gen = [] | ||||||
|     line_indent = '  ' |     line_indent = '  ' | ||||||
| 
 | 
 | ||||||
|     #s = 'def ONNX'+schema.name+str(schema.since_version)+'Op:ONNX_Op<"'+schema.name+'", \n' |     #s = 'def ONNX'+schema.name+str(schema.since_version)+'Op:ONNX_Op<"'+schema.name+'", \n' | ||||||
|  | @ -372,7 +368,8 @@ def gen_schema(schema) : | ||||||
|                     #TODO handle  (variadic, heterogeneous)" |                     #TODO handle  (variadic, heterogeneous)" | ||||||
|                     t='' |                     t='' | ||||||
|             s+=':$'+input.name |             s+=':$'+input.name | ||||||
|     s += gen_attr_ins(schema, isfirst) |     if not schema.name in skip_attr_gen : | ||||||
|  |         s += gen_attr_ins(schema, isfirst) | ||||||
|     s+= ');' |     s+= ');' | ||||||
| 
 | 
 | ||||||
|     #output |     #output | ||||||
|  | @ -380,14 +377,14 @@ def gen_schema(schema) : | ||||||
|     if schema.outputs: |     if schema.outputs: | ||||||
|         for output in schema.outputs: |         for output in schema.outputs: | ||||||
|             if output != schema.outputs[0] : |             if output != schema.outputs[0] : | ||||||
|                 s+= ',\n           ' |                 s+= ', ' | ||||||
|             #need to interpret output.typeStr |             #need to interpret output.typeStr | ||||||
|             etypes=collect_types(schema, output) |             etypes=collect_types(schema, output) | ||||||
|             if etypes == '': |             if etypes == '': | ||||||
|                 s+= 'AnyTypeOf<[AnyMemRef, AnyTensor]>' |                 s+= 'AnyTypeOf<[AnyMemRef, AnyTensor]>' | ||||||
|             else: |             else: | ||||||
|                 s+= 'TensorOf<['+etypes+']>' |                 s+= 'TensorOf<['+etypes+']>' | ||||||
|             s += ':$'+get_unique_output_name(schema, output.name) |             s += ':$o_'+output.name | ||||||
|     s+= ');\n' |     s+= ');\n' | ||||||
| 
 | 
 | ||||||
|     #s+= 'let hasCanonicalizer = 1;' |     #s+= 'let hasCanonicalizer = 1;' | ||||||
|  |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue