+
Skip to content

Conversation

nkoppel
Copy link
Contributor

@nkoppel nkoppel commented Mar 26, 2023

Adds the convolve_dim method to ConvAlgebra and uses it to implement ConvAlgebra for usize. Conv2d and Pool2d still require nightly, as making them work on stable would require making Const<N>::Convolved be usize, which I don't think is a desirable outcome of changing toolchains.

type Convolved = usize;

fn convolve_dim(&self) -> Self::Convolved {
(self.size() + 2 * P - K) / S + 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(self.size() + 2 * P - K) / S + 1
(self.size() + 2 * P).checked_sub(K).unwrap() / S + 1

I think we'll need to add some sort of check/assertion for when this conv operation is valid. The const generic version does this implicitly with the where bound

@coreylowman
Copy link
Owner

I like how this ends up removing more code than it adds😀

@coreylowman
Copy link
Owner

Nice change 🚀

@coreylowman coreylowman merged commit 9eeb400 into coreylowman:main Mar 26, 2023
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

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载