Source code for mlprodict.onnxrt.ops_cpu.op_div
# -*- encoding: utf-8 -*-
# pylint: disable=E0203,E1101,C0111
"""
Runtime operator.
:githublink:`%|py|7`
"""
import numpy
from ._op import OpRunBinaryNumpy
[docs]class Div(OpRunBinaryNumpy):
[docs] def __init__(self, onnx_node, desc=None, **options):
OpRunBinaryNumpy.__init__(self, numpy.divide, onnx_node,
desc=desc, **options)
[docs] def _run(self, a, b): # pylint: disable=W0221
res = OpRunBinaryNumpy._run(self, a, b)
if res[0].dtype != a.dtype:
return (res[0].astype(a.dtype), )
return res