当前位置: 首页>>代码示例>>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;未经允许,请勿转载。