This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package logsoftmax; | |
import org.nd4j.linalg.activations.BaseActivationFunction; | |
import org.nd4j.linalg.api.ndarray.INDArray; | |
import org.nd4j.linalg.api.ops.impl.transforms.Exp; | |
import org.nd4j.linalg.api.ops.impl.transforms.Log; | |
import org.nd4j.linalg.api.ops.impl.transforms.OldSoftMax; | |
import org.nd4j.linalg.factory.Nd4j; | |
import org.nd4j.linalg.primitives.Pair; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public INDArray getActivation(INDArray logits, boolean training) { | |
// implement | |
// logits - log(sum(exp(logits)) | |
// expect logits to have dimensions: batch x classes | |
INDArray copy = logits.dup(); | |
Nd4j.getExecutioner().execAndReturn(new Exp(copy)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import numpy as np | |
from keras.models import Model | |
from keras.layers import Input | |
from keras.layers.core import Dense | |
import keras.backend as K | |
from keras.optimizers import RMSprop | |
learn_rate = 0.00005 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hashOrder = function(positions, units) { | |
var hash = 0; | |
var rotator = 0; | |
for (var i = 0; i < positions.length; i++) { | |
rotator += 3; | |
rotator = rotator % 24; | |
hash = hash ^ (positions[i] << rotator); | |
} | |
var l = Math.min(units.length, 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hashOrder = function(positions, units) { | |
var hash = 0; | |
for (var i = 0; i < positions.length; i++) { | |
hash = (hash << 1 | hash >>> 31) ^ positions[i]; | |
} | |
var l = Math.min(units.length, 100); | |
for (var i = 0; i < l; i++) { | |
hash = (hash << 1 | hash >>> 31) ^ units[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hashOrder = function(positions, units) { | |
var hash = 0; | |
for (var i = 0; i < positions.length; i++) { | |
hash = (hash << 1 | hash >> 31) ^ positions[i]; | |
} | |
var l = Math.min(units.length, 100); | |
for (var i = 0; i < l; i++) { | |
hash = (hash << 1 | hash >> 31) ^ units[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var normalizeVec = function(pos) { | |
var l = Math.sqrt(pos[0]*pos[0] + pos[1]*pos[1] + pos[2]*pos[2]); | |
return [(pos[0]/l), (pos[1]/l), (pos[2]/l)]; | |
}; | |
var addVec = function(a, b) { | |
return [a[0] + b[0], a[1] + b[1], a[2] + b[2]]; | |
}; | |
var scaleVec = function(a, s) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
$('.div_build_item').not('#bld1').remove(); | |
$('.div_build_bar_cont').css({ | |
'max-width': '251px', | |
//'min-width': '189px', // Set at 3 items wide, so the build-tab doesn't fuck up so much when there's 1 or 2 build options. | |
'width': 'auto', | |
'vertical-align': 'bottom', | |
}); | |
$('.div_build_bar_menu_cont > div').css({ | |
'padding': '0px 0px 1px 0px', |