Skip to content

Commit 9a411fe

Browse files
authored
Adding support for Asinh (#123)
1 parent f53359f commit 9a411fe

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/load.jl

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ function load_node!(tape::Tape, ::OpConfig{:ONNX, :Asin}, args::VarVec, attrs::A
103103
return push_call!(tape, _asin, args[1])
104104
end
105105

106+
function load_node!(tape::Tape, ::OpConfig{:ONNX, :Asinh}, args::VarVec, attrs::AttrDict)
107+
return push_call!(tape, _asinh, args[1])
108+
end
109+
106110
function load_node!(tape::Tape, nd::NodeProto, backend::Symbol)
107111
args = [tape.c.name2var[name] for name in nd.input]
108112
attrs = convert(Dict{Symbol, Any}, Dict(nd.attribute))

src/ops.jl

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ _abs(x) = abs.(x)
8989
_acos(x) = acos.(x)
9090
_acosh(x) = acosh.(x)
9191
_asin(x) = asin.(x)
92+
_asinh(x) = asinh.(x)
9293
mul(xs...) = .*(xs...)
9394
relu(x) = NNlib.relu.(x)
9495
leakyrelu(x;a = 0.01) = NNlib.leakyrelu.(x,a)

src/save.jl

+5
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ function save_node!(g::GraphProto, ::OpConfig{:ONNX, typeof(_asin)}, op::Umlaut.
181181
push!(g.node, nd)
182182
end
183183

184+
function save_node!(g::GraphProto, ::OpConfig{:ONNX, typeof(_asinh)}, op::Umlaut.Call)
185+
nd = NodeProto("Asinh", op)
186+
push!(g.node, nd)
187+
end
188+
184189
function save_node!(g::GraphProto, ::OpConfig{:ONNX, typeof(*)}, op::Umlaut.Call)
185190
nd = NodeProto(
186191
input=[onnx_name(v) for v in reverse(op.args)],

test/saveload.jl

+6
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ import ONNX: NodeProto, ValueInfoProto, AttributeProto, onnx_name
6868
ort_test(ONNX._asin, A)
6969
end
7070

71+
@testset "Asinh" begin
72+
# ONNXRunTime has no implementation for Asinh(x::Float64), using Float32
73+
A = rand(Float32, 3, 4)
74+
ort_test(ONNX._asinh, A)
75+
end
76+
7177
@testset "Transpose" begin
7278
# ort_test() checks for expected output of functions, errors on Transpose
7379
# because of array shape; manually testing!

0 commit comments

Comments
 (0)