Implement relaxation if option ``RelaxParam`` != 1.0.
192074
def relax_AX(self):
        """"""

        self.AXnr = self.cnst_A(self.X, self.Xf)
        if self.rlx == 1.0:
            self.AX = self.AXnr
        else:
            if not hasattr(self, 'c0'):
                self.c0 = self.cnst_c0()
            if not hasattr(self, 'c1'):
                self.c1 = self.cnst_c1()
            alpha = self.rlx
            self.AX = alpha*self.AXnr + (1-alpha)*self.block_cat(
                self.var_y0() + self.c0, self.var_y1() + self.c1)
288451
def setParameter(self, objID, param, value):
        
        self._connection._beginMessage(self._cmdSetID, tc.VAR_PARAMETER, objID,
                                       1 + 4 + 1 + 4 + len(param) + 1 + 4 + len(value))
        self._connection._string += struct.pack("!Bi", tc.TYPE_COMPOUND, 2)
        self._connection._packString(param)
        self._connection._packString(value)
        self._connection._sendExact()
1132580
def _parametersAsIndex( self, ps ):
        """"""
        k = ""
        for p in sorted(ps.keys()):       # normalise the parameters
            v = ps[p]
            k = k + "{p}=[[{v}]];".format(p = p, v = v)
        return k
585419
def interp(x, xp, *args, **kwargs):
    """"""
    return interpolate_1d(x, xp, *args, **kwargs)
169894
def relaxation_operators(p):
    
    k0 = np.array([[1.0, 0.0], [0.0, np.sqrt(1 - p)]])
    k1 = np.array([[0.0, np.sqrt(p)], [0.0, 0.0]])
    return k0, k1
567220
def set_parameters(self, parameter, value):
        
        if parameter == 'lo':
            self.parameters['lo'] = 1 / value
        else:
            self.parameters[parameter] = value
686514
def soft_hard(self, value):
        """"""
        if not isinstance(value, RangeCheckType):
            raise AttributeError("%s soft_hard invalid in RangeCheck." % (value,))
        self._soft_hard = value
1367122
def parametrized_bottleneck(x, hparams):
  """"""
  if hparams.bottleneck_kind == "tanh_discrete":
    d, _ = tanh_discrete_bottleneck(
        x, hparams.bottleneck_bits, hparams.bottleneck_noise * 0.5,
        hparams.discretize_warmup_steps, hparams.mode)
    return d, 0.0
  if hparams.bottleneck_kind == "isemhash":
    return isemhash_bottleneck(
        x, hparams.bottleneck_bits, hparams.bottleneck_noise * 0.5,
        hparams.discretize_warmup_steps, hparams.mode,
        hparams.isemhash_noise_dev, hparams.isemhash_mix_prob)
  if hparams.bottleneck_kind == "vq":
    return vq_discrete_bottleneck(x, hparams.bottleneck_bits, hparams.vq_beta,
                                  hparams.vq_decay, hparams.vq_epsilon)
  if hparams.bottleneck_kind == "em":
    return vq_discrete_bottleneck(
        x,
        hparams.bottleneck_bits,
        hparams.vq_beta,
        hparams.vq_decay,
        hparams.vq_epsilon,
        soft_em=True,
        num_samples=hparams.vq_num_samples)
  if hparams.bottleneck_kind == "gumbel_softmax":
    return gumbel_softmax_discrete_bottleneck(
        x,
        hparams.bottleneck_bits,
        hparams.vq_beta,
        hparams.vq_decay,
        hparams.vq_epsilon,
        hparams.temperature_warmup_steps,
        hard=False,
        summary=True)

  raise ValueError(
      "Unsupported hparams.bottleneck_kind %s" % hparams.bottleneck_kind)
1212753
def optimized(code, silent=True, ignore_errors=True):
    """"""
    return constant_fold(code, silent=silent, ignore_errors=ignore_errors)
1269229
def relax_isometry(self):
        """"""
        for ii in range(self.relaxation_kwds['niter']):
            self.H = self.compute_dual_rmetric()

            self.loss = self.rieman_loss()
            self.trace_var.update(ii,self.H,self.Y,self.eta,self.loss)
            self.trace_var.print_report(ii)
            self.trace_var.save_backup(ii)

            self.compute_gradient()

            self.make_optimization_step(first_iter=(ii == 0))

        self.H = self.compute_dual_rmetric()

        self.trace_var.update(-1,self.H,self.Y,self.eta,self.loss)
        self.trace_var.print_report(ii)
        tracevar_path = os.path.join(self.trace_var.backup_dir, 'results.pyc')
        TracingVariable.save(self.trace_var,tracevar_path)
