@@ -53,6 +53,8 @@ class Opset:
53
53
Only a single instance of Opset is created for a given (domain, version) pair.
54
54
"""
55
55
56
+ domain : str
57
+ version : int
56
58
cache : dict [tuple [type , str , int ], Opset ] = {}
57
59
58
60
def __new__ (cls , domain : str , version : int ):
@@ -271,16 +273,13 @@ def __call__(self, *args, **kwargs):
271
273
# FIXME(after #225): Move import to the top of the file.
272
274
from onnxscript import evaluator # pylint: disable=import-outside-toplevel
273
275
274
- schema = self .get_schema ()
276
+ schema = self .opschema
275
277
if schema is None :
276
278
raise RuntimeError (
277
279
f"Op '{ self .name } ' does not have an OpSchema and cannot be evaluated."
278
280
)
279
281
return evaluator .default ().eval (schema , args , kwargs )
280
282
281
- def is_single_op (self ) -> bool :
282
- return isinstance (self .opname , str )
283
-
284
283
@property
285
284
def name (self ) -> str :
286
285
return self ._name
@@ -293,22 +292,16 @@ def opset(self) -> Opset:
293
292
def opschema (self ) -> Optional [onnx .defs .OpSchema ]:
294
293
return self ._opschema
295
294
296
- def get_schema (self ) -> Optional [onnx .defs .OpSchema ]:
297
- """Returns the ONNX OpSchema for this op."""
298
- if self .opschema is not None :
299
- return self .opschema
300
- return self .opset [self .opname ]
301
-
302
295
def has_schema (self ) -> bool :
303
296
"""Returns True if this op has an OpSchema."""
304
- return self .get_schema () is not None
297
+ return self .opschema is not None
305
298
306
299
def param_schemas (self ) -> Optional [tuple [ParamSchema , ...]]:
307
300
"""Returns the parameter schemas for this op, if it has one."""
308
301
if self ._param_schemas is not None :
309
302
return self ._param_schemas
310
303
311
- op_schema = self .get_schema ()
304
+ op_schema = self .opschema
312
305
if op_schema is None :
313
306
return None
314
307
0 commit comments