Skip to content

Create python implementation of torch.nn.Conv2d and torch.nn.AvgPool2d#2896

Merged
iamtrask merged 22 commits intomasterfrom
conv
Jan 18, 2020
Merged

Create python implementation of torch.nn.Conv2d and torch.nn.AvgPool2d#2896
iamtrask merged 22 commits intomasterfrom
conv

Conversation

@iamtrask
Copy link
Member

@iamtrask iamtrask commented Jan 12, 2020

For the same reasons we have python implementations of LSTM and GRU, I have created a basic implementation of Conv2d and AvgPool2d

It does not include all functionality, but it does include assertions to cause errors for settings which are not supported.

@Jasopaum
Copy link
Member

We already have our own conv2d implementation, it’s not in the nn module but in the FixedPrecisionTensor class, I think. It was implemented before the rnn so it’s not at the right place (I know we should have moved it before).
Maybe it can be improved but you can at least start from there 🙂

@iamtrask
Copy link
Member Author

iamtrask commented Jan 12, 2020

Hi @Jasopaum - upon further review of that class it does indeed look like a convolutional layer exists there. However, unbeknownst to me the class has an enormous amount of functionality which is unrelated to FixedPrecision representations. I suspect that this has been done for coding convenience and possibly justified for performance reasons. If so, this is done at the expense of code re-use and good organization and is in urgent need of refactoring.

At present, I will not refer to it and have created a Github issue describing extensive refactoring required (#2897). Once the refactoring is completed, we can adjust the classes created in this PR to reference wherever the new functionality exists.

@iamtrask iamtrask changed the title Create python implementation of torch.nn.Conv2d Create python implementation of torch.nn.Conv2d and torch.nn.AvgPool2d Jan 12, 2020
@Jasopaum
Copy link
Member

I do agree that a refactor would do some good! 👍

@karlhigley karlhigley added the Type: New Feature ➕ Introduction of a completely new addition to the codebase label Jan 13, 2020
Copy link
Contributor

@karlhigley karlhigley left a comment

Choose a reason for hiding this comment

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

Looks good, maybe a few things to clean up before merging though.

@iamtrask iamtrask merged commit b5c346f into master Jan 18, 2020
@iamtrask iamtrask deleted the conv branch January 18, 2020 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: New Feature ➕ Introduction of a completely new addition to the codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants