Skip to content

Add CNN example and README refinements #31

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Lottie-641
Copy link

@Lottie-641 Lottie-641 commented Apr 19, 2025

Dear TPP-PyTorch team,

First, thank you for your outstanding work in developing and maintaining the tpp-pytorch-extension.

As part of my contribution, I’d like to extend the project by introducing support for CNN-based models, which are still widely used in a variety of practical applications.

README Refinements

  • I made a few small edits to the README.md file, mainly to help new users get oriented with TPP concepts. I wasn't entirely sure if such changes are needed or welcome, so please feel free to adjust or discard them as you see fit.

CNN Example in Progress

I’m currently working on integrating a complete CNN-based model, such as U-Net, into the tpp-pytorch-extension framework. Since this is my first time working with TPPs, I'm approaching it incrementally:

  • I'm starting by implementing and validating a single convolutional layer using TPPs to ensure correctness and performance alignment with the framework.
  • Once this layer is stable, I plan to build it up into a full CNN model pipeline, using TPP-enabled components throughout.

This effort is still in progress, and I’m very open to structural or architectural suggestions from the maintainers. If there's a preferred style or integration point for the new example, I’d be happy to align with it.

@Lottie-641 Lottie-641 changed the title Starting Add CNN example and README refinements Apr 24, 2025
@Lottie-641
Copy link
Author

I've recently embedded one convolution layer into the tpp-pytorch-extension and attached the test results.
image
For my next step, I’m hoping to extend this into a complete U-Net model, and I would really appreciate your advice on a few points:

  1. When plugging TPP custom convolution kernels into a PyTorch U-Net, what TPP functions or packages would you recommend using? Also, what’s the typical workflow to make sure it integrates well with autograd and mixed precision?
  2. Are there any complete CNN-related examples using TPP that I could use as a reference to better understand the integration?

I’m very excited to continue improving this work and would be grateful for any suggestions, references, or advice you can share. @ddkalamk

@Lottie-641
Copy link
Author

image
I’ve completed the U-Net implementation with an optimized convolution layer. You can run examples/cnn/unet_example.py to test it. This example focuses specifically on replacing the standard convolution layers with the optimized Conv1dOpti layer, while keeping the rest of the U-Net structure unchanged.

@Huwjsoa
Copy link

Huwjsoa commented May 5, 2025

Hey, I'm also trying to figure out how to use TPP in a CNN model. I noticed you're working on something similar, do you have any guidance for developers?

@Lottie-641
Copy link
Author

Hi! I'm really glad to hear you're also exploring TPP in CNN models. I've added a README.md under examples/cnn/, including how to compile the env. Feel free to check it out, and let me know if you run into any issues or have questions. Happy to help!

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