Skip to content

Instantly share code, notes, and snippets.

<Keyboard>
<!--
This is for the micro strategy game Kingdom: New Lands
Controls are based on built-in WASD controls:
Left and right to move at 3 speeds:
- step left/right by tapping A/D
- walk left/right by holding down A/D
- gallop by double-tap and holding down A/D
@kmcnaught
kmcnaught / exp_derivative_tensorflow_test_vs_eig.py
Last active July 16, 2018 11:27
Compare proposed matrix exponential gradients with version comprised of existing differentiable ops, for symmetric matrices. See https://github.com/tensorflow/tensorflow/issues/15465. Based on https://gist.github.com/tvercaut/bd9fe8c5d12ab529babd9bf5434d7cda
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import sparse_ops
import numpy as np
import scipy.linalg
@kmcnaught
kmcnaught / serialisation_test.py
Last active February 21, 2018 17:09
Demo of serialisation bug in keras with loss_weights as variables
from keras import losses
from keras.models import Model, load_model
from keras.layers import Input, Dense
import keras.backend as K
from keras import optimizers
def build_dense_model_two_outputs(dim_in, dim_hidden, dim_out):
model_input = Input(
shape=(dim_in,),