Source code for mlprodict.onnxrt.ops_cpu.op_reduce_prod
# -*- encoding: utf-8 -*-
# pylint: disable=E0203,E1101,C0111
"""
Runtime operator.
:githublink:`%|py|7`
"""
import numpy
from ._op import OpRunReduceNumpy
[docs]class ReduceProd(OpRunReduceNumpy):
atts = {'axes': [], 'keepdims': 1}
[docs] def __init__(self, onnx_node, desc=None, **options):
OpRunReduceNumpy.__init__(self, onnx_node, desc=desc,
expected_attributes=ReduceProd.atts,
**options)
[docs] def _run(self, data): # pylint: disable=W0221
return (numpy.prod(data, axis=self.axes,
keepdims=self.keepdims,
dtype=data.dtype), )