Set Back-off to Static
        Set the sampler parameters for static back off
    Inputs :
        max_steps :
            maximum optimization steps to be taken
        step_size : 
            the step size of the back-off
517980
def static(self, max_steps, step_size):
        
        self._dynamic = False
        # begin checks      
        try : 
            self._max_steps = int(max_steps)
        except :
            print("Error: Input 1 (max_steps) has to be an int.")
            return 0
        try : 
            assert self._max_steps >= 0
        except : 
            print("Warning: Input 1 (max_steps) has to be non-negative.")
            print("Setting max_steps to 0.")
            self._max_steps = 0

        if max_steps > 0 :
            try : 
                assert step_size == float(step_size)
            except AssertionError :
                print("Warning: Input 2 (step_size) is not a float. Converted.")
                step_size = float(step_size)
            except :
                print("Error: Input 2 (step_size) has to be a float.")
                return 0

            try : 
                assert 0. < step_size < 1.
            except : 
                print("Warning: Input 2 (step_size) has to be between 0 and 1.")
                print("Setting step_size to 0.2.")
                step_size = 0.2
            self._step_size = step_size
            if step_size**max_steps < 10**(-15):
                print("Warning: Back-off gets dangerously small.")
860428
def setbpf(self, bpf):
        """"""
        self._bpf = min(bpf, self.BPF)
        self._rng_n = int((self._bpf + self.RNG_RANGE_BITS - 1) / self.RNG_RANGE_BITS)
932270
def make_step(
    net,
    step_size = 1.5,
    end       = "inception_4c/output", 
    jitter    = 32,
    clip      = True,
    objective = objective_L2
    ):
    '''
    
    '''

    src = net.blobs["data"]
    dst = net.blobs[end]

    ox, oy = np.random.randint(- jitter, jitter + 1, 2)
    # Apply jitter shift.
    src.data[0] = np.roll(np.roll(src.data[0], ox, -1), oy, -2)

    # Specify the optimisation objective.
    net.forward(end = end)
    objective(dst)
    net.backward(start = end)
    g = src.diff[0]
    # Apply normalised ascent step to the input image.
    src.data[:] += step_size / np.abs(g).mean() * g
    # Unshift the image.
    src.data[0] = np.roll(np.roll(src.data[0], - ox, - 1), -oy, -2)
            
    if clip:
        bias = net.transformer.mean["data"]
        src.data[:] = np.clip(src.data, -bias, 255-bias)
1031638
private List<Float> interpolateDownwards(float max, int steps) {

        List<Float> result = new ArrayList<Float>();
        if (max > 0) {
            // We try to generate a "nice" descending list of non-negative floats
            // where the step size is bigger for bigger "max" values.
            float base = (max > 1) ? (float)Math.floor(max) : max;
            float stepSize = 1000f;

            // reduce step size until the smallest element is greater than max/10.
            while ((base - (steps * stepSize)) < (max / 10.0f)) {
                stepSize = reduceStepSize(stepSize);
            }
            // we have determined the step size, now we generate the actual numbers
            for (int i = 0; i < steps; i++) {
                result.add(new Float(base - ((i + 1) * stepSize)));
            }
            Collections.reverse(result);
        } else {
            LOG.warn("Invalid navpos value: " + max);
            for (int i = 0; i < steps; i++) {
                result.add(new Float(max - (i + 1)));
            }
            Collections.reverse(result);
        }
        return result;
    }
1202744
def maximum_paths=(val)
      set_args_keys(state: (val == default_maximum_paths) ? 'no' : '',
                    num:   (val == default_maximum_paths) ? '' : val)
      config_set('bgp_af', 'maximum_paths', @set_args)
    end
189826
def sample_frame_single_env(self, batch_size, forward_steps=1):
        
        # Whole idea of this function is to make sure that sample we take is far away from the point which we are
        # currently writing to the buffer, which is 'discontinuous'

        if self.current_size < self.buffer_capacity:
            # Sample from up to total size of the buffer
            # -1 because we cannot take the last one
            return np.random.choice(self.current_size - forward_steps, batch_size, replace=False)
        else:
            candidate = np.random.choice(self.buffer_capacity, batch_size, replace=False)

            forbidden_ones = (
                np.arange(self.current_idx - forward_steps + 1, self.current_idx + self.frame_history)
                % self.buffer_capacity
            )

            # Exclude these frames for learning as they may have some part of history overwritten
            while any(x in candidate for x in forbidden_ones):
                candidate = np.random.choice(self.buffer_capacity, batch_size, replace=False)

            return candidate
