All functions are replaced with the same `new` function.

        Args:
            vroot (:obj:`Variable`): NNabla Variable
            entry_variables (:obj:`Variable`): Entry variable from which the conversion starts.
346594
def convert(self, vroot, entry_variables):
        
        self.graph_info = GraphInfo(vroot)
        self.entry_variables = entry_variables

        cnt = 0
        with nn.parameter_scope(self.name):
            # Function loop in the forward order
            for t, func in enumerate(self.graph_info.funcs):
                if func.name == "BatchNormalization":
                    bn_func = func
                    # TODO: should deal with both?
                    if bn_func.info.args["batch_stat"] == False:
                        o = self._bn_linear_conversion(bn_func, cnt)
                        cnt += 1
                        continue
                # Identity conversion
                o = self._identity_conversion(func)

        self.end_variable = o
        return self.end_variable
1286017
function(v, returnNew) {
      var
      tx = this.x,
      ty = this.y,
      vx = v.x,
      vy = v.y,
      x = tx < vx ? tx : vx,
      y = ty < vy ? ty : vy;

      if (returnNew) {
        return new Vec2(x, y);
      } else {
        return this.set(x, y);
      }
    }
1299488
def var(self, ddof=1, *args, **kwargs):
        
        nv.validate_resampler_func('var', args, kwargs)
        return self._downsample('var', ddof=ddof)
392374
def varReplace(basedir, raw, vars, lookup_fatal=True, depth=0, expand_lists=False):
    '''  '''
    # this code originally from yum

    if (depth > 20):
        raise errors.AnsibleError("template recursion depth exceeded")

    done = [] # Completed chunks to return

    while raw:
        m = _varFind(basedir, raw, vars, lookup_fatal, depth)
        if not m:
            done.append(raw)
            break

        # Determine replacement value (if unknown variable then preserve
        # original)

        replacement = m['replacement']
        if expand_lists and isinstance(replacement, (list, tuple)):
            replacement = ",".join(replacement)
        if isinstance(replacement, (str, unicode)):
            replacement = varReplace(basedir, replacement, vars, lookup_fatal, depth=depth+1, expand_lists=expand_lists)
        if replacement is None:
            replacement = raw[m['start']:m['end']]

        start, end = m['start'], m['end']
        done.append(raw[:start])          # Keep stuff leading up to token
        done.append(unicode(replacement)) # Append replacement value
        raw = raw[end:]                   # Continue with remainder of string

    return ''.join(done)
148365
def _create_variable(orig_v, step, variables):
    
    # get current variable, and convert to be the output of our process step
    try:
        v = _get_variable(orig_v["id"], variables)
    except ValueError:
        v = copy.deepcopy(orig_v)
        if not isinstance(v["id"], six.string_types):
            v["id"] = _get_string_vid(v["id"])
    for key, val in orig_v.items():
        if key not in ["id", "type"]:
            v[key] = val
    if orig_v.get("type") != "null":
        v["type"] = orig_v["type"]
    v["id"] = "%s/%s" % (step.name, get_base_id(v["id"]))
    return v
718824
function VarianceFunction(win) {
  var self = this, m, m2, d, n;
  self.name = "vars";
  self.type = "simple";
  self.init = function() { m = 0; m2 = 0; d = 0; n = 0; };
  self.accumulate = function(v) { n+=1; d = v - m; m = d/n + m; m2 = m2 + d*(v - m); };
  self.compensate = function(v) { n-=1; d = m - v; m = m + d/n; m2 = d*(v - m) + m2; };
  self.emit = function()  { return m2/(n-1); };
  self.make = function(win) { return new VarianceFunction(win); };
}
536311
def replace_variable_node(node, annotation):
    
    assert type(node) is ast.Assign, 'nni.variable is not annotating assignment expression'
    assert len(node.targets) == 1, 'Annotated assignment has more than one left-hand value'
    name, expr = parse_nni_variable(annotation)
    assert test_variable_equal(node.targets[0], name), 'Annotated variable has wrong name'
    node.value = expr
    return node
