code: # SPDX-License-Identifier: Apache-2.0
  
  from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  
  import numpy as np  # type: ignore
  
  import onnx
  from ..base import Base
  from . import expect
  
  
  class ReduceMin(Base):
  
      @staticmethod
      def export_do_not_keepdims() -> None:
          shape = [3, 2, 2]
          axes = [1]
          keepdims = 0
  
          node = onnx.helper.make_node(
              'ReduceMin',
              inputs=['data'],
              outputs=['reduced'],
              axes=axes,
              keepdims=keepdims)
  
          data = np.array([[[5, 1], [20, 2]], [[30, 1], [40, 2]], [[55, 1], [60, 2]]], dtype=np.float32)
          reduced = np.minimum.reduce(data, axis=tuple(axes), keepdims=keepdims == 1)
          #print(reduced)
          #[[5., 1.]
          # [30., 1.]
          # [55., 1.]]
  
          expect(node, inputs=[data], outputs=[reduced], name='test_reduce_min_do_not_keepdims_example')
  
          np.random.seed(0)
          data = np.random.uniform(-10, 10, shape).astype(np.float32)
          reduced = np.minimum.reduce(data, axis=tuple(axes), keepdims=keepdims == 1)
  
          expect(node, inputs=[data], outputs=[reduced], name='test_reduce_min_do_not_keepdims_random')
  
      @staticmethod
      def export_keepdims() -> None:
          shape = [3, 2, 2]
          axes = [1]
          keepdims = 1
  
          node = onnx.helper.make_node(
              'ReduceMin', inputs=['data'],
              outputs=['reduced'],
              axes=axes,
              keepdims=keepdims)
  
          data = np.array([[[5, 1], [20, 2]], [[30, 1], [40, 2]], [[55, 1], [60, 2]]], dtype=np.float32)
          reduced = np.minimum.reduce(data, axis=tuple(axes), keepdims=keepdims == 1)
          #print(reduced)
          #[[[5., 1.]]
          # [[30., 1.]]
          # [[55., 1.]]]
  
          expect(node, inputs=[data], outputs=[reduced], name='test_reduce_min_keepdims_example')
  
          np.random.seed(0)
          data = np.random.uniform(-10, 10, shape).astype(np.float32)
          reduced = np.minimum.reduce(data, axis=tuple(axes), keepdims=keepdims == 1)
  
          expect(node, inputs=[data], outputs=[reduced], name='test_reduce_min_keepdims_random')
  
      @staticmethod
      def export_default_axes_keepdims() -> None:
          shape = [3, 2, 2]
          axes = None
          keepdims = 1
  
          node = onnx.helper.make_node(
              'ReduceMin',
              inputs=['data'],
              outputs=['reduced'],
              keepdims=keepdims)
  
          data = np.array([[[5, 1], [20, 2]], [[30, 1], [40, 2]], [[55, 1], [60, 2]]], dtype=np.float32)
          reduced = np.minimum.reduce(data, axis=axes, keepdims=keepdims == 1)
          #print(reduced)
          #[[[1.]]]
  
          expect(node, inputs=[data], outputs=[reduced], name='test_reduce_min_default_axes_keepdims_example')
  
          np.random.seed(0)
          data = np.random.uniform(-10, 10, shape).astype(np.float32)
          reduced = np.minimum.reduce(data, axis=axes, keepdims=keepdims == 1)
  
          expect(node, inputs=[data], outputs=[reduced], name='test_reduce_min_default_axes_keepdims_random')
  
      @staticmethod
      def export_negative_axes_keepdims() -> None:
          shape = [3, 2, 2]
          axes = [-2]
          keepdims = 1
  
          node = onnx.helper.make_node(
              'ReduceMin', inputs=['data'],
              outputs=['reduced'],
              axes=axes,
              keepdims=keepdims)
  
          data = np.array([[[5, 1], [20, 2]], [[30, 1], [40, 2]], [[55, 1], [60, 2]]], dtype=np.float32)
          reduced = np.minimum.reduce(data, axis=tuple(axes), keepdims=keepdims == 1)
          # print(reduced)
          #[[[5., 1.]]
          # [[30., 1.]]
          # [[55., 1.]]]
  
          expect(node, inputs=[data], outputs=[reduced], name='test_reduce_min_negative_axes_keepdims_example')
  
          np.random.seed(0)
          data = np.random.uniform(-10, 10, shape).astype(np.float32)
          reduced = np.minimum.reduce(data, axis=tuple(axes), keepdims=keepdims == 1)
  
          expect(node, inputs=[data], outputs=[reduced], name='test_reduce_min_negative_axes_keepdims_random')
   # SPDX-License-Identifier: Apache-2.0
  
  from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  
  import numpy as np  # type: ignore
  
  import onnx
  from ..base import Base
  from . import expect
  
  
  class CumSum(Base):
  
      @staticmethod
      def export_cumsum_1d() -> None:
          node = onnx.helper.make_node(
              'CumSum',
              inputs=['x', 'axis'],
              outputs=['y']
          )
          x = np.array([1., 2., 3., 4., 5.]).astype(np.float64)
          axis = np.int32(0)
          y = np.array([1., 3., 6., 10., 15.]).astype(np.float64)
          expect(node, inputs=[x, axis], outputs=[y],
                 name='test_cumsum_1d')
  
      @staticmethod
      def export_cumsum_1d_exclusive() -> None:
          node = onnx.helper.make_node(
              'CumSum',
              inputs=['x', 'axis'],
              outputs=['y'],
              exclusive=1
          )
          x = np.array([1., 2., 3., 4., 5.]).astype(np.float64)
          axis = np.int32(0)
          y = np.array([0., 1., 3., 6., 10.]).astype(np.float64)
          expect(node, inputs=[x, axis], outputs=[y],
                 name='test_cumsum_1d_exclusive')
  
      @staticmethod
      def export_cumsum_1d_reverse() -> None:
          node = onnx.helper.make_node(
              'CumSum',
              inputs=['x', 'axis'],
              outputs=['y'],
              reverse=1
          )
          x = np.array([1., 2., 3., 4., 5.]).astype(np.float64)
          axis = np.int32(0)
          y = np.array([15., 14., 12., 9., 5.]).astype(np.float64)
          expect(node, inputs=[x, axis], outputs=[y],
                 name='test_cumsum_1d_reverse')
  
      @staticmethod
      def export_cumsum_1d_reverse_exclusive() -> None:
          node = onnx.helper.make_node(
              'CumSum',
              inputs=['x', 'axis'],
              outputs=['y'],
              reverse=1,
              exclusive=1
          )
          x = np.array([1., 2., 3., 4., 5.]).astype(np.float64)
          axis = np.int32(0)
          y = np.array([14., 12., 9., 5., 0.]).astype(np.float64)
          expect(node, inputs=[x, axis], outputs=[y],
                 name='test_cumsum_1d_reverse_exclusive')
  
      @staticmethod
      def export_cumsum_2d_axis_0() -> None:
          node = onnx.helper.make_node(
              'CumSum',
              inputs=['x', 'axis'],
              outputs=['y'],
          )
          x = np.array([1., 2., 3., 4., 5., 6.]).astype(np.float64).reshape((2, 3))
          axis = np.int32(0)
          y = np.array([1., 2., 3., 5., 7., 9.]).astype(np.float64).reshape((2, 3))
          expect(node, inputs=[x, axis], outputs=[y],
                 name='test_cumsum_2d_axis_0')
  
      @staticmethod
      def export_cumsum_2d_axis_1() -> None:
          node = onnx.helper.make_node(
              'CumSum',
              inputs=['x', 'axis'],
              outputs=['y'],
          )
          x = np.array([1., 2., 3., 4., 5., 6.]).astype(np.float64).reshape((2, 3))
          axis = np.int32(1)
          y = np.array([1., 3., 6., 4., 9., 15.]).astype(np.float64).reshape((2, 3))
          expect(node, inputs=[x, axis], outputs=[y],
                 name='test_cumsum_2d_axis_1')
  
      @staticmethod
      def export_cumsum_2d_negative_axis() -> None:
          node = onnx.helper.make_node(
              'CumSum',
              inputs=['x', 'axis'],
              outputs=['y'],
          )
          x = np.array([1., 2., 3., 4., 5., 6.]).astype(np.float64).reshape((2, 3))
          axis = np.int32(-1)
          y = np.array([1., 3., 6., 4., 9., 15.]).astype(np.float64).reshape((2, 3))
          expect(node, inputs=[x, axis], outputs=[y],
                 name='test_cumsum_2d_negative_axis')
  
apis: numpy.array numpy.minimum.reduce numpy.random.uniform numpy.random.seed
apis: numpy.int32 numpy.array