Skip to content

Complex{Float32} is not a subtype of Float32, breaking conv of complex valued input/weights #211

Open
@dsweber2

Description

@dsweber2

Just a simple convolution with two complex matrices breaks:
conv(randn(Complex{Float32}, 25,25,1,3), randn(Complex{Float32}, 5,5,1,3))

The stated reason is that this line

T1.($(Symbol("$(front_name)$(backend)!"))(Float32.(out), Float32.(in1),
is trying to coerce a complex into a real by converting it to a Float32. Tweaking both
function conv_nnpack!(y::A1, x::A1, w::A1, cdims::ConvDims;

and
function nnp_convolution_output(y::Array{Float32,4}, x::Array{Float32,4}, w::Array{Float32,4}, b::Array{Float32,1}; algo::nnp_convolution_algorithm = UInt32(0), workspace_buffer = nothing, workspace_size = 0, padding = 0, stride = 1, threadpool = C_NULL, profile = nothing)

to allow for Complex{Float32} as well allowed it to work as normal. I suspect a similar issue happens with any other functions that could work on complex inputs, but I haven't done extensive testing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions