Makes sure that the specified number of layers to squash
        is a valid number
511599
def _validate_number_of_layers(self, number_of_layers):
        

        # Only positive numbers are correct
        if number_of_layers <= 0:
            raise SquashError(
                "Number of layers to squash cannot be less or equal 0, provided: %s" % number_of_layers)

        # Do not squash if provided number of layer to squash is bigger
        # than number of actual layers in the image
        if number_of_layers > len(self.old_image_layers):
            raise SquashError(
                "Cannot squash %s layers, the %s image contains only %s layers" % (number_of_layers, self.image, len(self.old_image_layers)))
741577
def set_layer(self, name: str, matrix: np.ndarray, chunks: Tuple[int, int] = (64, 64), chunk_cache: int = 512, dtype: str = "float32", compression_opts: int = 2) -> None:
		
		deprecated("'set_layer' is deprecated. Use 'ds.layer.Name = matrix' or 'ds.layer['Name'] = matrix' instead")
		self.layers[name] = matrix
701219
def check_consistent_parameter_grouping(self):
        
        parameter_groups = {}
        if self.indices_per_axis is not None:
            parameter_groups["indices_per_axis"] = \
                {"self.indices_per_axis": self.indices_per_axis}
        if (self.split_size is not None) or (self.split_num_slices_per_axis is not None):
            parameter_groups["split_size"] = \
                {
                    "self.split_size": self.split_size,
                    "self.split_num_slices_per_axis": self.split_num_slices_per_axis,
            }
        if self.tile_shape is not None:
            parameter_groups["tile_shape"] = \
                {"self.tile_shape": self.tile_shape}
        if self.max_tile_bytes is not None:
            parameter_groups["max_tile_bytes"] = \
                {"self.max_tile_bytes": self.max_tile_bytes}
        if self.max_tile_shape is not None:
            if "max_tile_bytes" not in parameter_groups.keys():
                parameter_groups["max_tile_bytes"] = {}
            parameter_groups["max_tile_bytes"]["self.max_tile_shape"] = self.max_tile_shape
        if self.sub_tile_shape is not None:
            if "max_tile_bytes" not in parameter_groups.keys():
                parameter_groups["max_tile_bytes"] = {}
            parameter_groups["max_tile_bytes"]["self.sub_tile_shape"] = self.sub_tile_shape

        self.logger.debug("parameter_groups=%s", parameter_groups)

        if len(parameter_groups.keys()) > 1:
            group_keys = sorted(parameter_groups.keys())
            raise ValueError(
                "Got conflicting parameter groups specified, "
                +
                "should only specify one group to define the split:\n"
                +
                (
                    "\n".join(
                        [
                            (
                                ("Group %18s: " % ("'%s'" % group_key))
                                +
                                str(parameter_groups[group_key])
                            )
                            for group_key in group_keys
                        ]
                    )
                )
            )
        if len(parameter_groups.keys()) <= 0:
            raise ValueError(
                "No split parameters specified, need parameters from one of the groups: "
                +
                "'indices_per_axis', 'split_size', 'tile_shape' or 'max_tile_bytes'"
            )
1029374
protected void rnnUpdateStateWithTBPTTState() {
        for (int i = 0; i < layers.length; i++) {
            if (layers[i] instanceof RecurrentLayer) {
                RecurrentLayer l = ((RecurrentLayer) layers[i]);
                l.rnnSetPreviousState(l.rnnGetTBPTTState());
            } else if (layers[i] instanceof MultiLayerNetwork) {
                ((MultiLayerNetwork) layers[i]).updateRnnStateWithTBPTTState();
            }
        }
    }
903534
def as_number(self):
		
		def combine(subver, ver):
			return subver / 10 + ver
		return reduce(combine, reversed(self.version))
29092
public static void assertNOutSet(String layerType, String layerName, long layerIndex, long nOut) {
        if (nOut <= 0) {
            if (layerName == null)
                layerName = "(name not set)";
            throw new DL4JInvalidConfigException(layerType + " (index=" + layerIndex + ", name=" + layerName + ") nOut="
                            + nOut + "; nOut must be > 0");
        }
    }
