當前位置: 首頁>>代碼示例>>Python>>正文


Python builtins.min方法代碼示例

本文整理匯總了Python中builtins.min方法的典型用法代碼示例。如果您正苦於以下問題:Python builtins.min方法的具體用法?Python builtins.min怎麽用?Python builtins.min使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在builtins的用法示例。


在下文中一共展示了builtins.min方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __call__

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import min [as 別名]
def __call__(self, *inputvals):
        assert len(inputvals) == len(self.nondata_inputs) + len(self.data_inputs)
        nondata_vals = inputvals[0:len(self.nondata_inputs)]
        data_vals = inputvals[len(self.nondata_inputs):]
        feed_dict = dict(zip(self.nondata_inputs, nondata_vals))
        n = data_vals[0].shape[0]
        for v in data_vals[1:]:
            assert v.shape[0] == n
        for i_start in range(0, n, self.batch_size):
            slice_vals = [v[i_start:builtins.min(i_start + self.batch_size, n)] for v in data_vals]
            for (var, val) in zip(self.data_inputs, slice_vals):
                feed_dict[var] = val
            results = tf.get_default_session().run(self.outputs, feed_dict=feed_dict)
            if i_start == 0:
                sum_results = results
            else:
                for i in range(len(results)):
                    sum_results[i] = sum_results[i] + results[i]
        for i in range(len(results)):
            sum_results[i] = sum_results[i] / n
        return sum_results

# ================================================================
# Modules
# ================================================================ 
開發者ID:uber-research,項目名稱:ape-x,代碼行數:27,代碼來源:tf_util.py

示例2: sync_node_time

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import min [as 別名]
def sync_node_time(cluster):
    hosts = C_Host.objects.filter(
        Q(project_id=cluster.id) & ~Q(name='localhost') & ~Q(name='127.0.0.1') & ~Q(name='::1'))
    data = []
    times = []
    result = {
        'success': True,
        'data': []
    }
    for host in hosts:
        ssh_config = SshConfig(host=host.ip, port=host.port, username=host.username, password=host.password,
                               private_key=None)

        ssh_client = SSHClient(ssh_config)
        res = ssh_client.run_cmd('date')
        gmt_date = res[0]
        GMT_FORMAT = '%a %b %d %H:%M:%S CST %Y'
        date = time.strptime(gmt_date, GMT_FORMAT)
        timeStamp = int(time.mktime(date))
        times.append(timeStamp)
        show_time = time.strftime('%Y-%m-%d %H:%M:%S', date)
        time_data = {
            'hostname': host.name,
            'date': show_time,
        }
        data.append(time_data)
    result['data'] = data
    max = builtins.max(times)
    min = builtins.min(times)
    # 如果最大值減最小值超過5分鍾 則判斷有錯
    if (max - min) > 300000:
        result['success'] = False
    return result 
開發者ID:KubeOperator,項目名稱:KubeOperator,代碼行數:35,代碼來源:cluster_monitor.py

示例3: min

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import min [as 別名]
def min(x, axis=None, keepdims=False):
    axis = None if axis is None else [axis]
    return tf.reduce_min(x, axis=axis, keep_dims=keepdims) 
開發者ID:uber-research,項目名稱:ape-x,代碼行數:5,代碼來源:tf_util.py

示例4: min

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import min [as 別名]
def min(x, axis=None, keepdims=False):
    axis = None if axis is None else [axis]
    return tf.reduce_min(x, axis=axis, keepdims=keepdims) 
開發者ID:atavakol,項目名稱:action-branching-agents,代碼行數:5,代碼來源:tf_util.py

示例5: newmin

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import min [as 別名]
def newmin(*args, **kwargs):
    return new_min_max(_builtin_min, *args, **kwargs) 
開發者ID:alfa-addon,項目名稱:addon,代碼行數:4,代碼來源:new_min_max.py

示例6: min

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import min [as 別名]
def min(xs):
    return builtins.min(xs) 
開發者ID:jackfirth,項目名稱:pyramda,代碼行數:4,代碼來源:min.py

示例7: min

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import min [as 別名]
def min(*args):
    '''Replacement for the built-in :func:`min() <python:min>` function.'''
    return builtins.min(*args) 
開發者ID:eth-cscs,項目名稱:reframe,代碼行數:5,代碼來源:sanity.py

示例8: min

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import min [as 別名]
def min(args):
    return builtins.min(args) 
開發者ID:TuringApp,項目名稱:Turing,代碼行數:4,代碼來源:stats.py

示例9: min_index

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import min [as 別名]
def min_index(args):
    return args.index(builtins.min(args)) 
開發者ID:TuringApp,項目名稱:Turing,代碼行數:4,代碼來源:stats.py

示例10: _process_arguments

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import min [as 別名]
def _process_arguments(self, args, keywords):
        kwdict = dict(keywords)
        argdict = {}
        nargs = min(len(args), len(self._argnames))
        for iarg in range(nargs):
            argdict[self._argnames[iarg]] = args[iarg]
        if nargs < len(args):
            if self._varpos is None:
                msg = "macro '{0}' called with too many positional arguments "\
                      "(expected: {1}, received: {2})"\
                      .format(self._name, len(self._argnames), len(args))
                raise FyppFatalError(msg, self._fname, self._spans[0])
            else:
                argdict[self._varpos] = list(args[nargs:])
        elif self._varpos is not None:
            argdict[self._varpos] = []
        for argname in self._argnames[:nargs]:
            if argname in kwdict:
                msg = "got multiple values for argument '{0}'".format(argname)
                raise FyppFatalError(msg, self._fname, self._spans[0])
        if nargs < len(self._argnames):
            for argname in self._argnames[nargs:]:
                if argname in kwdict:
                    argdict[argname] = kwdict.pop(argname)
                elif argname in self._defaults:
                    argdict[argname] = self._defaults[argname]
                else:
                    msg = "macro '{0}' called without mandatory positional "\
                          "argument '{1}'".format(self._name, argname)
                    raise FyppFatalError(msg, self._fname, self._spans[0])
        if kwdict and self._varkw is None:
            kwstr = "', '".join(kwdict.keys())
            msg = "macro '{0}' called with unknown keyword argument(s) '{1}'"\
                  .format(self._name, kwstr)
            raise FyppFatalError(msg, self._fname, self._spans[0])
        if self._varkw is not None:
            argdict[self._varkw] = kwdict
        return argdict 
開發者ID:aradi,項目名稱:fypp,代碼行數:40,代碼來源:fypp.py


注:本文中的builtins.min方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。