Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erratic Dilation behavior #44

Closed
staticfloat opened this issue May 23, 2018 · 3 comments
Closed

Erratic Dilation behavior #44

staticfloat opened this issue May 23, 2018 · 3 comments

Comments

@staticfloat
Copy link
Contributor

staticfloat commented May 23, 2018

Uh-oh, I should have tested this more thoroughly looks like. :/

# 2-length convolution with 1 channel in and 1 channel out
w = reshape(Float64[1, 1], (2, 1, 1))

# 128-length input vector with 1 channel and 1 batch.
x = reshape(Float64[1:128...], (128, 1, 1))

# Let's calculate the same thing a couple different times
ys = []
for idx in 1:10
    push!(ys, NNlib.conv(x, w; dilation = 2))
end

# Do some of these randomly have a bunch of NaN's in them?  Why yes they do:
[any(isnan.(ys[idx])) for idx in 1:10]

Running the above results in:

10-element Array{Bool,1}:
 false
  true
  true
 false
 false
 false
 false
 false
  true
  true

The fact that this is erratic makes me think the BLAS routine is reading from uninitialized/clobbered memory.

@staticfloat
Copy link
Contributor Author

@tejank10 sorry to so quickly have to come back to you about this.

@tejank10
Copy link
Contributor

tejank10 commented May 23, 2018

@staticfloat, no problem. I changed the code on line 178 of impl/conv.jl to size(w) instead of dilation_dims(w, dilation) and it didn't give any NaN for the above inputs (I ran the loop for about 10k times). But what surprises me is that how could it (the code with dilation_dims) give different output for the same input, and can also gives the correct output in some cases?

@staticfloat
Copy link
Contributor Author

Fixed by #94

ToucheSir pushed a commit that referenced this issue Feb 13, 2023
* update tests for NNlib 0.8.3

* lower precision
ToucheSir pushed a commit that referenced this issue Feb 13, 2023
* update tests for NNlib 0.8.3

* lower precision
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants