本文整理匯總了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