This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from keras.layers import Dropout | |
from keras import applications | |
from keras.layers import Dense, GlobalAveragePooling2D, merge, Input | |
from keras.models import Model | |
max_words = 10000 | |
epochs = 50 | |
batch_size = 32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# XLA compilation controlled by "compile_ops" option | |
# compile_ops=False: 4.39 sec | |
# compile_ops=True: 0.90 sec | |
import os | |
os.environ['CUDA_VISIBLE_DEVICES']='' | |
import tensorflow as tf | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
""" | |
Multi dimensional softmax, | |
refer to https://github.com/tensorflow/tensorflow/issues/210 | |
compute softmax along the dimension of target | |
the native softmax only supports batch_size x dimension | |
""" | |
def softmax(target, axis, name=None): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" cVim configuration -- Aaditya Prakash | |
" gist id -- ed0f4da609dde6b71b43 | |
" Settings | |
"set noautofocus | |
set cncpcompletion | |
set smoothscroll | |
set nohud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from: http://www.4dsolutions.net/cgi-bin/py2html.cgi?script=/ocn/python/primes.py | |
""" | |
primes.py -- Oregon Curriculum Network (OCN) | |
Feb 1, 2001 changed global var primes to _primes, added relative primes test | |
Dec 17, 2000 appended probable prime generating methods, plus invmod | |
Dec 16, 2000 revised to use pow(), removed methods not in text, added sieve() | |
Dec 12, 2000 small improvements to erastosthenes() | |
Dec 10, 2000 added Euler test | |
Oct 3, 2000 modified fermat test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ossaudiodev as oss | |
from numpy import fft | |
import math | |
import pygame | |
import pygame.surfarray as surfarray | |
d = oss.open('rw') | |
d.setfmt(oss.AFMT_U16_LE) | |
d.channels(1) |