{ "op": "ai.onnx.Cos", "cases": [ { "name": "f32_values", "inputs": { "x": { "dtype": "float32", "shape": [6], "data": { "kind": "values", "values": [-3.0, -1.0, 0.0, 0.5, 1.0, 3.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [6], "tolerance": 0.000001 } } }, { "name": "large_argument_range_reduction", "inputs": { "x": { "dtype": "float32", "shape": [8], "data": { "kind": "values", "values": [1000000.0, 10000000.0, 10000000000000.0, 100000000000000000000.0, -1000000000000000.0, -123456.78, 314159.265, 2500000000.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [8], "tolerance": 0.0001 } } }, { "name": "f32_large_argument_range_reduction_accuracy_gpu_gap", "skipGpu": { "category": "todo", "reason": "The current f32 large-argument range reduction differs from the CPU reference by about one ULP. A more accurate range reduction or software-extended precision could close this implementable gap." }, "provenance": { "source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc", "test": "MathOpTest.CosFloat", "notes": "Finite large arguments stress Cos range reduction; this uses a stricter tolerance than the broad smoke case." }, "inputs": { "x": { "dtype": "float32", "shape": [8], "data": { "kind": "values", "values": [1000000.0, 10000000.0, 10000000000000.0, 100000000000000000000.0, -1000000000000000.0, -123456.78, 314159.265, 2500000000.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [8], "tolerance": 1e-8, "relTolerance": 0 } } }, { "name": "f32_large_argument_range_reduction_accuracy_scalar_gpu_gap", "skipGpu": { "category": "todo", "reason": "The current scalar f32 large-argument range reduction differs from the CPU reference by about one ULP. A more accurate range reduction or software-extended precision could close this implementable gap." }, "provenance": { "source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc", "test": "MathOpTest.CosFloat", "notes": "Scalar-path companion for strict large-argument Cos range-reduction accuracy." }, "inputs": { "x": { "dtype": "float32", "shape": [7], "data": { "kind": "values", "values": [1000000.0, 10000000.0, 10000000000000.0, -1000000000000000.0, -123456.78, 314159.265, 2500000000.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [7], "tolerance": 1e-8, "relTolerance": 0 } } }, { "name": "special_values_infinity_nan", "inputs": { "x": { "dtype": "float32", "shape": [5], "data": { "kind": "values", "values": ["-Infinity", 0.0, 0.0, "Infinity", "NaN"] } } }, "outputs": { "y": { "dtype": "float32", "shape": [5], "tolerance": 0.000001, "allowNaN": true } } }, { "name": "rank0_scalar", "inputs": { "x": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [1.25] } } }, "outputs": { "y": { "dtype": "float32", "shape": [], "tolerance": 0.000001 } } }, { "name": "ort_float_opset22", "provenance": { "source": "onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc", "test": "MathOpTest.Cos_Opset22" }, "inputs": { "x": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.1, -1.1, 2.2, -2.2] } } }, "outputs": { "y": { "dtype": "float32", "shape": [4], "tolerance": 0.000001, "data": { "kind": "values", "values": [0.4535961151123047, 0.4535961151123047, -0.5885010957717896, -0.5885010957717896] } } } }, { "name": "onnx_backend_example", "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_cos_example", "test": "test_cos_example" }, "inputs": { "x": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [-1.0, 0.0, 1.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [3], "tolerance": 0.000001 } } }, { "name": "onnx_backend_cos", "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_cos" }, "inputs": { "x": { "dtype": "float32", "shape": [3, 4, 5], "data": { "kind": "values", "values": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322, 0.7610377073287964, 0.12167501449584961, 0.44386324286460876, 0.3336743414402008, 1.4940791130065918, -0.2051582634449005, 0.3130677044391632, -0.8540957570075989, -2.5529897212982178, 0.653618574142456, 0.8644362092018127, -0.7421650290489197, 2.269754648208618, -1.4543657302856445, 0.04575851559638977, -0.18718385696411133, 1.5327792167663574, 1.4693588018417358, 0.154947429895401, 0.37816253304481506, -0.8877857327461243, -1.980796456336975, -0.34791216254234314, 0.15634897351264954, 1.2302906513214111, 1.202379822731018, -0.38732680678367615, -0.302302747964859, -1.0485529899597168, -1.420017957687378, -1.7062702178955078, 1.950775384902954, -0.5096521973609924, -0.4380742907524109, -1.2527953386306763, 0.7774903774261475, -1.6138978004455566, -0.21274028718471527, -0.8954665660858154, 0.38690251111984253, -0.5108051300048828, -1.18063223361969, -0.02818222902715206, 0.4283318817615509, 0.06651721894741058, 0.30247190594673157, -0.6343221068382263, -0.3627411723136902] } } }, "outputs": { "y": { "dtype": "float32", "shape": [3, 4, 5], "tolerance": 0.00001 } } }, { "name": "onnx_backend_cos_example", "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_cos_example" }, "inputs": { "x": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [-1.0, 0.0, 1.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [3], "tolerance": 0.00001 } } }, { "name": "vec4_f32_nonfinite", "inputs": { "x": { "dtype": "float32", "shape": [8], "data": { "kind": "values", "values": ["-Infinity", -1.0, 0.0, 0.5, 1.0, "Infinity", "NaN", 2.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [8], "tolerance": 0.000001, "allowNaN": true } } }, { "name": "vec4_f16_lanes", "inputs": { "x": { "dtype": "float16", "shape": [16], "data": { "kind": "values", "values": [-100.0, -50.0, -20.0, -10.0, -6.0, -3.0, -1.5, -0.5, 0.0, 0.5, 1.5, 3.0, 6.0, 10.0, 50.0, 100.0] } } }, "outputs": { "y": { "dtype": "float16", "shape": [16], "tolerance": 0.001, "relTolerance": 0.002 } } }, { "name": "empty_input_zero_dim", "inputs": { "x": { "dtype": "float32", "shape": [0], "data": { "kind": "values", "values": [] } } }, "outputs": { "y": { "dtype": "float32", "shape": [0], "tolerance": 0 } } }, { "name": "f16_scalar_path_odd_numel", "inputs": { "x": { "dtype": "float16", "shape": [7], "data": { "kind": "values", "values": [-2.0, -1.0, -0.5, 0.0, 0.5, 1.0, 2.0] } } }, "outputs": { "y": { "dtype": "float16", "shape": [7], "tolerance": 0.001, "relTolerance": 0.002 } } }, { "name": "f16_realistic_2d_finite", "inputs": { "x": { "dtype": "float16", "shape": [2, 64], "data": { "kind": "values", "values": [-3.140625, -3.046875, -2.953125, -2.859375, -2.765625, -2.671875, -2.578125, -2.484375, -2.390625, -2.296875, -2.203125, -2.109375, -2.015625, -1.921875, -1.828125, -1.734375, -1.640625, -1.546875, -1.453125, -1.359375, -1.265625, -1.171875, -1.078125, -0.984375, -0.890625, -0.796875, -0.703125, -0.609375, -0.515625, -0.421875, -0.328125, -0.234375, -0.140625, -0.046875, 0.046875, 0.140625, 0.234375, 0.328125, 0.421875, 0.515625, 0.609375, 0.703125, 0.796875, 0.890625, 0.984375, 1.078125, 1.171875, 1.265625, 1.359375, 1.453125, 1.546875, 1.640625, 1.734375, 1.828125, 1.921875, 2.015625, 2.109375, 2.203125, 2.296875, 2.390625, 2.484375, 2.578125, 2.671875, 2.765625, -3.0, -2.5, -2.0, -1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 0.25, 0.75, 1.25, 1.75, 2.25, 2.75, -0.25, -0.75, -1.25, -1.75, -2.25, -2.75, 0.125, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875, 2.125, 2.375, 2.625, 2.875, -0.125, -0.375, -0.625, -0.875, -1.125, -1.375, -1.625, -1.875, -2.125, -2.375, -2.625, -2.875, 3.0, -3.0, 1.0, -1.0, 0.5, -0.5, 2.0, -2.0, 1.5, -1.5, 2.5, -2.5, 0.0, 0.0, 3.0] } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 64], "tolerance": 0.001, "relTolerance": 0.002 } } }, { "name": "f32_scalar_path_finite_odd_numel", "inputs": { "x": { "dtype": "float32", "shape": [5], "data": { "kind": "values", "values": [-2.5, -0.75, 0.0, 1.25, 3.5] } } }, "outputs": { "y": { "dtype": "float32", "shape": [5], "tolerance": 0.000001 } } }, { "name": "reduce_threshold_boundary_10000", "inputs": { "x": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [9999.0, 10000.0, -9999.0, -10000.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [4], "tolerance": 0.001 } } }, { "name": "f16_cos_range_finite_and_nonfinite_vec4", "inputs": { "x": { "dtype": "float16", "shape": [8], "data": { "kind": "values", "values": ["-Infinity", -100.0, -1.0, 0.0, 1.0, 100.0, "Infinity", "NaN"] } } }, "outputs": { "y": { "dtype": "float16", "shape": [8], "tolerance": 0.002, "allowNaN": true } } }, { "name": "f32_vec4_sustained_1024", "inputs": { "x": { "dtype": "float32", "shape": [1024], "data": { "kind": "linspace", "start": -6.283185, "end": 6.283185 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1024], "tolerance": 0.00001 } } } ] }