434134
def simxSetBooleanParameter(clientID, paramIdentifier, paramValue, operationMode):
    '''
    
    '''

    return c_SetBooleanParameter(clientID, paramIdentifier, paramValue, operationMode)
854246
function EaseRate (opts) {
    EaseRate.superclass.constructor.call(this, opts)

    this.rate = opts.rate
}
415429
def reset_params(self):
        """"""
        units = [N_FEATURES]
        units += [self.hidden_units] * self.num_hidden
        units += [N_CLASSES]

        sequence = []
        for u0, u1 in zip(units, units[1:]):
            sequence.append(nn.Linear(u0, u1))
            sequence.append(self.nonlin)
            sequence.append(nn.Dropout(self.dropout))

        sequence = sequence[:-2]
        self.sequential = nn.Sequential(*sequence)
1267587
def get_stress(self, a):
        """"""
        s = np.zeros( 6, dtype=float )
        for c in self.calcs:
            s += c.get_stress(a)
        return s
1337003
def relax_AX(self):
        """"""

        self.AXnr = self.cnst_A(self.X, self.Xf)
        if self.rlx == 1.0:
            self.AX = self.AXnr
        else:
            alpha = self.rlx
            self.AX = alpha*self.AXnr + (1-alpha)*self.block_cat(
                self.var_y0() + self.S, self.var_y1())
746144
def accept(self):
        """"""
        input_path = self.input_path.text()
        input_title = self.line_edit_title.text()
        input_source = self.line_edit_source.text()
        output_path = self.output_path.text()
        if not output_path.endswith('.tif'):
            # noinspection PyArgumentList,PyCallByClass,PyTypeChecker
            QMessageBox.warning(
                self,
                tr('InaSAFE'),
                tr('Output file name must be tif file'))
        if not os.path.exists(input_path):
            # noinspection PyArgumentList,PyCallByClass,PyTypeChecker
            QMessageBox.warning(
                self,
                tr('InaSAFE'),
                tr('Input file does not exist'))
            return

        algorithm = 'nearest'
        if self.nearest_mode.isChecked():
            algorithm = 'nearest'
        elif self.inverse_distance_mode.isChecked():
            algorithm = 'invdist'
        elif self.use_ascii_mode.isChecked():
            algorithm = 'use_ascii'

        # Smoothing
        smoothing_method = NONE_SMOOTHING
        if self.numpy_smoothing.isChecked():
            smoothing_method = NUMPY_SMOOTHING
        if self.scipy_smoothing.isChecked():
            smoothing_method = SCIPY_SMOOTHING

        # noinspection PyUnresolvedReferences
        QgsApplication.instance().setOverrideCursor(
            QtGui.QCursor(QtCore.Qt.WaitCursor)
        )

        extra_keywords = {}
        if self.check_box_custom_shakemap_id.isChecked():
            event_id = self.line_edit_shakemap_id.text()
            extra_keywords[extra_keyword_earthquake_event_id['key']] = event_id

        current_index = self.combo_box_source_type.currentIndex()
        source_type = self.combo_box_source_type.itemData(current_index)
        if source_type:
            extra_keywords[
                extra_keyword_earthquake_source['key']] = source_type

        file_name = convert_mmi_data(
            input_path,
            input_title,
            input_source,
            output_path,
            algorithm=algorithm,
            algorithm_filename_flag=True,
            smoothing_method=smoothing_method,
            extra_keywords=extra_keywords
        )

        file_info = QFileInfo(file_name)
        base_name = file_info.baseName()
        self.output_layer = QgsRasterLayer(file_name, base_name)

        # noinspection PyUnresolvedReferences
        QgsApplication.instance().restoreOverrideCursor()

        if self.load_result.isChecked():
            # noinspection PyTypeChecker
            mmi_ramp_roman(self.output_layer)
            self.output_layer.saveDefaultStyle()
            if not self.output_layer.isValid():
                LOGGER.debug("Failed to load")
            else:
                # noinspection PyArgumentList
                QgsProject.instance().addMapLayer(self.output_layer)
                iface.zoomToActiveLayer()

        if (self.keyword_wizard_checkbox.isChecked()
                and self.keyword_wizard_checkbox.isEnabled()):
            self.launch_keyword_wizard()

        self.done(self.Accepted)
768739
def cbpdnmd_relax(k):
    

    mp_Z_X[k] = mp_xrlx * mp_Z_X[k] + (1 - mp_xrlx) * mp_Z_Y1[k]
    mp_DX[k] = mp_xrlx * mp_DX[k] + (1 - mp_xrlx) * (mp_Z_Y0[k] + mp_S[k])