419999
def _apply_over_vars_with_dim(func, self, dim=None, **kwargs):
    ''''''

    ds = type(self)(coords=self.coords, attrs=self.attrs)

    for name, var in self.data_vars.items():
        if dim in var.dims:
            ds[name] = func(var, dim=dim, **kwargs)
        else:
            ds[name] = var

    return ds
481609
def substitute(expr, var_map):
    
    try:
        if isinstance(expr, SympyBasic):
            sympy_var_map = {
                k: v for (k, v) in var_map.items()
                if isinstance(k, SympyBasic)}
            return expr.subs(sympy_var_map)
        else:
            return expr.substitute(var_map)
    except AttributeError:
        if expr in var_map:
            return var_map[expr]
        return expr
466248
def substitute_vars(oldList, runSet=None, sourcefile=None):
    
    keyValueList = []
    if runSet:
        benchmark = runSet.benchmark

        # list with tuples (key, value): 'key' is replaced by 'value'
        keyValueList = [
            ('benchmark_name',     benchmark.name),
            ('benchmark_date',     benchmark.instance),
            ('benchmark_path',     benchmark.base_dir or '.'),
            ('benchmark_path_abs', os.path.abspath(benchmark.base_dir)),
            ('benchmark_file',     os.path.basename(benchmark.benchmark_file)),
            ('benchmark_file_abs', os.path.abspath(os.path.basename(benchmark.benchmark_file))),
            ('logfile_path',       os.path.dirname(runSet.log_folder) or '.'),
            ('logfile_path_abs',   os.path.abspath(runSet.log_folder)),
            ('rundefinition_name', runSet.real_name if runSet.real_name else ''),
            ('test_name',          runSet.real_name if runSet.real_name else ''),
        ]

    if sourcefile:
        keyValueList.append(('inputfile_name', os.path.basename(sourcefile)))
        keyValueList.append(('inputfile_path', os.path.dirname(sourcefile) or '.'))
        keyValueList.append(('inputfile_path_abs', os.path.dirname(os.path.abspath(sourcefile))))
        # The following are deprecated: do not use anymore.
        keyValueList.append(('sourcefile_name', os.path.basename(sourcefile)))
        keyValueList.append(('sourcefile_path', os.path.dirname(sourcefile) or '.'))
        keyValueList.append(('sourcefile_path_abs', os.path.dirname(os.path.abspath(sourcefile))))
    if sourcefile and sourcefile.endswith(".yml"):
        keyValueList.append(('taskdef_name', os.path.basename(sourcefile)))
        keyValueList.append(('taskdef_path', os.path.dirname(sourcefile) or '.'))
        keyValueList.append(('taskdef_path_abs', os.path.dirname(os.path.abspath(sourcefile))))

    # do not use keys twice
    assert len(set((key for (key, value) in keyValueList))) == len(keyValueList)

    return [util.substitute_vars(s, keyValueList) for s in oldList]
7860
public boolean setNewVariable(Object key, Object value) {
		boolean success = false;

		success = setLocalVariable(key, value);

		if (!success) {
			setGlobalVariable(key, value);
			success = true;
		}

		return success;
	}
972424
def register_feature(self, var):
        
        if var in self._features or var in self.STATIC_FEATURES:
            raise ValueError("feature already claimed: {!r}".format(var))
        self._features.add(var)
        self.on_info_changed()
598013
function(vec2, returnNew) {
      if (!returnNew) {
        this.x += vec2.x; this.y += vec2.y;
        return this.change();
      } else {
        // Return a new vector if `returnNew` is truthy
        return new Vec2(
          this.x + vec2.x,
          this.y + vec2.y
        );
      }
    }
474667
def _expand_rec_to_vars(var_items, rec_items, input_order, items_by_key, parallel):
    
    num_items = var_items
    var_items = list(var_items)[0]
    if rec_items:
        for rec_key in (k for (k, t) in input_order.items() if t == "record"):
            rec_vals = items_by_key[rec_key]
            if len(rec_vals) == 1 and var_items > 1:
                items_by_key[rec_key] = rec_vals * var_items
            else:
                assert var_items == len(rec_vals), (var_items, rec_vals)
    return items_by_key, num_items