612678
def assign_step_methods(self, verbose=-1, draw_from_prior_when_possible=True):
        

        if not self._sm_assigned:

            if draw_from_prior_when_possible:
                # Assign dataless stepper first
                last_gen = set([])
                for s in self.stochastics - self.observed_stochastics:
                    if s._random is not None:
                        if len(s.extended_children) == 0:
                            last_gen.add(s)

                dataless, dataless_gens = crawl_dataless(
                    set(last_gen), [last_gen])
                if len(dataless):
                    new_method = DrawFromPrior(
                        dataless,
                        dataless_gens[::-1],
                        verbose=verbose)
                    setattr(new_method, '_model', self)
                    for d in dataless:
                        if not d.observed:
                            self.step_method_dict[d].append(new_method)
                            if self.verbose > 1:
                                print_(
                                    'Assigning step method %s to stochastic %s' %
                                    (new_method.__class__.__name__, d.__name__))

            for s in self.stochastics:
                # If not handled by any step method, make it a new step method
                # using the registry
                if len(self.step_method_dict[s]) == 0:
                    new_method = assign_method(s, verbose=verbose)
                    setattr(new_method, '_model', self)
                    self.step_method_dict[s].append(new_method)
                    if self.verbose > 1:
                        print_(
                            'Assigning step method %s to stochastic %s' %
                            (new_method.__class__.__name__, s.__name__))

            self.step_methods = set()
            for s in self.stochastics:
                self.step_methods |= set(self.step_method_dict[s])

            for sm in self.step_methods:
                if sm.tally:
                    for name in sm._tuning_info:
                        self._funs_to_tally[
                            sm._id + '_' + name] = lambda name=name, sm=sm: getattr(sm, name)

        else:
            # Change verbosity for step methods
            for sm_key in self.step_method_dict:
                for sm in self.step_method_dict[sm_key]:
                    sm.verbose = verbose

        self.restore_sm_state()
        self._sm_assigned = True
483000
def setMaximumPixmapSize(self, size):
        
        self._maximumPixmapSize = size
        position = self.position()
        self._position = None
        self.setPosition(position)
188347
def set_parameters(self):
        
        for key in dir(self):
            if key.startswith('REQUIRES_'):
                setattr(self, key, getattr(self.gmpe, key))
            if key.startswith('DEFINED_'):
                if not key.endswith('FOR_INTENSITY_MEASURE_TYPES'):
                    setattr(self, key, getattr(self.gmpe, key))
1125706
def setMaximum(self, maximum):
        
        if not isinstance(maximum, int):
            raise TypeError("Argument is not of type int or long")
        self._maximum = maximum
612621
public void setLimits(long length, long milliseconds, long rateKBps) {
        maxLength = (length>0) ? length : Long.MAX_VALUE;
        timeoutMs = (milliseconds>0) ? milliseconds : Long.MAX_VALUE;
        maxRateBytesPerMs = (rateKBps>0) ? rateKBps*1024/1000 : Long.MAX_VALUE;
    }
