Skip to content

Instantly share code, notes, and snippets.

@JonathanRaiman
JonathanRaiman / viterbi.py
Last active February 4, 2020 11:30
tensorflow_viterbi_decode
import tensorflow as tf
def batch_gather_3d(values, indices):
return tf.gather(tf.reshape(values, [-1, tf.shape(values)[2]]),
tf.range(0, tf.shape(values)[0]) * tf.shape(values)[1] +
indices)
def batch_gather_2d(values, indices):
@blakebjorn
blakebjorn / pyqt threading example.py
Created December 12, 2016 00:13
PySide/PyQT non-blocking thread example
from PySide import QtCore, QtGui
import sys
import time
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
#Build a UI
self.myLayout = QtGui.QVBoxLayout()
self.myCentralWidget = QtGui.QWidget()