torch / nn

Other
1.34k stars 967 forks source link

fix condition logic for coef recalculation in SpatialSubtractiveNormalization #1283

Closed elikosan closed 7 years ago

elikosan commented 7 years ago

Existing conditional expression always verified, resulting in overhead as coefficients were recalculated every time. Fix and simplify expression by using cached input size.

soumith commented 7 years ago

this will fail if input size changes right? that's not correct.

elikosan commented 7 years ago

If the input size changes, then it will recompute the coefs. The expression: not input:isSize(self._inpsz) becomes true when the size of input and the cached size are different.

From: Soumith Chintala [mailto:notifications@github.com] Sent: Monday, October 02, 2017 3:01 PM To: torch/nn Cc: Eric Cosatto; Author Subject: Re: [torch/nn] fix condition logic for coef recalculation in SpatialSubtractiveNormalization (#1283)

this will fail if input size changes right? that's not correct.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/torch/nn/pull/1283#issuecomment-333632048, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASkgqhJxjLn4oTAWn1dwqVSnzU73A0-Wks5soTL9gaJpZM4PrEyT.

soumith commented 7 years ago

thanks!

elikosan commented 7 years ago

Hi Soumith,

I found out why Travis failed. I need to clear my cache in SpatialSubtractiveNormalization:clearState() Otherwise the jac.TestIO fails

I will make another pull request with the fix. Sorry about that.

Eric.

From: Soumith Chintala [mailto:notifications@github.com] Sent: Monday, October 02, 2017 3:01 PM To: torch/nn Cc: Eric Cosatto; Author Subject: Re: [torch/nn] fix condition logic for coef recalculation in SpatialSubtractiveNormalization (#1283)

this will fail if input size changes right? that's not correct.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/torch/nn/pull/1283#issuecomment-333632048, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASkgqhJxjLn4oTAWn1dwqVSnzU73A0-Wks5soTL9gaJpZM4PrEyT.