rlmb_dqn_base params.
359727
def rlmb_dqn_base():
  """"""
  hparams = _rlmb_base()
  simulated_rollout_length = 10
  dqn_params = dict(
      base_algo="dqn",
      base_algo_params="dqn_original_params",
      real_batch_size=1,
      simulated_batch_size=16,
      dqn_agent_generates_trainable_dones=False,
      eval_batch_size=1,
      # Must be equal to dqn_time_limit for now
      simulated_rollout_length=simulated_rollout_length,
      dqn_time_limit=simulated_rollout_length,
      simulation_flip_first_random_for_beginning=False,
      dqn_eval_episodes_num=3,

      # TODO(kc): only for model-free compatibility, remove this
      epochs_num=-1,
  )
  update_hparams(hparams, dqn_params)
  return hparams
570945
def init_params(net):
    """"""
    for module in net.modules():
        if isinstance(module, nn.Conv2d):
            init.kaiming_normal(module.weight, mode="fan_out")
            if module.bias:
                init.constant(module.bias, 0)
        elif isinstance(module, nn.BatchNorm2d):
            init.constant(module.weight, 1)
            init.constant(module.bias, 0)
        elif isinstance(module, nn.Linear):
            init.normal(module.weight, std=1e-3)
            if module.bias:
                init.constant(module.bias, 0)
1272771
def revnet_base():
  """"""
  hparams = common_hparams.basic_params1()
  hparams.add_hparam('num_channels', [64, 128, 256, 416])
  hparams.add_hparam('num_layers_per_block', [1, 1, 10, 1])
  hparams.add_hparam('bottleneck', True)
  hparams.add_hparam('first_batch_norm', [False, True, True, True])
  hparams.add_hparam('init_stride', 2)
  hparams.add_hparam('init_kernel_size', 7)
  hparams.add_hparam('init_maxpool', True)
  hparams.add_hparam('strides', [1, 2, 2, 2])
  hparams.add_hparam('num_channels_init_block', 64)
  hparams.add_hparam('dim', '2d')

  # Variable init
  hparams.initializer = 'normal_unit_scaling'
  hparams.initializer_gain = 2.

  # Optimization
  hparams.optimizer = 'Momentum'
  hparams.optimizer_momentum_momentum = 0.9
  hparams.optimizer_momentum_nesterov = True
  hparams.weight_decay = 1e-4
  hparams.clip_grad_norm = 0.0
  # (base_lr=0.1) * (batch_size=128*8 (on TPU, or 8 GPUs)=1024) / (256.)
  hparams.learning_rate = 0.4
  hparams.learning_rate_decay_scheme = 'cosine'
  # For image_imagenet224, 120k training steps, which effectively makes this a
  # cosine decay (i.e. no cycles).
  hparams.learning_rate_cosine_cycle_steps = 120000

  # Can run with a batch size of 128 with Problem ImageImagenet224
  hparams.batch_size = 128
  return hparams
844464
def map_parameters(cls, params):
        """"""

        d = {}
        for k, v in six.iteritems(params):
            d[cls.FIELD_MAP.get(k.lower(), k)] = v
        return d
1000596
def imm_params(imm):
    '''
    
    '''
    return {p: getattr(imm, p) for p in six.iterkeys(_imm_param_data(imm))}
633821
def _apply_param_actions(self, params, schema_params):
        """"""

        for key, val in schema_params.items():
            if key not in params:
                continue

            if isinstance(val, dict):
                self._apply_param_actions(params[key], schema_params[key])
            elif isinstance(val, ResourceId):
                resource_id = val

                # Callers can provide ints as ids.
                # We normalize them to strings so that actions don't get confused.
                params[key] = str(params[key])

                resource_id.action(params, schema_params, key,
                                   resource_id, self.state, self.options)
            else:
                logger.error("Invalid value in schema params: %r. schema_params: %r and params: %r",
                             val, schema_params, params)
1311900
def query_params
      params = { :id => '*:*',
                 :sort => "random_#{rand(9999)} desc",
                 :rows => 1 }
      return params unless provider_id.present?

      provider = RDF::URI(Krikri::Provider.base_uri) / provider_id
      params[:fq] = "provider_id:\"#{provider}\""
      params
    end
