1# SPDX-License-Identifier: Apache-2.0 2 3from __future__ import absolute_import 4from __future__ import division 5from __future__ import print_function 6from __future__ import unicode_literals 7 8import numpy as np # type: ignore 9 10import onnx 11from ..base import Base 12from . import expect 13 14 15class Acos(Base): 16 17 @staticmethod 18 def export(): # type: () -> None 19 node = onnx.helper.make_node( 20 'Acos', 21 inputs=['x'], 22 outputs=['y'], 23 ) 24 25 x = np.array([-0.5, 0, 0.5]).astype(np.float32) 26 y = np.arccos(x) 27 expect(node, inputs=[x], outputs=[y], 28 name='test_acos_example') 29 30 x = np.random.rand(3, 4, 5).astype(np.float32) 31 y = np.arccos(x) 32 expect(node, inputs=[x], outputs=[y], 33 name='test_acos') 34