Skip to content

Instantly share code, notes, and snippets.

View abali96's full-sized avatar

Arjun Bali abali96

View GitHub Profile
@abali96
abali96 / AttentionWithContext.py
Created May 23, 2017 03:13 — forked from cbaziotis/AttentionWithContext.py
Keras Layer that implements an Attention mechanism, with a context/query vector, for temporal data. Supports Masking. Follows the work of Yang et al. [https://www.cs.cmu.edu/~diyiy/docs/naacl16.pdf] "Hierarchical Attention Networks for Document Classification"
class AttentionWithContext(Layer):
"""
Attention operation, with a context/query vector, for temporal data.
Supports Masking.
Follows the work of Yang et al. [https://www.cs.cmu.edu/~diyiy/docs/naacl16.pdf]
"Hierarchical Attention Networks for Document Classification"
by using a context vector to assist the attention
# Input shape
3D tensor with shape: `(samples, steps, features)`.
# Output shape
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlComponent>
#include <QDebug>
#include <QQmlProperty>
#include <QQuickView>
//class MyClass : public QObject
//{
// Q_OBJECT
board = [["o", "a", "g", "r"], ["s", "q", "n", "t"], ["e", "i", "s", "g"]]
def spell_all_words(board, word_dictionary):
words_found = list()
for row_number in range(len(board)):
for col_number in range(len(board[row_number])):
for i_offset in range(-1, 2): # get our adjacent characters
if not 0 <= row_number + i_offset < len(board):
continue
https://gist.github.com/abali96/438adb50415384149911
if operands.each {|operand| operand[0] == "-"}
x = operands.shift
puts operands
pre_arguments = '"' + operands.join('", "').gsub(/-/, '') + '"'
add(x, pre_arguments)
end
# the add method accepts arguments as strings like add("1", "2", "3")