139576
def _normalize_params(self, *paths, **query_kwargs):
        """"""
        kwargs = {}

        if paths:
            fragment = paths[-1]
            if fragment:
                if fragment.startswith("#"):
                    kwargs["fragment"] = fragment
                    paths.pop(-1)

            kwargs["path"] = "/".join(self.normalize_paths(*paths))

        kwargs["query_kwargs"] = query_kwargs
        return kwargs
369039
def mqp_lm1b_base():
  """"""
  hparams = mtf_transformer2.mtf_unitransformer_base()
  hparams.d_model = 1024
  hparams.max_length = 256
  hparams.batch_size = 256
  # Parameters for my_layer_stack()
  hparams.num_hidden_layers = 6
  hparams.d_ff = 8192
  hparams.d_kv = 128
  hparams.num_heads = 8
  hparams.learning_rate_decay_steps = 13600
  hparams.layout = "batch:batch;vocab:model;d_ff:model;heads:model"
  hparams.mesh_shape = "batch:32"
  return hparams
403168
def _check_parameter_dependencies(self, parameters):
        """"""
        # Warning: parameters only provide reverse dependencies; we reverse them into standard dependencies.
        # deep_revdeps: set of fields a field depend indirectly upon
        deep_revdeps = collections.defaultdict(set)
        # Actual, direct dependencies
        deps = collections.defaultdict(set)

        for name, parameter in parameters.items():
            if isinstance(parameter, declarations.Parameter):
                field_revdeps = parameter.get_revdeps(parameters)
                if not field_revdeps:
                    continue
                deep_revdeps[name] = set.union(*(deep_revdeps[dep] for dep in field_revdeps))
                deep_revdeps[name] |= set(field_revdeps)
                for dep in field_revdeps:
                    deps[dep].add(name)

        # Check for cyclical dependencies
        cyclic = [name for name, field_deps in deep_revdeps.items() if name in field_deps]
        if cyclic:
            raise errors.CyclicDefinitionError(
                "Cyclic definition detected on %r; Params around %s"
                % (self.factory, ', '.join(cyclic)))
        return deps
982471
def normalize_param(self, slf, args, kwargs):
        """"""
        if self.is_kwarg:
            kwargs = self.normalize_kwarg(slf.request, kwargs)
        else:
            args = self.normalize_arg(slf.request, args)
        return slf, args, kwargs
880722
def current_parameters(self):
        
        current = []
        for core_param in range(len(self.q)):
            for approx_param in range(self.q[core_param].param_no):
                current.append(self.q[core_param].vi_return_param(approx_param))
        return np.array(current)
16629
def init_params(net):
    ''''''
    for m in net.modules():
        if isinstance(m, nn.Conv2d):
            init.kaiming_normal(m.weight, mode='fan_out')
            if m.bias:
                init.constant(m.bias, 0)
        elif isinstance(m, nn.BatchNorm2d):
            init.constant(m.weight, 1)
            init.constant(m.bias, 0)
        elif isinstance(m, nn.Linear):
            init.normal(m.weight, std=1e-3)
            if m.bias:
                init.constant(m.bias, 0)
13964
def trainable_params(m:nn.Module)->ParamList:
    ""
    res = filter(lambda p: p.requires_grad, m.parameters())
    return res
26036
def DiamReq(cmd, **fields):
    """"""
    upfields, name = getCmdParams(cmd, True, **fields)
    p = DiamG(**upfields)
    p.name = name
    return p
237029
def _set_init_params(self, qrs_amp_recent, noise_amp_recent, rr_recent,
                         last_qrs_ind):
        
        self.qrs_amp_recent = qrs_amp_recent
        self.noise_amp_recent = noise_amp_recent
        # What happens if qrs_thr is calculated to be less than the explicit
        # min threshold? Should print warning?
        self.qrs_thr = max(0.25*self.qrs_amp_recent
                           + 0.75*self.noise_amp_recent,
                           self.qrs_thr_min * self.transform_gain)
        self.rr_recent = rr_recent
        self.last_qrs_ind = last_qrs_ind

        # No qrs detected initially
        self.last_qrs_peak_num = None
543123
def parameter(self):
        """"""
        D = {}
        for source in PARAM_SOURCE_ORDER:
            D.update(self.params[source])
        return D