Skip to content

Instantly share code, notes, and snippets.

View maximus009's full-sized avatar
💭
Doing nothing is also an operation

Shiva Sitaraman maximus009

💭
Doing nothing is also an operation
View GitHub Profile
@maximus009
maximus009 / outer_product_keras.py
Created February 16, 2017 20:06
Calculate the outer product/bilinear projection in Keras
from keras.layers import Lambda
from keras import backend as K
from numpy import newaxis
from keras.models import Model, Input
def outer_product(inputs):
"""
inputs: list of two tensors (of equal dimensions,
for which you need to compute the outer product