Put the model in generator mode if `gen_mode`, in critic mode otherwise.
320361
def switch(self, gen_mode:bool=None):
        ""
        self.gen_mode = (not self.gen_mode) if gen_mode is None else gen_mode
1213509
def _write_model_stats(self, iteration:int)->None:
        ""
        # We don't want to write stats when model is not iterated on and hence has zeroed out gradients
        gen_mode = self.learn.gan_trainer.gen_mode
        if gen_mode and not self.gen_stats_updated: self._write_gen_model_stats(iteration=iteration)
        if not gen_mode and not self.crit_stats_updated: self._write_critic_model_stats(iteration=iteration)
460521
def model_setup(self):
        
        for device in self.devman.devices:
            if self.__dict__[device].n:
                try:
                    self.__dict__[device].setup()
                except Exception as e:
                    raise e
294473
def mode(self, mode):
        
        allowed_values = ["test", "live"]
        if mode is not None and mode not in allowed_values:
            raise ValueError(
                "Invalid value for `mode` ({0}), must be one of {1}"
                .format(mode, allowed_values)
            )

        self._mode = mode
85522
def generator(self, output, target):
        ""
        fake_pred = self.gan_model.critic(output)
        return self.loss_funcG(fake_pred, target, output)
1172006
def _write_gen_model_stats(self, iteration:int)->None:
        ""
        generator = self.learn.gan_trainer.generator
        self.stats_writer.write(model=generator, iteration=iteration, tbwriter=self.tbwriter, name='gen_model_stats')
        self.gen_stats_updated = True
522312
def init_config(app):
        """"""
        for k in dir(config):
            if k.startswith('CLASSIFIER_'):
                app.config.setdefault(k, getattr(config, k))
1137325
private void initializeGeneratorProperties(ResourceGenerator generator) {
		// Initialize the generator
		if (generator instanceof InitializingResourceGenerator) {
			if (generator instanceof ConfigurationAwareResourceGenerator) {
				((ConfigurationAwareResourceGenerator) generator).setConfig(config);
			}
			if (generator instanceof TypeAwareResourceGenerator) {
				((TypeAwareResourceGenerator) generator).setResourceType(resourceType);
			}
			if (generator instanceof ResourceReaderHandlerAwareResourceGenerator) {
				((ResourceReaderHandlerAwareResourceGenerator) generator).setResourceReaderHandler(rsHandler);
			}
			if (generator instanceof WorkingDirectoryLocationAware) {
				((WorkingDirectoryLocationAware) generator).setWorkingDirectory(rsHandler.getWorkingDirectory());
			}
			if (generator instanceof PostInitializationAwareResourceGenerator) {
				((PostInitializationAwareResourceGenerator) generator).afterPropertiesSet();
			}
		}
	}
324642
def init_model(self, model, value):
        
        if value is None and self.default is not None:
            value = self.default() if callable(self.default) else self.default

        self.set_value(model, value)
269514
def update_with_tohu_generators(field_gens, adict):
    
    for name, gen in adict.items():
        if isinstance(gen, TohuUltraBaseGenerator):
            field_gens[name] = gen
1164690
def transform_generator(fn):
    """"""
    if six.PY2:
        fn.func_dict['is_transform_generator'] = True
    else:
        # py3
        fn.__dict__['is_transform_generator'] = True
    return fn
145808
function (mode) {
            var dev = this.isDevMode();
            if (dev !== mode && (mode === true || mode === false)) {
                ariaCoreAppEnvironment.setEnvironment({
                    "appSettings" : {
                        "devMode" : mode
                    }
                }, null, true);
            }
        }
609195
def set_model(self, model):
        
        if self.model:
            self.model.unregister_observer(self)
        self.model = model
        if self.model:
            self.model.register_observer(self)
            self.model_notification()
        else:
            self.set_widget(None)
        self.widget.set_sensitive(bool(self.model))
374649
def generator_checker_py3(gen, gen_type, bound_Generic, bound_typevars,
            bound_typevars_readonly, follow_fwd_refs, _recursion_check):
    
    initialized = False
    sn = None
    try:
        while True:
            a = gen.send(sn)
            if initialized or not a is None:
                if not gen_type.__args__[0] is Any and \
                        not _isinstance(a, gen_type.__args__[0], bound_Generic, bound_typevars,
                                bound_typevars_readonly, follow_fwd_refs,
                                _recursion_check):
                    tpa = deep_type(a)
                    msg = _make_generator_error_message(deep_type(a), gen, gen_type.__args__[0],
                            'has incompatible yield type')
                    _raise_typecheck_error(msg, True, a, tpa, gen_type.__args__[0])
# 					raise pytypes.ReturnTypeError(_make_generator_error_message(deep_type(a), gen,
# 							gen_type.__args__[0], 'has incompatible yield type'))
            initialized = True
            sn = yield a
            if not gen_type.__args__[1] is Any and \
                    not _isinstance(sn, gen_type.__args__[1], bound_Generic, bound_typevars,
                            bound_typevars_readonly, follow_fwd_refs, _recursion_check):
                tpsn = deep_type(sn)
                msg = _make_generator_error_message(tpsn, gen, gen_type.__args__[1],
                        'has incompatible send type')
                _raise_typecheck_error(msg, False, sn, tpsn, gen_type.__args__[1])
# 				raise pytypes.InputTypeError(_make_generator_error_message(deep_type(sn), gen,
# 						gen_type.__args__[1], 'has incompatible send type'))
    except StopIteration as st:
        # Python 3:
        # todo: Check if st.value is always defined (i.e. as None if not present)
        if not gen_type.__args__[2] is Any and \
                not _isinstance(st.value, gen_type.__args__[2], bound_Generic, bound_typevars,
                        bound_typevars_readonly, follow_fwd_refs, _recursion_check):
            tpst = deep_type(st.value)
            msg = _make_generator_error_message(tpst, gen, gen_type.__args__[2],
                    'has incompatible return type')
            _raise_typecheck_error(msg, True, st.value, tpst, gen_type.__args__[2])
# 			raise pytypes.ReturnTypeError(_make_generator_error_message(sttp, gen,
# 					gen_type.__args__[2], 'has incompatible return type'))
        raise st
259834
function isGeneration(generator) {
            assertTypeError(generator, 'function');

            var _ = this;

            return _.prototype.isPrototypeOf(generator.prototype);
        }
208404
def setModel(self, model):
        """"""
        # disconnect old signals
        try:
            self.ui.parametizer.randomizeCkbx.toggled.disconnect()
            self.ui.parametizer.randomizeCkbx.disconnect()
        except TypeError:
            # disconnecting without any current connections throws error
            pass

        self.ui.trackview.setModel(model)
        self.ui.nrepsSpnbx.setValue(model.repCount())

        self.ui.parametizer.randomizeCkbx.toggled.connect(model.randomToggle)
        self.ui.parametizer.randomizeCkbx.setChecked(bool(model.reorder()))

        # extract the QAutoParameterModel from the QStimulusModel and 
        # set in the AutoParameterView
        autoParamModel = model.autoParams()
        self.ui.parametizer.setModel(autoParamModel)
        # whether the auto parameters are emtpy 
        # affects the enable-ness of the StimlusView
        autoParamModel.emptied.connect(self.ui.trackview.emptySelection)
        autoParamModel.countChanged.connect(self.updateTraceCount)
        self.updateTraceCount()
205065
def model(self, autoGenerate=False):
        
        if self.__model is None and autoGenerate:
            self.__model = orb.system.generateModel(self)
            self.setModel(self.__model)
        return self.__model