Copies activations from the argument array into
        layer activations.
344394
def copyActivations(self, arr, reckless = 0):
        
        array = Numeric.array(arr)
        if not len(array) == self.size:
            raise LayerError('Mismatched activation size and layer size in call to copyActivations()', \
                   (len(array), self.size))
        if self.verify and not self.activationSet == 0:
            if not reckless:
                raise LayerError('Activation flag not reset before call to copyActivations()', \
                       self.activationSet) 
        self.activation = array
        self.activationSet = 1
822272
function copy() {
  var result = {}
    , depth = 2
    , seen = [];

  (function worker() {
    each(array(arguments), function each(obj) {
      for (var prop in obj) {
        if (hasOwn.call(obj, prop) && !~index(seen, obj[prop])) {
          if (type(obj[prop]) !== 'object' || !depth) {
            result[prop] = obj[prop];
            seen.push(obj[prop]);
          } else {
            depth--;
            worker(result[prop], obj[prop]);
          }
        }
      }
    });
  }).apply(null, arguments);

  return result;
}
641399
def prop_from(self, startLayers):
        
        if self.verbosity > 2: print("Partially propagating network:")
        # find all the layers involved in the propagation
        propagateLayers = []
        # propagateLayers should not include startLayers (no loops)
        for startLayer in startLayers:
            for layer in self.layers:
                if self.path(startLayer, layer):
                    propagateLayers.append(layer)
        for layer in propagateLayers:
            if layer.active: 
                layer.netinput = (layer.weight).copy() 
        for layer in propagateLayers:
            if layer.active:
                for connection in self.connections:
                    if connection.active and connection.toLayer.name == layer.name:
                        connection.toLayer.netinput = connection.toLayer.netinput + \
                                                      Numeric.matrixmultiply(connection.fromLayer.activation,\
                                                                             connection.weight) # propagate!
                if layer.type != 'Input':
                    layer.activation = self.activationFunction(layer.netinput)
        for layer in propagateLayers:
            if layer.log and layer.active:
                layer.writeLog(self)
1044567
def _copy_net(block_out, net, temp_wv_net, mem_map):
    
    new_args = tuple(temp_wv_net[a_arg] for a_arg in net.args)
    new_dests = tuple(temp_wv_net[a_dest] for a_dest in net.dests)
    if net.op in "m@":  # special stuff for copying memories
        new_param = _get_new_block_mem_instance(net.op_param, mem_map, block_out)
    else:
        new_param = net.op_param

    new_net = LogicNet(net.op, new_param, args=new_args, dests=new_dests)
    block_out.add_net(new_net)
1131927
function copy(args) {
  // TODO: Split arguments with destructure in the future
  const source = splitArg(args.source);
  const sourceApp = source[0];
  const sourcePath = source[1];
  const dest = splitArg(args.dest);
  const destApp = dest[0];
  const destPath = dest[1];

  return login(sourceApp, destApp).then((dbs) => {
    const sourceDB = dbs[0];
    const destDB = dbs[1];

    return normalizeArgs(sourceDB, sourcePath, destDB, destPath).then((paths) => {
      const sourcePath = paths[0];
      const destPath = paths[1];

      return streamFrom(sourceDB, sourcePath).then((args) => {
        const rs = args[0];
        const size = args[1];

        return streamTo(destDB, destPath, rs, size);
      });
    });
  });
}
154067
def _compute_hidden_activations(self, X):
        """"""

        self._compute_input_activations(X)

        acts = self.input_activations_

        if (callable(self.activation_func)):
            args_dict = self.activation_args if (self.activation_args) else {}
            X_new = self.activation_func(acts, **args_dict)
        else:
            func_name = self.activation_func
            func = self._internal_activation_funcs[func_name]

            X_new = func(acts, **self._extra_args)

        return X_new
397325
def dict_copy(func):
    ""
    def proxy(*args, **kwargs):
        new_args = []
        new_kwargs = {}
        for var in kwargs:
            if isinstance(kwargs[var], dict):
                new_kwargs[var] = dict(kwargs[var])
            else:
                new_kwargs[var] = kwargs[var]
        for arg in args:
            if isinstance(arg, dict):
                new_args.append(dict(arg))
            else:
                new_args.append(arg)
        return func(*new_args, **new_kwargs)
    return proxy
703872
private RealMatrix firstLayer(RealMatrix input)
	{
		RealMatrix hidden = (this.weightsOne.multiply(input)).scalarAdd(this.biasOne);
		double[] tempValues = new double[this.hiddenLayerSize];
		
		// Logistic function used for hidden layer activation
		for(int i = 0 ; i < this.hiddenLayerSize ; i++)
		{
			tempValues[i] = 1.0 / (1.0 + Math.pow(Math.E, -1.0*hidden.getEntry(i, 0)));
		}
		
		return new Array2DRowRealMatrix(tempValues);
	}
