Skip to content

Instantly share code, notes, and snippets.

View skmalviya's full-sized avatar
🐢
persistent dev

Shrikant Malviya skmalviya

🐢
persistent dev
View GitHub Profile
@skmalviya
skmalviya / min-char-rnn.py
Created May 27, 2022 03:13 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@skmalviya
skmalviya / theano_gputest.py
Last active January 7, 2020 11:08 — forked from orasik/gputest.py
Code to test if theano is using GPU or CPU
# Code to test if theano is using GPU or CPU
# Reference: https://stackoverflow.com/questions/34328467/how-can-i-use-my-gpu-on-ipython-notebook
from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy
import time
vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
iters = 1000
rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))