本文整理汇总了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
# ================================================================
示例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
示例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)
示例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)
示例5: newmin
# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import min [as 别名]
def newmin(*args, **kwargs):
return new_min_max(_builtin_min, *args, **kwargs)
示例6: min
# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import min [as 别名]
def min(xs):
return builtins.min(xs)
示例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)
示例8: min
# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import min [as 别名]
def min(args):
return builtins.min(args)
示例9: min_index
# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import min [as 别名]
def min_index(args):
return args.index(builtins.min(args))
示例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