498783
def substitute_vars(template, replacements):
    
    result = template
    for (key, value) in replacements:
        result = result.replace('${' + key + '}' , value)
    if '${' in result:
        logging.warning("A variable was not replaced in '%s'.", result)
    return result
248580
def update_variable(self, var, grad_var):
    """"""
    params = self.params
    global_step = tf.to_float(self.global_step) + 1

    # compute learning rate
    lrate = params.learning_rate
    if params.learning_rate_decay_scheme == "noam":
      lrate *= tf.minimum(global_step * params.learning_rate_warmup_steps**-1.5,
                          global_step**-0.5)
    else:
      assert params.learning_rate_decay_scheme == "none"
      lrate *= tf.minimum(global_step / params.learning_rate_warmup_steps, 1.0)

    # compute adjustment due to second moment
    slots = params.slots[var.op.name]
    grad_squared = tf.square(grad_var)
    beta2_pow = tf.pow(params.beta2, global_step)
    if params.factored_second_moment_accumulator and len(var.shape) == 2:
      vr_update = tf.assign(slots["adam_vr"], slots["adam_vr"] * params.beta2 +
                            tf.reduce_mean(grad_squared, 1, keepdims=True) *
                            (1.0 - params.beta2))
      vc_update = tf.assign(slots["adam_vc"], slots["adam_vc"] * params.beta2 +
                            tf.reduce_mean(grad_squared, 0, keepdims=True) *
                            (1.0 - params.beta2))
      with tf.control_dependencies([vr_update, vc_update]):
        vr = tf.sqrt(slots["adam_vr"] / (1.0 - beta2_pow)) + params.epsilon
        vc = tf.sqrt(slots["adam_vc"] / (1.0 - beta2_pow)) + params.epsilon
        vc /= tf.reduce_mean(vc)
        denom = vr * vc
    else:
      v_update = tf.assign(slots["adam_v"],
                           slots["adam_v"] * params.beta2 + grad_squared *
                           (1.0 - params.beta2))
      with tf.control_dependencies([v_update]):
        denom = tf.sqrt(slots["adam_v"] / (1.0 - beta2_pow)) + params.epsilon

    # compute momentum if applicable
    if params.beta1 != 0.0:
      m_update = tf.assign(slots["adam_m"],
                           slots["adam_m"] * params.beta1 + grad_var *
                           (1.0 - params.beta1))
      with tf.control_dependencies([m_update]):
        grad_var = slots["adam_m"]

    # update var
    subtrahend = lrate * grad_var / denom
    new_val = _quantize(_dequantize(var, params) - subtrahend, params)
    return tf.assign(var, new_val)
1051015
def _simple_new(cls, values, name=None, dtype=None, **kwargs):
        
        if not hasattr(values, 'dtype'):
            if (values is None or not len(values)) and dtype is not None:
                values = np.empty(0, dtype=dtype)
            else:
                values = np.array(values, copy=False)
                if is_object_dtype(values):
                    values = cls(values, name=name, dtype=dtype,
                                 **kwargs)._ndarray_values

        if isinstance(values, (ABCSeries, ABCIndexClass)):
            # Index._data must always be an ndarray.
            # This is no-copy for when _values is an ndarray,
            # which should be always at this point.
            values = np.asarray(values._values)

        result = object.__new__(cls)
        result._data = values
        # _index_data is a (temporary?) fix to ensure that the direct data
        # manipulation we do in `_libs/reduction.pyx` continues to work.
        # We need access to the actual ndarray, since we're messing with
        # data buffers and strides. We don't re-use `_ndarray_values`, since
        # we actually set this value too.
        result._index_data = values
        result.name = name
        for k, v in kwargs.items():
            setattr(result, k, v)
        return result._reset_identity()