Learn About Our Meetup

5000+ Members



Join our meetup, learn, connect, share, and get to know your Toronto AI community. 



Browse through the latest deep learning, ai, machine learning postings from Indeed for the GTA.



Are you looking to sponsor space, be a speaker, or volunteer, feel free to give us a shout.

[D] PyTorch implementation best practices

Hi r/MachineLearning! Let’s discuss PyTorch best practices.

I recently finished a PyTorch re-implementation (with help from various sources) for the paper Zero-shot User Intent Detection via Capsule Neural Networks, which originally had Python 2 code for TensorFlow.

I’d like to request perhaps a critique on the code I’ve written so far (it’s not perfect, yet!) and any suggestions if there are best practices specifically in PyTorch, for implementing directly from research papers as well as converting them from other frameworks.

Some thoughts I had while programming (feel free to raise more!):

  1. I’ve been implementing a Dataset class and custom batch functions for every dataset I’ve been working with. Is this the PyTorch best practice?

  2. Where is the optimal place to shift Tensors to .cuda()? I’ve been doing this in the training loop, just before feeding it into the model.

  3. How to manage the use of both numpy and torch, seeing as PyTorch aims to reinvent many of the basic operations in numpy?

If you’re a fellow PyTorch user/contributor please share a little!

submitted by /u/floodvalve
[link] [comments]

Toronto AI is a social and collaborative hub to unite AI innovators of Toronto and surrounding areas. We explore AI technologies in digital art and music, healthcare, marketing, fintech, vr, robotics and more. Toronto AI was founded by Dave MacDonald and Patrick O'Mara.