get the Cast operator from onnx node Args: onnx_node (OnnxNode): a given onnx node operator (Operator Class): a singa operator class opset_version (int): the opset version Returns: singa operator instance
(cls, onnx_node, operator, opset_version=_opset_version)
| 1249 | |
| 1250 | @classmethod |
| 1251 | def _create_cast(cls, onnx_node, operator, opset_version=_opset_version): |
| 1252 | """ |
| 1253 | get the Cast operator from onnx node |
| 1254 | Args: |
| 1255 | onnx_node (OnnxNode): a given onnx node |
| 1256 | operator (Operator Class): a singa operator class |
| 1257 | opset_version (int): the opset version |
| 1258 | Returns: |
| 1259 | singa operator instance |
| 1260 | """ |
| 1261 | to_type = onnx_type_to_singa_type(onnx_node.getattr("to")) |
| 1262 | assert to_type != None, "not support cast type: {}".format(to_type) |
| 1263 | if to_type == np.dtype('float32'): |
| 1264 | return operator(tensor.float32) |
| 1265 | else: |
| 1266 | return operator(tensor.int32) |
| 1267 | |
| 1268 | @classmethod |
| 1269 | def _create_split(cls, onnx_node, operator, opset_version=_opset_version): |
nothing calls this directly
no test coverage detected