(function(global) { "use strict"; var Vol = global.Vol; // convenience // a bit experimental layer for now. I think it works but I'm not 100% // the gradient check is a bit funky. I'll look into this a bit later. // Local Response Normalization in window, along depths of volumes var LocalResponseNormalizationLayer = function(opt) { var opt = opt || {}; // required this.k = opt.k; this.n = opt.n; this.alpha = opt.alpha; this.beta = opt.beta; // computed this.out_sx = opt.in_sx; this.out_sy = opt.in_sy; this.out_depth = opt.in_depth; this.layer_type = 'lrn'; // checks if(this.n%2 === 0) { console.log('WARNING n should be odd for LRN layer'); } } LocalResponseNormalizationLayer.prototype = { forward: function(V, is_training) { this.in_act = V; var A = V.cloneAndZero(); this.S_cache_ = V.cloneAndZero(); var n2 = Math.floor(this.n/2); for(var x=0;x