963159
def step(self, **args):
        
        if self.sequenceType == None:
            raise AttributeError("""sequenceType not set! Use SRN.setSequenceType() """)
        # take care of any params other than layer names:
        # two ways to clear context:
        # 1. force it to right now with arg initContext = 1:
        if 'initContext' in args:
            if args['initContext']:
                self.setContext()
            del args['initContext']
        # 2. have initContext be true
        elif self.initContext:
            self.setContext()
        # if initContext is off, then we assume user knows that,
        # so we reset the flags on all context layers:
        if self.initContext == 0:
            for context in list(self.contextLayers.values()):
                context.activationSet = 1
        # replace all patterns
        for key in args:
            args[key] = self.replacePatterns( args[key], key )
        # Get all of the input/output layer names:
        inputBankNames = [layer.name for layer in self.layers if layer.kind == 'Input']
        outputBankNames = [layer.name for layer in self.layers if layer.kind == 'Output']
        inputBankSizes = [layer.size for layer in self.layers if layer.kind == 'Input']
        inputBankTotalSize = sum(inputBankSizes)
        inputArgSizes = [len(args[name]) for name in inputBankNames if name in args]
        inputArgTotalSize = sum(inputArgSizes)
        sequenceLength = inputArgTotalSize // inputBankTotalSize
        learning = self.learning
        totalRetvals = (0.0, 0, 0) # error, correct, total
        totalPCorrect = {}
        for step in range(sequenceLength):
            if self.verbosity >= 1 or self.interactive:
                print("-----------------------------------Step #", step + 1)
            dict = {}
            dict.update(args) # in case context, or others
            # now, overwrite input and output, if necessary
            for name in inputBankNames:
                if name in args:
                    patternLength = self[name].size
                    offset = step * patternLength
                    if (offset + patternLength) >= len(args[name]):
                        # if this seq is too big, use last part:
                        dict[name] = args[name][-patternLength:]
                    else:
                        # else, go to the right spot in seq:
                        dict[name] = args[name][offset:offset+patternLength]
            for name in outputBankNames:
                if name in args:
                    patternLength = self[name].size
                    offset = step * patternLength
                    if (offset + patternLength) >= len(args[name]):
                        # if this seq is too big, use last part:
                        dict[name] = args[name][-patternLength:]
                    else:
                        # else, go to the right spot in seq:
                        dict[name] = args[name][offset:offset+patternLength]
            # get info for predicition -------------------------
            for p in self.prediction:
                (inName, outName) = p
                inLayer = self.getLayer(inName)
                if not inLayer.type == 'Input':
                    raise LayerError('Prediction input layer not type \'Input\'.', inLayer.type)
                outLayer = self.getLayer(outName)
                if not outLayer.type == 'Output':
                    raise LayerError('Prediction output layer not type \'Output\'.', outLayer.type)
                if step == sequenceLength - 1: # last one in sequence; what do we do?
                    start = 0 # wrap to next input vector
                    if not self._sweeping: # not in sweep, in step, no target
                        raise LayerError("Attempting to predict last item in sequence, but using step(). Use sweep() instead.")
                    else: # in a sweep, so get the next pattern if one:
                        if self.currentSweepCount == None: # last item in epoch, predict back to first pattern
                            # Train it to predict first pattern, first sequence item
                            pattern = self.getData(self.loadOrder[0])
                            for key in pattern:
                                pattern[key] = self.replacePatterns( pattern[key], key )
                            if inName in inputBankNames:
                                if inName in pattern:
                                    dict[outName] = pattern[inName][start:start+patternLength]
                            #dict[outName] = pattern["input"][start:start+patternLength]
                        else:
                            pattern = self.getData(self.loadOrder[self.currentSweepCount+1]) 
                            for key in pattern:
                                pattern[key] = self.replacePatterns( pattern[key], key )
                            if inName in inputBankNames:
                                if inName in pattern:
                                    dict[outName] = pattern[inName][start:start+patternLength]
                            #dict[outName] = pattern["input"][start:start+patternLength]
                else: # in middle of sequence
                    start = (step + 1) * inLayer.size
                    dict[outName] = args[inName][start:start+patternLength]
            # end predicition code -----------------------------
            if step < sequenceLength - 1: # not the last one
                if not self.learnDuringSequence:
                    self.learning = 0
            retvals = self.networkStep(**dict)
            self.learning = learning # in case we turned it off
            totalRetvals = list(map(lambda x,y: x+y, totalRetvals[:3], retvals[:3]))
            sumMerge(totalPCorrect, retvals[3])
            totalRetvals.append( totalPCorrect)
        return totalRetvals
758621
public void setMaximumInstances(int maximumInstances) {
        int newValue = maximumInstances < 0 ? 0 : maximumInstances;

        if (this.maximumInstances != newValue) {
            this.maximumInstances = newValue;

            getConfig().setProperty(PARAM_MAXIMUM_INSTANCES, this.maximumInstances);
        }
    }
620540
def set_params(self, **params):
        
        items = self.steps
        names, _ = zip(*items)

        keys = list(six.iterkeys(params))

        for name in keys:
            if '__' not in name and name in names:
                # replace an estimator
                self._replace_estimator('steps', name, params.pop(name))

            if callable(params[name]):
                # use a callable or function to set parameters
                params[name] = params[name](params)

            elif params[name] in keys:
                # set one arg from another
                params[name] = params[params[name]]

        BaseEstimator.set_params(self, **params)
        return self
325566
def on_step_end(self, **kwargs):
        ""
        if not self.learn.gan_trainer.gen_mode: self.learn.opt.lr /= self.mult_lr
675957
private function setMaxSteps(int $maxSteps): void
    {
        $this->maxSteps = \max(0, $maxSteps);
        $this->stepWidth = $this->maxSteps ? Str::len($this->maxSteps) : 2;
    }
942635
public void setMaxProgress(int newMaxProgress) {
        if (getProgress() <= newMaxProgress) {
            maxProgress = newMaxProgress;
        }
        else {
            throw new IllegalArgumentException(
                    String.format("MaxProgress cant be smaller than the current progress %d<%d", getProgress(), newMaxProgress));
        }
        invalidate();
        BootstrapProgressBarGroup parent = (BootstrapProgressBarGroup) getParent();
    }