478334
def freeze(self, number=None):
        
        if number is None:
            number = self.head_layers

        for idx, child in enumerate(self.model.children()):
            if idx < number:
                mu.freeze_layer(child)
1118380
public void rnnSetPreviousState(int layer, Map<String, INDArray> state) {
        rnnSetPreviousState(layers[layer].conf().getLayer().getLayerName(), state);
    }
362390
def verifyArguments(self, arg):
        
        for l in arg:
            if not type(l) == list and \
               not type(l) == type(Numeric.array([0.0])) and \
               not type(l) == tuple and \
               not type(l) == dict:
                return 0
            if type(l) == dict:
                for i in l:
                    if not type(i) == str and i not in list(self.layers.keys()):
                        return 0
            else:
                for i in l:
                    if not type(i) == float and not type(i) == int:
                        return 0
        return 1
196657
private int getBatchNormAxis(Map<String, Object> layerConfig)
            throws InvalidKerasConfigurationException {
        Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
        return (int) innerConfig.get(LAYER_FIELD_AXIS);
    }
277763
public void rnnClearPreviousState() {
        if (layers == null)
            return;
        for (int i = 0; i < layers.length; i++) {
            if (layers[i] instanceof RecurrentLayer)
                ((RecurrentLayer) layers[i]).rnnClearPreviousState();
            else if (layers[i] instanceof MultiLayerNetwork) {
                ((MultiLayerNetwork) layers[i]).rnnClearPreviousState();
            } else if(layers[i] instanceof BaseWrapperLayer && ((BaseWrapperLayer)layers[i]).getUnderlying() instanceof RecurrentLayer){
                ((RecurrentLayer) ((BaseWrapperLayer)layers[i]).getUnderlying()).rnnClearPreviousState();
            }
        }
    }
520731
def _check_input(image, init_level_set):
    """"""
    if not image.ndim in [2, 3]:
        raise ValueError("`image` must be a 2 or 3-dimensional array.")

    if len(image.shape) != len(init_level_set.shape):
        raise ValueError("The dimensions of the initial level set do not "
                         "match the dimensions of the image.")
935851
def valid? number
      raise_on_type_mismatch number
      num, check = split_number(number)
      self.of(num) == check
    end
1067372
def setLayer(self, layer):
        
        if layer == self._layer:
            return False

        self._layer = layer
        self.syncLayerData()

        return True
1331840
public void rnnSetPreviousState(String layerName, Map<String, INDArray> state) {
        Layer l = verticesMap.get(layerName).getLayer();
        if(l instanceof org.deeplearning4j.nn.layers.wrapper.BaseWrapperLayer){
            l = ((org.deeplearning4j.nn.layers.wrapper.BaseWrapperLayer)l).getUnderlying();
        }
        if (l == null || !(l instanceof RecurrentLayer)) {
            throw new UnsupportedOperationException(
                    "Layer \"" + layerName + "\" is not a recurrent layer. Cannot set state");
        }
        ((RecurrentLayer) l).rnnSetPreviousState(state);
    }
993443
def Residual(*layers, **kwargs):
  """"""
  shortcut = kwargs.get('shortcut', Identity())  # pylint: disable=no-value-for-parameter
  if len(layers) > 1:
    return Serial(
        Branch(),  # pylint: disable=no-value-for-parameter
        Parallel(Serial(*layers), shortcut),
        SumBranches()  # pylint: disable=no-value-for-parameter
    )
  elif len(layers) == 1:
    return Serial(
        Branch(),  # pylint: disable=no-value-for-parameter
        Parallel(layers[0], shortcut),
        SumBranches()  # pylint: disable=no-value-for-parameter
    )
  else:
    raise ValueError('Empty residual combinator.')
288325
def make_layer_stack(layers=gin.REQUIRED, num_layers=6):
  
  return LayerStack([cls() for cls in layers] * num_layers)