Skip to content

Instantly share code, notes, and snippets.

View HarshTrivedi's full-sized avatar
💭
Am probably having coffee ☕☕☕

Harsh Trivedi HarshTrivedi

💭
Am probably having coffee ☕☕☕
View GitHub Profile
@HarshTrivedi
HarshTrivedi / pad_packed_demo.py
Last active March 2, 2024 16:49 — forked from Tushar-N/pad_packed_demo.py
Minimal tutorial on packing (pack_padded_sequence) and unpacking (pad_packed_sequence) sequences in pytorch.
import torch
from torch import LongTensor
from torch.nn import Embedding, LSTM
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
## We want to run LSTM on a batch of 3 character sequences ['long_str', 'tiny', 'medium']
#
# Step 1: Construct Vocabulary
# Step 2: Load indexed data (list of instances, where each instance is list of character indices)
@HarshTrivedi
HarshTrivedi / 0_reuse_code.js
Created April 17, 2016 04:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/bin/sh
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3