Initialize all non-batchnorm layers of `m` with `init_func`.
162598
def apply_init(m, init_func:LayerFunc):
    ""
    apply_leaf(m, partial(cond_init, init_func=init_func))
1334216
def _init_iter(self, X, y, is_train):
        """"""
        if isinstance(X, (np.ndarray, nd.NDArray)):
            if y is None:
                if is_train:
                    raise ValueError('y must be specified when X is numpy.ndarray')
                else:
                    y = np.zeros(X.shape[0])
            if not isinstance(y, (np.ndarray, nd.NDArray)):
                raise TypeError('y must be ndarray when X is numpy.ndarray')
            if X.shape[0] != y.shape[0]:
                raise ValueError("The numbers of data points and labels not equal")
            if y.ndim == 2 and y.shape[1] == 1:
                y = y.flatten()
            if y.ndim != 1:
                raise ValueError("Label must be 1D or 2D (with 2nd dimension being 1)")
            if is_train:
                return io.NDArrayIter(X, y, min(X.shape[0], self.numpy_batch_size),
                                      shuffle=is_train, last_batch_handle='roll_over')
            else:
                return io.NDArrayIter(X, y, min(X.shape[0], self.numpy_batch_size), shuffle=False)
        if not isinstance(X, io.DataIter):
            raise TypeError('X must be DataIter, NDArray or numpy.ndarray')
        return X
995403
def initialize_all_targets():
    
    ffi.lib.LLVMPY_InitializeAllTargetInfos()
    ffi.lib.LLVMPY_InitializeAllTargets()
    ffi.lib.LLVMPY_InitializeAllTargetMCs()
1327532
def init(name, runtime):
    """"""
    runtime = click.unstyle(runtime)

    stdout.write(
        style.format_command(
            'Initializing',
            '%s %s %s' % (name, style.gray('@'), style.green(runtime))
        )
    )

    config = Config(os.getcwd())
    config.set('runtime', runtime)
    config.save()

    generate.main(['init', name], standalone_mode=False)
    run.main(['python', 'manage.py', 'migrate'])
1232764
def init():
    
    global ASMS
    global ASMCOUNT
    global AT_END
    global FLAG_end_emitted
    global FLAG_use_function_exit

    __common.init()

    ASMS = {}
    ASMCOUNT = 0
    AT_END = []
    FLAG_use_function_exit = False
    FLAG_end_emitted = False

    # Default code ORG
    OPTIONS.add_option('org', int, 32768)
    # Default HEAP SIZE (Dynamic memory) in bytes
    OPTIONS.add_option('heap_size', int, 4768)  # A bit more than 4K
    # Labels for HEAP START (might not be used if not needed)
    OPTIONS.add_option('heap_start_label', str, 'ZXBASIC_MEM_HEAP')
    # Labels for HEAP SIZE (might not be used if not needed)
    OPTIONS.add_option('heap_size_label', str, 'ZXBASIC_HEAP_SIZE')
    # Flag for headerless mode (No prologue / epilogue)
    OPTIONS.add_option('headerless', bool, False)
288690
def _initialize_cfg(self):
        

        self.kb.functions = FunctionManager(self.kb)

        self._jobs_to_analyze_per_function = defaultdict(set)
        self._completed_functions = set()
964262
def init_hidden(self, batch_size):
        

        b = 2 if self.bidirectional else 1
        if self.use_cuda:
            return (
                torch.zeros(self.num_layers * b, batch_size, self.lstm_hidden).cuda(),
                torch.zeros(self.num_layers * b, batch_size, self.lstm_hidden).cuda(),
            )
        else:
            return (
                torch.zeros(self.num_layers * b, batch_size, self.lstm_hidden),
                torch.zeros(self.num_layers * b, batch_size, self.lstm_hidden),
            )
531654
def initialize_training(self, training_info: TrainingInfo, model_state=None, hidden_state=None):
        
        if model_state is None:
            self.model.reset_weights()
        else:
            self.model.load_state_dict(model_state)
321798
def on_batch_begin(self, train, **kwargs):
        ""
        if not self.learn.gan_trainer.gen_mode and train: self.learn.opt.lr *= self.mult_lr
156209
def _init_model(self):
        
        model = Sequential()
        model.add(ConvLSTM2D(filters=self.filters, kernel_size=self.kernel_size, activation=self.activation,
                             input_shape=[self.time_delay] + list(self.image_size) + [self.channels],
                             data_format='channels_last', return_sequences=True))
        model.add(BatchNormalization())
        model.add(ConvLSTM2D(filters=self.filters, kernel_size=self.kernel_size, activation=self.activation,
                             input_shape=(self.time_delay, self.channels) + self.image_size,
                             data_format='channels_last', return_sequences=True))
        model.add(BatchNormalization())
        model.add(ConvLSTM2D(filters=self.filters, kernel_size=self.kernel_size, activation=self.activation))
        model.add(BatchNormalization())
        model.add(Conv2D(filters=1, kernel_size=self.kernel_size, activation="sigmoid", data_format="channels_last"))
        model.add(Flatten())
        model.add(Dense(units=len(self.emotion_map.keys()), activation="sigmoid"))
        if self.verbose:
            model.summary()
        self.model = model
647199
def init_nn_params(scale, layer_sizes, rs=npr.RandomState(0)):
    """"""
    return [(rs.randn(insize, outsize) * scale,   # weight matrix
             rs.randn(outsize) * scale)           # bias vector
            for insize, outsize in zip(layer_sizes[:-1], layer_sizes[1:])]
935654
def initialized(func):
    

    def wrapper(self, *args, **kwargs):
        """ internal wrapper function """
        if not self.__is_initialized__:
            return EmptyDot()
        return func(self, *args, **kwargs)
    return wrapper
93516
def initialize__(cls):
        
        [cls.new(level=r[0], name=r[1]) for r in cls.ROLES]
243301
def _init_torch_module():
    """"""
    plist = ctypes.POINTER(FunctionHandle)()
    size = ctypes.c_uint()
    check_call(_LIB.MXListFunctions(ctypes.byref(size),
                                    ctypes.byref(plist)))

    module_obj = sys.modules[__name__]
    for i in range(size.value):
        hdl = FunctionHandle(plist[i])
        function = _make_torch_function(hdl)
        # if function name starts with underscore, register as static method of NDArray
        if function is not None:
            setattr(module_obj, function.__name__, function)
203280
def initialize_parameters(self, initializer: mx.init.Initializer, allow_missing_params: bool):
        
        self.module.init_params(initializer=initializer,
                                arg_params=self.params,
                                aux_params=self.aux_params,
                                allow_missing=allow_missing_params,
                                force_init=False)
203520
function init (func) {
    func = ensureFunc(func);
    cache = undefined;
    deps = parseDepsFromFunc(func);
  }
279417
def _initilize(self, state: State) -> State:
        """"""

        targets = {}
        for pc, instr in enumerate(self):
            if isinstance(instr, Label):
                targets[instr.target] = pc

        state = state.update({PC: 0,
                              TARGETS: targets,
                              NAMEDGATES: STDGATES.copy()})
        return state