Skip to content

Instantly share code, notes, and snippets.

import tensorflow as tf
import keras.backend as K
import keras.losses as losses
import keras.metrics as metrics
def zero_loss(targets, outputs):
return losses.categorical_crossentropy(targets, outputs)*0
from keras import backend as K
def masked_categorical_crossentropy(y_true, y_pred):
mask = K.cast(K.not_equal(y_true, -1), K.floatx())
return K.categorical_crossentropy(y_true * mask, y_pred * mask)
def masked_categorical_accuracy(y_true, y_pred):
mask = K.cast(K.not_equal(y_true, -1), K.floatx())
return metrics.categorical_accuracy(y_true * mask, y_pred * mask)
x = SpatialDropout1D(rate=0.1)(input_i)
x = Bidirectional(CuDNNGRU(50, return_sequences=True))(x)
layer_outputs.append(x[:,-1,:]) # <- Not OK,
layer_outputs.append(GlobalAvgPool1D()(x)) # OK
layer_outputs.append(GlobalMaxPool1D()(x)) # OK
#!/usr/bin/env bash
set -e
instances=$(echo {0..2})
public_ip=$(hostname -I | cut -d' ' -f1)
peers=$(for i in $instances; do echo "etcd.$i=http://${public_ip}:$((2380+$i*100))"; done | tr '\n' ',')
for i in $instances
do
@ali-mosavian
ali-mosavian / gist:6449363
Created September 5, 2013 12:15
After patch
----------------- YAML -----------------
global_host_alias:
query_port: 2099
outputWriters:
- "@class": "com.googlecode.jmxtrans.model.output.GraphiteWriter"
settings:
host: "localhost"
port: 8080
rootPrefix: jmxtrans
@ali-mosavian
ali-mosavian / gist:6449348
Last active December 22, 2015 09:08
Before patch
----------------- YAML -----------------
global_host_alias:
query_port: 2099
outputWriters:
- "@class": "com.googlecode.jmxtrans.model.output.GraphiteWriter"
settings:
host: "localhost"
port: 8080
rootPrefix: jmxtrans
diff --git a/pom.xml b/pom.xml
index 6495076..7ba5892 100644
--- a/pom.xml
+++ b/pom.xml
@@ -118,6 +118,7 @@
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>all</shadedClassifierName>
+ <finalName>${project.artifactId}-all</finalName>
</configuration>