350921
function() {
        var new_defs = [];
        for(var i=0;i<defs.length;i++) {
          var def = defs[i];
          
          if(def.type==='softmax' || def.type==='svm') {
            // add an fc layer here, there is no reason the user should
            // have to worry about this and we almost always want to
            new_defs.push({type:'fc', num_neurons: def.num_classes});
          }

          if(def.type==='regression') {
            // add an fc layer here, there is no reason the user should
            // have to worry about this and we almost always want to
            new_defs.push({type:'fc', num_neurons: def.num_neurons});
          }

          if((def.type==='fc' || def.type==='conv') 
              && typeof(def.bias_pref) === 'undefined'){
            def.bias_pref = 0.0;
            if(typeof def.activation !== 'undefined' && def.activation === 'relu') {
              def.bias_pref = 0.1; // relus like a bit of positive bias to get gradients early
              // otherwise it's technically possible that a relu unit will never turn on (by chance)
              // and will never get any gradient and never contribute any computation. Dead relu.
            }
          }

          new_defs.push(def);

          if(typeof def.activation !== 'undefined') {
            if(def.activation==='relu') { new_defs.push({type:'relu'}); }
            else if (def.activation==='sigmoid') { new_defs.push({type:'sigmoid'}); }
            else if (def.activation==='tanh') { new_defs.push({type:'tanh'}); }
            else if (def.activation==='maxout') {
              // create maxout activation, and pass along group size, if provided
              var gs = def.group_size !== 'undefined' ? def.group_size : 2;
              new_defs.push({type:'maxout', group_size:gs});
            }
            else { console.log('ERROR unsupported activation ' + def.activation); }
          }
          if(typeof def.drop_prob !== 'undefined' && def.type !== 'dropout') {
            new_defs.push({type:'dropout', drop_prob: def.drop_prob});
          }

        }
        return new_defs;
      }
780243
def putActivations(self, dict):
        
        for name in dict:
            self.layersByName[name].copyActivations( dict[name] )
490965
def defuse_activation(self):
        
        idx, nb_layers = 0, len(self.layer_list)
        while idx < nb_layers:
            layer = self.layer_list[idx]
            k_layer = self.keras_layer_map[layer]
            if (isinstance(k_layer, _keras.layers.TimeDistributed)):
                k_layer = k_layer.layer
            if (isinstance(k_layer, _keras.layers.Conv2D) or
                isinstance(k_layer, _keras.layers.Conv1D) or
                isinstance(k_layer, _keras.layers.SeparableConv2D) or
                isinstance(k_layer, _keras.layers.SeparableConv1D) or
                isinstance(k_layer, _keras.layers.Dense)):

                func_name = k_layer.activation.func_name if six.PY2 else \
                        k_layer.activation.__name__

                if func_name != 'linear':
                    # Create new layer
                    new_layer = layer + '__activation__'
                    new_keras_layer = _keras.layers.core.Activation(func_name)
                    # insert new layer after it
                    self._insert_layer_after(idx, new_layer, new_keras_layer)
                    idx += 1
                    nb_layers += 1
            idx += 1
1096164
def merge(*maps):
    """"""
    copies = map(deepcopy, maps)
    return reduce(lambda acc, val: acc.update(val) or acc, copies)
1345956
def put_images_layer(self, image_id, data):
        """"""
        return self._http_call(self.IMAGE_LAYER, put,
                               image_id=image_id, data=data)
1207494
function initArray(layer) {
       // initialize the array
       layer.layerData = new Array(layer.cols);

       for (var x = 0; x < layer.cols; x++) {
         layer.layerData[x] = new Array(layer.rows);

         for (var y = 0; y < layer.rows; y++) {
           layer.layerData[x][y] = null;
         }
       }
     }
363222
def setActivations(self, value):
        
        #if self.verify and not self.activationSet == 0:
        #    raise LayerError, \
        #          ('Activation flag not reset. Activations may have been set multiple times without any intervening call to propagate().', self.activationSet)
        Numeric.put(self.activation, Numeric.arange(len(self.activation)), value)
        self.activationSet = 1
773674
function mergeLayers(layers)
{
  var _instance = this
    , result    = null
    ;

  layers.forEach(function(layer)
  {
    layer.exts.forEach(function(ext)
    {
      ext.dirs.forEach(function(cfg)
      {
        // have customizable's array merge function
        result = merge.call({
          useCustomAdapters: merge.behaviors.useCustomAdapters,
          'array': _instance.arrayMerge,
          useCustomTypeOf: merge.behaviors.useCustomTypeOf,
          'typeof': _instance.mergeTypeOf
        }, result || {}, cfg.config);
      });
    });
  });

  // return `null` if noting found
  // and let downstream layers to make the decision
  return result;
}
531584
def defuse_activation(self):
        
        idx, nb_layers = 0, len(self.layer_list)
        while idx < nb_layers:
            layer = self.layer_list[idx]
            k_layer = self.keras_layer_map[layer]
            # unwrap time-distributed layers
            if (isinstance(k_layer, _keras.layers.TimeDistributed)):
                k_layer = k_layer.layer
            if (isinstance(k_layer, _keras.layers.convolutional.Convolution2D) or
                isinstance(k_layer, _keras.layers.convolutional.Convolution1D) or
                isinstance(k_layer, _keras.layers.core.Dense)):

                import six
                if six.PY2:
                    func_name = k_layer.activation.func_name
                else:
                    func_name = k_layer.activation.__name__

                if (func_name != 'linear'):
                    # Create new layer
                    new_layer = layer + '__activation__'
                    new_keras_layer = _keras.layers.core.Activation(func_name)
                    # insert new layer after it
                    self._insert_layer_after(idx, new_layer, new_keras_layer)
                    idx += 1
                    nb_layers += 1

            idx += 1