Skip to content

Instantly share code, notes, and snippets.

View zjw1990's full-sized avatar

jiawei zhao zjw1990

View GitHub Profile
@yang-zhang
yang-zhang / multi-face.ipynb
Last active December 27, 2023 05:28
Multi-task Deep Learning Experiment using fastai Pytorch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ritchie46
ritchie46 / rnn_minibatch.py
Created June 20, 2018 09:28
minibatches in pytorch
"""
How to do minibatches for RNNs in pytorch
Assume we feed characters to the model and predict the language of the words.
"""
def prepare_batch(x, y):
# determine the maximum word length per batch and zero pad the tensors
n_max = max([a.shape[0] for a in x])