Search is not available for this dataset
id int64 0 10.8M | vector listlengths 1.54k 1.54k | ast_depth int64 3 164 | ast_data stringlengths 297 510k | full_path stringlengths 0 319 | code stringlengths 60 56.5k |
|---|---|---|---|---|---|
10,801 | [
0.006679951678961515,
0.0009742825059220195,
0.031011955812573433,
-0.04428932070732117,
-0.02756880410015583,
0.00003063057010876946,
0.019656628370285034,
-0.004463127814233303,
0.043628986924886703,
0.026295309886336327,
0.015741810202598572,
-0.04853430017828941,
0.020140083506703377,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class Params(object):
def __init__(self):
self.version = False
self.destination = False
self.sourceURL = False
self.name = False
self.vcs = False
self.vcsBranch = False
self.vcsPath = False
self.relNotes = False
self.outRelNotes = False
self.extensionVers... | |
10,802 | [
-0.013430754654109478,
0.003547258907929063,
-0.027849571779370308,
-0.01148335263133049,
-0.0002649672969710082,
-0.0001509739231551066,
0.006140922661870718,
-0.003682255744934082,
0.01632600836455822,
0.03210053965449333,
0.008117047138512135,
-0.00556646753102541,
0.0006060498999431729,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __discoverVCS(self):
sourceURL = self.params.sourceURL
if os.path.expanduser(sourceURL).find("/") == 0:
sourceURL = os.path.expanduser(sourceURL)
self.params.vcs = "file"
return True
if sourceURL.find(".git") == len(sourceURL) - 4:
self.params.vcs = "git"
return True
fo... | |
10,803 | [
0.02410494163632393,
0.031052423641085625,
-0.01677018590271473,
-0.04034702479839325,
-0.03569972515106201,
-0.007369962986558676,
0.004981766454875469,
0.05102642998099327,
-0.026827603578567505,
0.024832550436258316,
0.04431366175413132,
-0.013542893342673779,
0.00014513648056890815,
-0... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "dirToDo", "annotation": null, "type_comment": null}}], "kwarg": nu... | def replaceKeywordsWithGit(cls, dirToDo):
for fileName in os.listdir(dirToDo):
objPath = os.path.join(dirToDo, fileName)
if os.path.isdir(objPath):
TarModuleCreator.replaceKeywordsWithGit(objPath)
elif os.path.isfile(objPath):
if fileName.find('.py', len(fileName) - 3) == len(fileN... | |
10,804 | [
0.06035592779517174,
0.045800335705280304,
-0.005701335612684488,
-0.07249349355697632,
-0.04127245396375656,
-0.0043915691785514355,
-0.008374207653105259,
-0.0411539226770401,
-0.03947078436613083,
0.021643739193677902,
-0.013441402465105057,
0.0029158599209040403,
-0.006993322167545557,
... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __loadReleaseNotesFile(self):
if not self.params.relNotes:
relNotes = os.path.join(self.params.destination, self.params.name, "release.notes")
else:
relNotes = self.params.relNotes
if not os.path.isfile(relNotes):
return S_OK("")
try:
with open(relNotes, "r") as fd:
r... | |
10,805 | [
0.03998665139079094,
-0.022077204659581184,
0.04591677337884903,
-0.08549855649471283,
-0.05601465329527855,
-0.008466500788927078,
-0.015849385410547256,
-0.027507197111845016,
-0.02280358597636223,
0.018802538514137268,
0.02626877650618553,
0.01898115687072277,
0.0017876700730994344,
0.0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "releaseData", "annotation": null, "type_comment": null}}, {"_type... | def __generateRSTFile(self, releaseData, rstFileName, pkgVersion, singleVersion):
rstData = []
parsedPkgVersion = Distribution.parseVersionString(pkgVersion)
for version, verData in releaseData:
if singleVersion and version != pkgVersion:
continue
if Distribution.parseVersionString(versi... | |
10,806 | [
0.06430818885564804,
0.006397540215402842,
0.03382950276136398,
-0.06926556676626205,
-0.07004589587450027,
-0.010018032044172287,
-0.015101637691259384,
-0.07027540355920792,
-0.018762292340397835,
0.017832783982157707,
-0.02028852142393589,
0.007487704046070576,
-0.008847540244460106,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __generateReleaseNotes(self):
result = self.__loadReleaseNotesFile()
if not result['OK']:
return result
releaseData = result['Value']
if not releaseData:
gLogger.info("release.notes not found. Trying to find releasenotes.rst")
for rstFileName in ("releasenotes.rst", "releasehistory... | |
10,807 | [
0.01018382515758276,
-0.005787380039691925,
0.030153285712003708,
-0.011705671437084675,
-0.04402990639209747,
-0.011520213447511196,
0.024436816573143005,
0.031026029959321022,
-0.005236460827291012,
0.007751052733510733,
0.0018409432377666235,
0.00893471110612154,
-0.03558611497282982,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __generateTarball(self):
destDir = self.params.destination
tarName = "%s-%s.tar.gz" % (self.params.name, self.params.version)
tarfilePath = os.path.join(destDir, tarName)
dirToTar = os.path.join(self.params.destination, self.params.name)
if self.params.name in os.listdir(dirToTar):
dirToTa... | |
10,808 | [
0.011456700973212719,
0.02183777280151844,
0.03914789482951164,
-0.03654637560248375,
-0.04380061849951744,
-0.01655968464910984,
0.0005866712308488786,
0.024714455008506775,
0.03369470685720444,
0.02746606431901455,
-0.012232153676450253,
-0.04707753285765648,
-0.0009482108289375901,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def create(self):
if not isinstance(self.params, TarModuleCreator.Params):
return S_ERROR("Argument is not a TarModuleCreator.Params object ")
result = self.params.isOK()
if not result['OK']:
return result
result = self.__checkDestination()
if not result['OK']:
return result
re... | |
10,809 | [
0.04143426567316055,
0.01939552277326584,
-0.008816688321530819,
-0.041958149522542953,
0.02595594897866249,
0.005905573721975088,
0.021324360743165016,
0.07401017099618912,
-0.0006146678351797163,
0.023086506873369217,
0.01665705069899559,
-0.05014974996447563,
-0.04255346953868866,
0.007... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __iter__(self):
current_kwargs = self._op_kwargs
previous_next_token = None
next_token = [None for _ in range(len(self._input_token))]
# The number of items from result_key we've seen so far.
total_items = 0
first_request = True
primary_result_key = self.resul... | |
10,810 | [
0.008202100172638893,
0.010122882202267647,
0.0008873180486261845,
-0.00117364595644176,
0.02672393247485161,
-0.0043873777613043785,
0.00913266558200121,
-0.010266046039760113,
0.003173467004671693,
0.025363875553011894,
0.010779050178825855,
-0.03209257870912552,
0.0102600809186697,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def isOK(self):
if not self.version:
return S_ERROR("No version defined")
if not self.sourceURL:
return S_ERROR("No Source URL defined")
if not self.name:
return S_ERROR("No name defined")
if self.vcs and self.vcs not in TarModuleCreator.VALID_VCS:
return S_ERROR(... | |
10,811 | [
0.026182588189840317,
0.048865191638469696,
0.02254798822104931,
-0.03040052019059658,
0.015144170261919498,
-0.02642938308417797,
0.01231725886464119,
0.03302551060914993,
0.0026179784908890724,
0.012294823303818703,
-0.007555258460342884,
-0.07444201409816742,
0.021594464778900146,
-0.01... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "response", "annotation": null, "type_comment": null}}], "kwarg": ... | def _record_non_aggregate_key_values(self, response):
non_aggregate_keys = {}
for expression in self._non_aggregate_key_exprs:
result = expression.search(response)
set_value_from_jmespath(non_aggregate_keys,
expression.expression,
... | |
10,812 | [
0.047335147857666016,
0.039625708013772964,
-0.022169625386595726,
-0.022169625386595726,
0.020282212644815445,
0.014060735702514648,
0.003153180005028844,
0.07989054173231125,
-0.009162446483969688,
-0.01372120063751936,
-0.016157861799001694,
0.006605949252843857,
-0.010765250772237778,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "op_kwargs", "annotation": null, "type_comment": null}}], "kwarg":... | def _inject_starting_params(self, op_kwargs):
# If the user has specified a starting token we need to
# inject that into the operation's kwargs.
if self._starting_token is not None:
# Don't need to do anything special if there is no starting
# token specified.
... | |
10,813 | [
0.011712349951267242,
0.05178339034318924,
0.03167150914669037,
-0.0031043014023452997,
0.010572833940386772,
-0.01045535784214735,
0.056153494864702225,
0.07762809842824936,
0.02318974956870079,
0.025703733786940575,
0.02894607000052929,
-0.035524722188711166,
-0.04414745420217514,
-0.004... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parsed", "annotation": null, "type_comment": null}}, {"_type": "a... | def _truncate_response(self, parsed, primary_result_key, truncate_amount,
starting_truncation, next_token):
original = primary_result_key.search(parsed)
if original is None:
original = []
amount_to_keep = len(original) - truncate_amount
truncated = ... | |
10,814 | [
0.023754512891173363,
0.004704879596829414,
0.0013439543545246124,
-0.0033824120182543993,
0.04415988549590111,
-0.00753002567216754,
0.019873056560754776,
0.048307497054338455,
0.007851632311940193,
0.013385480269789696,
0.026349544525146484,
-0.049017250537872314,
0.00350162829272449,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parsed", "annotation": null, "type_comment": null}}, {"_type": "a... | def _handle_first_request(self, parsed, primary_result_key,
starting_truncation):
# First we need to slice into the array and only return
# the truncated amount.
starting_truncation = self._parse_starting_token()[1]
all_data = primary_result_key.search(parse... | |
10,815 | [
0.046713005751371384,
-0.00045381629024632275,
-0.03408319130539894,
-0.03140151873230934,
0.006185147911310196,
-0.005144377704709768,
0.025389382615685463,
0.06362484395503998,
0.02175614982843399,
0.0023059139493852854,
-0.014933022670447826,
-0.018468936905264854,
-0.05583934113383293,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parsed", "annotation": null, "type_comment": null}}], "kwarg": nu... | def _get_next_token(self, parsed):
if self._more_results is not None:
if not self._more_results.search(parsed):
return [None]
next_tokens = []
for token in self._output_token:
next_tokens.append(token.search(parsed))
return next_tokens | |
10,816 | [
0.07967871427536011,
0.01999976858496666,
-0.04558299854397774,
0.02229951322078705,
0.011258451268076897,
-0.01377558521926403,
0.03519410267472267,
0.03141840174794197,
-0.029221631586551666,
0.015972355380654335,
-0.00701936986297369,
-0.03098362497985363,
-0.0025114126037806273,
-0.072... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def build_full_result(self):
complete_result = {}
# Prepopulate the result keys with an empty list.
for result_expression in self.result_keys:
set_value_from_jmespath(complete_result,
result_expression.expression, [])
for _, page in self:
... | |
10,817 | [
0.05289608612656593,
-0.018054815009236336,
0.02724214643239975,
-0.013378430157899857,
0.004113894887268543,
-0.007521920371800661,
0.01718350686132908,
0.010097241029143333,
-0.008464917540550232,
-0.017635704949498177,
-0.006330765783786774,
-0.03507288545370102,
-0.037322841584682465,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "method", "annotation": null, "type_comment": null}}, {"_type": "a... | def __init__(self, method, pagination_config):
self._method = method
self._pagination_cfg = pagination_config
self._output_token = self._get_output_tokens(self._pagination_cfg)
self._input_token = self._get_input_tokens(self._pagination_cfg)
self._more_results = self._get_more_re... | |
10,818 | [
0.02674321085214615,
0.0017554756486788392,
0.009007477201521397,
-0.03338247537612915,
0.025295395404100418,
-0.008474888280034065,
0.038346413522958755,
0.04670237377285957,
0.057085275650024414,
0.03911168873310089,
-0.008485229685902596,
-0.004847595002502203,
-0.031769197434186935,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def _parse_starting_token(self):
if self._starting_token is None:
return None
parts = self._starting_token.split('___')
next_token = []
index = 0
if len(parts) == len(self._input_token) + 1:
try:
index = int(parts.pop())
except ... | |
10,819 | [
0.025727814063429832,
0.016124481335282326,
0.016302872449159622,
-0.06457721441984177,
0.006952257826924324,
-0.02233840338885784,
-0.034270718693733215,
0.052050262689590454,
-0.009390255436301231,
-0.012685516849160194,
0.034131970256567,
-0.03478606790304184,
-0.04642106592655182,
-0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}], "kwarg": nu... | def _extract_paging_params(self, kwargs):
max_items = kwargs.pop('max_items', None)
if max_items is not None:
max_items = int(max_items)
page_size = kwargs.pop('page_size', None)
if page_size is not None:
page_size = int(page_size)
return {
'ma... | |
10,820 | [
0.039983119815588,
0.014952318742871284,
0.04922356456518173,
-0.07864302396774292,
-0.013816560618579388,
-0.004658816382288933,
0.01313289999961853,
0.03638838604092598,
0.038196779787540436,
0.022285129874944687,
0.006274240091443062,
-0.0020785487722605467,
0.00594343664124608,
0.01684... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "config", "annotation": null, "type_comment": null}}], "kwarg": nu... | def _get_output_tokens(self, config):
output = []
output_token = config['output_token']
if not isinstance(output_token, list):
output_token = [output_token]
for config in output_token:
output.append(jmespath.compile(config))
return output | |
10,821 | [
0.07006749510765076,
-0.00667360657826066,
0.00013013397983741015,
-0.002177519490942359,
0.007979311980307102,
0.001109581091441214,
0.05459246784448624,
-0.04287872835993767,
-0.0007193470955826342,
-0.056440871208906174,
-0.019193336367607117,
-0.038644589483737946,
-0.006297477521002293,... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def get_accessor_name(self):
# This method encapsulates the logic that decides what name to give an
# accessor descriptor that retrieves related many-to-one or
# many-to-many objects. It uses the lower-cased object_name + "_set",
# but this can be overridden with the "related_name" optio... | |
10,822 | [
0.05221954360604286,
0.024504031985998154,
-0.028023462742567062,
-0.023888131603598595,
0.028309416025877,
0.04108934476971626,
-0.025207918137311935,
0.0469403974711895,
-0.0064229597337543964,
-0.041199326515197754,
0.003546925727277994,
-0.04509269818663597,
-0.0030465065501630306,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "operation", "annotatio... | class DeprecatedPageIterator(PageIterator):
def __init__(self, operation, endpoint, input_token,
output_token, more_results,
result_keys, non_aggregate_keys, limit_key, max_items,
starting_token, page_size, op_kwargs):
super(DeprecatedPageIterator, self).__... | |
10,823 | [
0.033819060772657394,
0.026877837255597115,
0.0001857276220107451,
-0.0026916645001620054,
-0.01927131973206997,
-0.02014729008078575,
-0.03557099774479866,
0.019980967044830322,
-0.031645771116018295,
0.02616819180548191,
-0.024017076939344406,
-0.044774219393730164,
0.04158081114292145,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def name_search(
self, cr, uid, name='', args=None, operator='ilike',
context=None, limit=100):
if args is None:
args = []
ids = self.search(
cr, uid,
['|', ('code', 'ilike', name), ('name', 'ilike', name)] + args,
limit=limit, cont... | |
10,824 | [
-0.014600720256567001,
-0.0002180950395995751,
0.04786362871527672,
-0.02472868375480175,
-0.021155619993805885,
0.0167471282184124,
-0.0010442856000736356,
0.0009984977077692747,
0.009440341964364052,
0.042336948215961456,
0.014973449520766735,
-0.03678455948829651,
-0.028764447197318077,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "cnos_bgp", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Store", "_fields": {}}}}], "... | class TestCnosBgpModule(TestCnosModule):
module = cnos_bgp
def setUp(self):
super(TestCnosBgpModule, self).setUp()
self.mock_run_cnos_commands = patch('ansible.module_utils.network.cnos.cnos.run_cnos_commands')
self.run_cnos_commands = self.mock_run_cnos_commands.start()
def tear... | |
10,825 | [
0.022048702463507652,
-0.0013940305216237903,
0.04460897669196129,
-0.005790342576801777,
-0.03381483256816864,
0.020322151482105255,
0.002583432709798217,
-0.004341957625001669,
0.03023383766412735,
0.03683310002088547,
0.002442750846967101,
-0.0039199115708470345,
-0.041104719042778015,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_cnos_bgp_dampening(self):
set_module_args({'username': 'admin', 'password': 'pass',
'host': '10.241.107.39', 'deviceType': 'g8272_cnos',
'outputfile': self.test_log, 'asNum': '33',
'bgpArg1': 'address-family', 'bgpArg2': 'ipv4',... | |
10,826 | [
-0.029618989676237106,
-0.022767193615436554,
0.039860621094703674,
-0.00502765504643321,
-0.026253195479512215,
-0.013258825056254864,
0.0074287885800004005,
0.010103393346071243,
0.02560407668352127,
0.03214333578944206,
-0.0029420647770166397,
0.005914181470870972,
-0.028729457408189774,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_bgp_neighbor(self):
set_module_args({'username': 'admin', 'password': 'pass',
'host': '10.241.107.39', 'deviceType': 'g8272_cnos',
'outputfile': self.test_log, 'asNum': '33',
'bgpArg1': 'neighbor', 'bgpArg2': '10.241.107.40',
... | |
10,827 | [
0.0023085286375135183,
-0.02271580509841442,
0.029372280463576317,
-0.02478722482919693,
-0.011573190800845623,
0.006825215183198452,
0.016454994678497314,
0.006540103815495968,
0.008413692004978657,
0.030093787238001823,
0.004361039027571678,
-0.004099201876670122,
-0.035702913999557495,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_cnos_bgp_clusterid(self):
set_module_args({'username': 'admin', 'password': 'pass',
'host': '10.241.107.39', 'deviceType': 'g8272_cnos',
'outputfile': self.test_log, 'asNum': '33',
'bgpArg1': 'cluster-id', 'bgpArg2': '10.241.107... | |
10,828 | [
-0.006394602824002504,
-0.01925661228597164,
0.03099016286432743,
-0.02494744397699833,
-0.01991184614598751,
-0.011363464407622814,
-0.012328114360570908,
0.013371636159718037,
0.014961186796426773,
0.04047892615199089,
0.0014621434966102242,
-0.0056301625445485115,
-0.015968305990099907,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_cnos_bgp_network(self):
set_module_args({'username': 'admin', 'password': 'pass',
'host': '10.241.107.39', 'deviceType': 'g8272_cnos',
'outputfile': self.test_log, 'asNum': '33',
'bgpArg1': 'address-family', 'bgpArg2': 'ipv4',
... | |
10,829 | [
0.01513222511857748,
0.005048149731010199,
0.026010803878307343,
-0.01974034309387207,
-0.031413424760103226,
0.024751823395490646,
-0.004397268407046795,
0.03984737768769264,
0.01889694668352604,
0.036767151206731796,
0.010261311195790768,
0.010707455687224865,
-0.04209643229842186,
0.018... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_cnos_bgp_graceful_restart(self):
set_module_args({'username': 'admin', 'password': 'pass',
'host': '10.241.107.39', 'deviceType': 'g8272_cnos',
'outputfile': self.test_log, 'asNum': '33',
'bgpArg1': 'graceful-restart', 'bgpArg2'... | |
10,830 | [
-0.005822587292641401,
-0.02086598612368107,
0.021595649421215057,
-0.030787039548158646,
-0.020465848967432976,
-0.013522288762032986,
-0.0018050314392894506,
0.014522632583975792,
0.009556221775710583,
0.026361990720033646,
-0.007749719079583883,
-0.0070906695909798145,
-0.0228784419596195... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_cnos_bgp_routerid(self):
set_module_args({'username': 'admin', 'password': 'pass',
'host': '10.241.107.39', 'deviceType': 'g8272_cnos',
'outputfile': self.test_log, 'asNum': '33',
'bgpArg1': 'router-id', 'bgpArg2': '1.2.3.4'})
... | |
10,831 | [
-0.007713561877608299,
0.010594460181891918,
0.036838099360466,
-0.04684235528111458,
-0.018839789554476738,
-0.007871339097619057,
-0.022275831550359726,
0.029358282685279846,
0.014071406796574593,
0.04392055422067642,
0.0053498223423957825,
0.0000014580484730686294,
-0.01340523548424244,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_cnos_bgp_vrf(self):
set_module_args({'username': 'admin', 'password': 'pass',
'host': '10.241.107.39', 'deviceType': 'g8272_cnos',
'outputfile': self.test_log, 'asNum': '33',
'bgpArg1': 'vrf'})
result = self.execute_modu... | |
10,832 | [
0.00305091287009418,
0.011493035592138767,
0.07602647691965103,
0.0035033386666327715,
-0.007726768497377634,
0.004993264097720385,
0.03602351248264313,
-0.059236980974674225,
-0.010678195394575596,
-0.004448458552360535,
0.0050974879413843155,
-0.0028614152688533068,
-0.0040789381600916386,... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg... | def _verify_data_geo_dims(self, data, src_geo_dims):
# verify that source dims are the same between geo and data
data_geo_dims = tuple(d for d in data.dims if d in src_geo_dims)
if data_geo_dims != src_geo_dims:
raise ValueError("Data dimensions do not match source area dimensions.")... | |
10,833 | [
-0.006262761540710926,
0.012053635902702808,
-0.04230569675564766,
0.008196472190320492,
0.022424891591072083,
0.0015323505504056811,
-0.012515264563262463,
-0.058431923389434814,
0.022794194519519806,
0.012761466205120087,
-0.003690464189276099,
-0.010355868376791477,
0.040192462503910065,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null... | def _verify_input_object_type(self, data):
if isinstance(data, DataArray) and isinstance(data.data, da.Array):
return data
if not isinstance(data, DataArray):
if data.ndim != 2:
raise ValueError(
f"{self.__class__.__name__} requires DataArrays ... | |
10,834 | [
0.04365937039256096,
0.021052246913313866,
-0.048651352524757385,
0.018904058262705803,
0.054011594504117966,
0.008285869844257832,
-0.03424825891852379,
-0.047055553644895554,
-0.0031174304895102978,
-0.011047826148569584,
-0.014576992951333523,
-0.013073260895907879,
0.022750338539481163,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg... | def _verify_result_object_type(self, data, orig_data):
if isinstance(orig_data, DataArray) and isinstance(orig_data.data, da.Array):
return data
if not isinstance(orig_data, DataArray):
data = data.data
if isinstance(orig_data, da.Array):
return data
r... | |
10,835 | [
0.017928680405020714,
0.0156566109508276,
-0.022576089948415756,
-0.028442155569791794,
0.0020745526999235153,
-0.01665838621556759,
0.002253994345664978,
-0.00031111834687180817,
0.0025818950962275267,
0.03286236152052879,
-0.002649024361744523,
-0.032036155462265015,
-0.00402775639668107,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __init__(self):
super(Params, self).__init__()
#: internal param map for user-supplied values param map
self._paramMap = {}
#: internal param map for default values
self._defaultParamMap = {}
#: value returned by :py:func:`params`
self._params = None
... | |
10,836 | [
-0.00722870510071516,
0.01860950142145157,
0.06656187027692795,
0.043960798531770706,
-0.018695110455155373,
-0.0392308384180069,
0.0016279300907626748,
-0.006238837726414204,
0.015281407162547112,
0.013205361552536488,
-0.0004521284718066454,
0.0031488474924117327,
0.0387599840760231,
0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mask_area", "annotation": null, "type_comment": null}}, {"_type":... | def _get_area_mask(self, mask_area, data):
if isinstance(mask_area, (np.ndarray, da.Array, DataArray)):
return mask_area
# default is to mask areas for SwathDefinitions
if mask_area is None and isinstance(self.source_geo_def, SwathDefinition):
mask_area = True
i... | |
10,837 | [
0.0018739593215286732,
-0.06669995933771133,
0.06073492020368576,
-0.04107741266489029,
0.00492849899455905,
-0.017443213611841202,
0.029802590608596802,
0.01833570934832096,
-0.01823403313755989,
0.03547389432787895,
-0.00034704257268458605,
0.02299024723470211,
-0.006789748556911945,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
super(HelpersTest, self).setUp()
self.driver = type_vlan.VlanTypeDriver()
self.driver.network_vlan_ranges = NETWORK_VLAN_RANGES
self.driver._sync_vlan_allocations()
self.session = db.get_session()
self.useFixture(
fixtures.FakeLogger(
... | |
10,838 | [
-0.0036705981474369764,
-0.02564854919910431,
0.068691685795784,
-0.011311700567603111,
0.013795711100101471,
-0.00536572327837348,
-0.014982298947870731,
0.014656313695013523,
0.015660349279642105,
0.032728955149650574,
0.040526531636714935,
-0.026939451694488525,
-0.047724295407533646,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class HelpersTest(testlib_api.SqlTestCase):
def setUp(self):
super(HelpersTest, self).setUp()
self.driver = type_vlan.VlanTypeDriver()
self.driver.network_vlan_ranges = NETWORK_VLAN_RANGES
self.driver._sync_vlan_allocations()
self.session = db.get_session()
self.useF... | |
10,839 | [
0.023593757301568985,
-0.005297999829053879,
0.018448811024427414,
-0.0028462030459195375,
0.02754959836602211,
-0.014881492592394352,
-0.0028844664338976145,
0.01888442598283291,
0.01548193208873272,
-0.00937157217413187,
0.0684737041592598,
-0.03988805040717125,
-0.04756426438689232,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_allocate_specific_finally_unallocated_segment_outside_pools(self):
# Test case: allocate a specific allocated segment in pools but
# the segment is concurrently unallocated after select or update
expected = dict(physical_network=TENANT_NET, vlan_id=VLAN_MIN)
with mock.patch.obj... | |
10,840 | [
0.030114509165287018,
-0.006809985730797052,
0.01733865775167942,
-0.00011834774340968579,
0.03830474242568016,
-0.009656035341322422,
0.005138858687132597,
0.025300750508904457,
0.0013667024904862046,
-0.021114377304911613,
0.06219102442264557,
-0.036684948951005936,
-0.04606151208281517,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_allocate_specific_finally_allocated_segment_in_pools(self):
# Test case: allocate a specific unallocated segment in pools but
# the segment is allocated concurrently between select and update
raw_segment = dict(physical_network=TENANT_NET, vlan_id=VLAN_MIN)
with mock.patch.obje... | |
10,841 | [
0.01137316320091486,
0.0018610348924994469,
0.04477603733539581,
-0.01181795820593834,
-0.00956309400498867,
-0.015641959384083748,
0.013467405922710896,
0.02859043888747692,
0.005547583103179932,
0.011088987812399864,
0.04956993833184242,
-0.023018144071102142,
-0.028466884046792984,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_allocate_partial_segment_all_attempts_fail(self):
with mock.patch.object(query.Query, 'update', return_value=0):
with mock.patch.object(helpers.LOG, 'warning') as log_warning:
self.assertRaises(
exc.NoNetworkFoundInMaximumAllowedAttempts,
... | |
10,842 | [
0.06080109626054764,
0.024536600336432457,
-0.02653724141418934,
-0.03587356582283974,
-0.016258083283901215,
0.0056196171790361404,
0.022110534831881523,
-0.019247548654675484,
0.015292257070541382,
-0.01836220733821392,
0.057627663016319275,
-0.022823406383395195,
-0.00221766484901309,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "fileobj", "annotation": null, "type_comment": null}}], "kwarg": n... | def __init__(self, fileobj):
page = OggPage(fileobj)
while not page.packets[0].startswith("Speex "):
page = OggPage(fileobj)
if not page.first:
raise OggSpeexHeaderError(
"page has ID header, but doesn't start a stream")
self.sample_rate = cdata.... | |
10,843 | [
0.05740789696574211,
0.044887036085128784,
-0.04562937840819359,
-0.050776295363903046,
-0.02702130377292633,
0.014351974241435528,
0.03162383288145065,
-0.013473534025251865,
0.022245559841394424,
0.001650167745538056,
0.048697732388973236,
-0.008017309941351414,
0.017383210361003876,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "fileobj", "annotation": null, "type_comment": null}}, {"_type": "... | def __init__(self, fileobj, info):
pages = []
complete = False
while not complete:
page = OggPage(fileobj)
if page.serial == info.serial:
pages.append(page)
complete = page.complete or (len(page.packets) > 1)
data = OggPage.to_packe... | |
10,844 | [
0.016866957768797874,
-0.014568817801773548,
0.059389520436525345,
-0.011428025551140308,
-0.008231520652770996,
0.06546217948198318,
0.025516321882605553,
0.020780760794878006,
0.013684381730854511,
0.04454214125871658,
0.09042137861251831,
0.011358384974300861,
-0.009338807314634323,
-0.... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}, "targets": [{"_type": "Name", "_fields": {"id": "SUPPORT_NCP", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}... | class Cert_8_1_01_Commissioning(thread_cert.TestCase):
SUPPORT_NCP = False
TOPOLOGY = {
COMMISSIONER: {
'name': 'COMMISSIONER',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
JOINER: {
'name': 'JOINER',
'ne... | |
10,845 | [
0.007232042960822582,
-0.019776856526732445,
0.05385090410709381,
-0.006428868975490332,
-0.004554796498268843,
0.062362462282180786,
0.019540423527359962,
0.01581314019858837,
0.01638335920870304,
0.045450609177351,
0.08711830526590347,
0.005980343092232943,
-0.01132788322865963,
-0.00731... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pv", "annotation": null, "type_comment": null}}], "kwarg": null, ... | def verify(self, pv):
pkts = pv.pkts
pv.summary.show()
COMMISSIONER = pv.vars['COMMISSIONER']
COMMISSIONER_VERSION = pv.vars['COMMISSIONER_VERSION']
JOINER_VERSION = pv.vars['JOINER_VERSION']
# Step 3: Joiner sends MLE Discovery Request
# MLE Discovery R... | |
10,846 | [
0.00463803019374609,
-0.004582485184073448,
0.04632475972175598,
-0.022065360099077225,
-0.015233291313052177,
0.039576008915901184,
0.0004847192903980613,
0.04149232059717178,
0.02441214770078659,
0.030299946665763855,
0.06393261253833771,
-0.006332161370664835,
-0.01496945135295391,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test(self):
self.nodes[COMMISSIONER].interface_up()
self.nodes[COMMISSIONER].thread_start()
self.simulator.go(config.LEADER_STARTUP_DELAY)
self.assertEqual(self.nodes[COMMISSIONER].get_state(), 'leader')
self.nodes[COMMISSIONER].commissioner_start()
self.simulator.go(... | |
10,847 | [
0.04300958663225174,
0.035024967044591904,
-0.028136277571320534,
-0.05054688826203346,
0.03969943895936012,
0.020487146452069283,
-0.022052757441997528,
0.022287599742412567,
-0.05282820761203766,
-0.05157572031021118,
0.019860900938510895,
-0.06772388517856598,
0.05671987310051918,
0.050... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "key", "annotation": nu... | class newcls(oldcls):
def __getitem__(self, key):
try:
return oldcls.__getitem__(self, key)
except KeyError:
if key not in request.form:
raise
raise DebugFilesKeyError(request, key) | |
10,848 | [
0.05080254003405571,
0.051300160586833954,
-0.007995858788490295,
-0.05496446043252945,
0.018117913976311684,
0.0026648149359971285,
-0.0076452624052762985,
-0.026396511122584343,
0.029495330527424812,
0.04213941842317581,
0.007571750320494175,
-0.006231567356735468,
0.001297065056860447,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "loader", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ... | def _dump_loader_info(loader):
yield 'class: %s.%s' % (type(loader).__module__, type(loader).__name__)
for key, value in sorted(loader.__dict__.items()):
if key.startswith('_'):
continue
if isinstance(value, (tuple, list)):
if not all(isinstance(x, (str, text_type)) for x... | |
10,849 | [
0.02752399444580078,
0.021248292177915573,
0.040210988372564316,
0.04346505552530289,
-0.0032782801426947117,
0.026923542842268944,
0.05698493495583534,
0.05442816764116287,
0.01741313934326172,
0.042264148592948914,
-0.004481607582420111,
0.024521728977560997,
0.032327618449926376,
0.0043... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cmd", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cwd", "annotation": null, "type_comment": null}}], "kwarg": null, ... | def run_shell(cmd, cwd=None):
p = subprocess.Popen(cmd, shell=True, cwd=cwd)
p.wait()
if p.returncode:
raise subprocess.CalledProcessError(returncode=p.returncode, cmd=cmd)
return p.returncode | |
10,850 | [
0.05564689263701439,
0.029009364545345306,
0.00920796487480402,
-0.026363857090473175,
-0.02832518145442009,
-0.018313301727175713,
0.04298950731754303,
-0.02127809450030327,
-0.03154084086418152,
0.05678720027208328,
0.01140875369310379,
-0.05646791309118271,
0.03883879631757736,
-0.02508... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}], "kwarg": null... | def __init__(self, args):
self.need_clean = args.need_clean
self.disable_strip = args.disable_strip
self.use_incredibuild = args.use_incredibuild
self.tool_dir = os.path.realpath(os.path.dirname(__file__))
self.no_android = args.no_android
self.engine_dir = os.path.join(... | |
10,851 | [
0.06413043290376663,
0.01989048905670643,
0.010431578382849693,
-0.03971540555357933,
-0.03777007386088371,
-0.014819507487118244,
0.028699135407805443,
-0.05486277863383293,
-0.004305962938815355,
-0.006584626156836748,
0.013868698850274086,
-0.019529838114976883,
0.007568222004920244,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def load_config(self):
cfg_json = os.path.join(self.tool_dir, Generator.CONFIG_FILE)
f = open(cfg_json)
cfg_info = json.load(f)
f.close()
self.xcode_proj_info = cfg_info[Generator.KEY_XCODE_PROJ_INFO]
self.win32_proj_info = cfg_info[Generator.KEY_WIN32_PROJ_INFO] | |
10,852 | [
0.026181533932685852,
0.021365217864513397,
0.05340781807899475,
-0.048978064209222794,
-0.005735699087381363,
-0.010353511199355125,
0.02070702239871025,
-0.02313085086643696,
-0.015096694231033325,
0.018711542710661888,
-0.0012661111541092396,
-0.03811262175440788,
0.022733844816684723,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def build_android(self):
# build .a for android
console_dir = os.path.join(self.engine_dir, CONSOLE_PATH)
cmd_path = os.path.join(console_dir, "cocos")
proj_path = os.path.join(self.engine_dir, TESTS_PROJ_PATH)
# Add multi ABI in Application.mk
mk_file = os.path.join(pro... | |
10,853 | [
-0.003350288374349475,
0.01065120566636324,
0.0675867423415184,
-0.006918441969901323,
-0.04585828259587288,
-0.013643225654959679,
0.04856949672102928,
0.009058366529643536,
-0.05995660275220871,
0.05937562882900238,
-0.016819221898913383,
0.040978092700242996,
0.024943185970187187,
0.005... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cmd_path", "annotation": null, "type_comment": null}}, {"_type": ... | def build_win32_proj(self, cmd_path, sln_path, proj_name, mode):
build_cmd = " ".join([
"\"%s\"" % cmd_path,
"\"%s\"" % sln_path,
"/%s \"Release|Win32\"" % mode,
"/Project \"%s\"" % proj_name
])
run_shell(build_cmd) | |
10,854 | [
-0.005675706081092358,
0.016403280198574066,
0.006886686198413372,
-0.024904606863856316,
-0.013455336913466454,
0.015681583434343338,
0.04579707607626915,
-0.030457990244030952,
-0.01795675978064537,
0.06566204875707626,
0.019938362762331963,
0.029650671407580376,
-0.004620685242116451,
0... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "require_version", "annotation": null, "type_comment": null}}], "k... | def get_vs_cmd_path(self, require_version):
# find the VS in register, if system is 64bit, should find vs in both 32bit & 64bit register
if self.is_32bit_windows():
reg_flag_list = [ _winreg.KEY_WOW64_32KEY ]
else:
reg_flag_list = [ _winreg.KEY_WOW64_64KEY, _winreg.KEY_WO... | |
10,855 | [
0.03386663645505905,
0.01252303272485733,
0.014112913981080055,
-0.04107555001974106,
-0.039050083607435226,
-0.02650527097284794,
0.034955594688653946,
-0.02236722595989704,
-0.019525041803717613,
-0.020058631896972656,
-0.010562906041741371,
-0.022977042943239212,
-0.02535097487270832,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def build_ios_mac(self):
for key in self.xcode_proj_info.keys():
output_dir = self.xcode_proj_info[key][Generator.KEY_OUTPUT_DIR]
proj_path = os.path.join(self.engine_dir, key)
ios_out_dir = os.path.join(self.tool_dir, output_dir, "ios")
mac_out_dir = os.path.join... | |
10,856 | [
0.003292023902758956,
0.004133632406592369,
0.06704131513834,
-0.022867122665047646,
-0.05086600407958031,
-0.01616504415869713,
0.05521773546934128,
-0.008118444122374058,
-0.07393839955329895,
0.07077722996473312,
0.004649374634027481,
0.019069619476795197,
-0.03586073964834213,
-0.00285... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def build_win32(self):
print("Building Win32")
for key in self.win32_proj_info.keys():
output_dir = self.win32_proj_info[key][Generator.KEY_OUTPUT_DIR]
proj_path = os.path.join(self.engine_dir, key)
require_vs_version = self.get_required_vs_version(proj_path)
... | |
10,857 | [
0.014750673435628414,
-0.08724675327539444,
0.029029862955212593,
-0.023708844557404518,
0.03118521347641945,
-0.04625020921230316,
-0.015076220966875553,
-0.0009373525390401483,
0.007498820312321186,
0.020397240296006203,
-0.02317000739276409,
-0.0018775115022435784,
0.012449388392269611,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "hide_password", "annotation": null, "type_comment": null}}], "kwa... | def __to_string__(self, hide_password=True):
s = self.drivername + "://"
if self.username is not None:
s += _rfc_1738_quote(self.username)
if self.password is not None:
s += ':' + ('***' if hide_password
else _rfc_1738_quote(self.passwo... | |
10,858 | [
0.011506077833473682,
0.03748371824622154,
0.01492626965045929,
-0.004282653331756592,
-0.026036949828267097,
-0.0245344378054142,
0.017931293696165085,
-0.03149344027042389,
-0.040034033358097076,
-0.01875174418091774,
-0.022003892809152603,
-0.018000489100813866,
0.007912900298833847,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def build_all_libs(self):
if os_is_mac():
# build for iOS & Mac
self.build_ios_mac()
if os_is_win32():
# build for win32
self.build_win32()
if not self.no_android:
self.build_android() | |
10,859 | [
-0.018664712086319923,
0.007363294716924429,
-0.0020559311378747225,
0.0010955313919112086,
0.021665185689926147,
-0.033225834369659424,
-0.0440584272146225,
-0.001563666039146483,
0.0036099450662732124,
0.05489102005958557,
-0.0014561122516170144,
-0.022117462009191513,
0.043771617114543915... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def _parse_rfc1738_args(name):
pattern = re.compile(r'''
(?P<name>[\w\+]+)://
(?:
(?P<username>[^:/]*)
(?::(?P<password>.*))?
@)?
(?:
(?:
\[(?P<ipv6host>[^/]+)\] |
(?P<ipv4host>[^/... | |
10,860 | [
0.01013138797134161,
0.029417453333735466,
-0.03026217594742775,
-0.01977706141769886,
-0.0025988409761339426,
-0.00033145450288429856,
-0.04126468300819397,
-0.008336353115737438,
-0.024391356855630875,
0.025932975113391876,
0.0010954992612823844,
-0.006045043934136629,
0.010115549899637699... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def _parse_keyvalue_args(name):
m = re.match(r'(\w+)://(.*)', name)
if m is not None:
(name, args) = m.group(1, 2)
opts = dict(util.parse_qsl(args))
return URL(name, *opts)
else:
return None | |
10,861 | [
-0.0029887089040130377,
-0.019830096513032913,
-0.010130592621862888,
-0.016476012766361237,
-0.020292727276682854,
-0.019882667809724808,
0.015172231942415237,
-0.018452713266015053,
0.0030386520083993673,
0.014814742840826511,
-0.012764441780745983,
-0.042372897267341614,
-0.03778863325715... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CharField", "value": {"_type": "Name", "_fields": {"id": "mo... | class Post(models.Model):
title=models.CharField(max_length=120)
content=models.TextField()
updated=models.DateTimeField(auto_now=True,auto_now_add=False)
timestamp=models.DateTimeField(auto_now=False,auto_now_add=True)
def __unicode__(self):
return self.title
def __str__(self):
return self.title | |
10,862 | [
0.008637991733849049,
0.022360803559422493,
-0.019272705540060997,
-0.045267295092344284,
-0.011819104664027691,
0.004660050850361586,
0.00010328539792681113,
0.03013685718178749,
0.0403561033308506,
0.05938076972961426,
0.0024044374004006386,
-0.02589537389576435,
0.02969038486480713,
-0.... | 17 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "explanation", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyar... | def plain_concepts_extractor(explanation):
if "description" in explanation and explanation["description"].startswith(u"weight("):
description = explanation["description"]
return [(description.split(u"weight(")[1].split(u")")[0].rsplit(u" in ", 1)[0], explanation["value"])]
results = []
for d... | |
10,863 | [
0.02591320127248764,
-0.014070776291191578,
0.03172529116272926,
-0.04158058017492294,
0.002463821554556489,
0.004933386575430632,
0.04792104288935661,
-0.030461793765425682,
-0.03774413838982582,
0.05963711813092232,
0.04479675740003586,
0.00239346781745553,
0.0065587046556174755,
0.00266... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "field", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, field, op1, value1, op2=None, value2=None):
from_value = to_value = include_lower = include_upper = None
for op, value in ((op1, value1), (op2, value2)):
if op == "gt":
from_value = value
include_lower = False
elif op == "gte":
... | |
10,864 | [
0.036851927638053894,
-0.005417040549218655,
0.03370603173971176,
-0.05127596855163574,
0.007693535182625055,
0.011481450870633125,
0.036081504076719284,
-0.02978971041738987,
-0.02784225158393383,
0.04519818350672722,
0.027521241456270218,
-0.023690523579716682,
0.024739157408475876,
0.00... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "field", "annotation": ... | class ESRangeOp(ESRange):
def __init__(self, field, op1, value1, op2=None, value2=None):
from_value = to_value = include_lower = include_upper = None
for op, value in ((op1, value1), (op2, value2)):
if op == "gt":
from_value = value
include_lower = False
... | |
10,865 | [
0.001003528363071382,
-0.021207479760050774,
-0.04420273378491402,
-0.025922736153006554,
0.0294088963419199,
0.0006571469129994512,
-0.0063912952318787575,
0.01677156239748001,
-0.00042704076622612774,
0.04630336910486221,
-0.004405188839882612,
-0.0018157088197767735,
0.023263420909643173,... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "thresh", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def _sparsify(x, thresh=0.5, index_dtype=np.int64):
x[x < thresh] = 0
non_zero = np.where(x)
x_indices = np.vstack(non_zero).astype(index_dtype).T
x_values = x[non_zero]
x_shape = x.shape
return sparse_tensor.SparseTensor(
indices=x_indices, values=x_values, dense_shape=x_shape), x_values | |
10,866 | [
0.018022185191512108,
0.003581778611987829,
-0.0050080991350114346,
-0.027957046404480934,
0.031140848994255066,
0.03297676518559456,
-0.0008758364128880203,
0.003799648489803076,
0.014815143309533596,
0.032116904854774475,
0.015082396566867828,
0.00011547096801223233,
0.0031024652998894453,... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null... | class LogicalOpTest(test.TestCase):
def _compareBinary(self, x, y, np_func, tf_func, use_gpu=False):
np_ans = np_func(x, y)
with self.test_session(use_gpu=use_gpu,
force_gpu=use_gpu and test_util.is_gpu_available()):
inx = ops.convert_to_tensor(x)
iny = ops.convert_to_t... | |
10,867 | [
-0.005378788337111473,
-0.004235651809722185,
-0.011828727088868618,
-0.03694893419742584,
0.04632437974214554,
0.004854730796068907,
-0.029093829914927483,
0.018727857619524002,
0.03160469979047775,
0.0045754252932965755,
0.0013770906953141093,
0.0012151224073022604,
-0.01315326802432537,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _not(self, x, use_gpu=False):
np_ans = np.logical_not(x)
with self.test_session(use_gpu=use_gpu,
force_gpu=use_gpu and test_util.is_gpu_available()):
out = math_ops.logical_not(ops.convert_to_tensor(x))
tf_val = out.eval()
self.assertEqual(out.dtype, dtypes_lib.boo... | |
10,868 | [
-0.015775199979543686,
0.008200514130294323,
-0.02113790437579155,
-0.030385062098503113,
0.061676498502492905,
-0.003835898358374834,
0.03998829424381256,
0.011836794205009937,
0.05114531144499779,
0.04255635291337967,
0.007202425040304661,
-0.01938989944756031,
-0.0015537815634161234,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _compareBinary(self, x, y, np_func, tf_func, use_gpu=False):
np_ans = np_func(x, y)
with self.test_session(use_gpu=use_gpu,
force_gpu=use_gpu and test_util.is_gpu_available()):
inx = ops.convert_to_tensor(x)
iny = ops.convert_to_tensor(y)
out = tf_func(inx, iny)
... | |
10,869 | [
-0.009680661372840405,
-0.0037171600852161646,
0.02405605837702751,
-0.014488307759165764,
0.04297761991620064,
-0.020098218694329262,
-0.02323596552014351,
-0.010696863755583763,
0.020823227241635323,
0.025815097615122795,
-0.009680661372840405,
-0.01240836177021265,
-0.005113694816827774,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testScalar(self):
data = [np.array([True]), np.array([False])]
for use_gpu in [True, False]:
for x in data:
self._not(x, use_gpu)
for x in data:
for y in data:
self._compareBinary(x, y, np.logical_and, math_ops.logical_and,
use_gpu)
... | |
10,870 | [
-0.01049426943063736,
-0.02686348743736744,
0.016853036358952522,
-0.015320942737162113,
0.036240365356206894,
-0.016922153532505035,
0.027738969773054123,
0.019640756770968437,
0.022612789645791054,
0.028130631893873215,
-0.0243061576038599,
-0.0023427794221788645,
0.014468499459326267,
0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testTensor(self):
x = np.random.randint(0, 2, 6).astype(np.bool).reshape(1, 3, 2)
y = np.random.randint(0, 2, 6).astype(np.bool).reshape(1, 3, 2)
for use_gpu in [True, False]:
self._not(x, use_gpu)
self._compareBinary(x, y, np.logical_and, math_ops.logical_and, use_gpu)
self._compareBi... | |
10,871 | [
0.01700635440647602,
0.005509801674634218,
-0.02132524363696575,
-0.015344344079494476,
0.031063225120306015,
0.011704305186867714,
-0.005515653640031815,
0.028324417769908905,
0.038600798696279526,
0.017696909606456757,
0.013775967061519623,
0.0012157846940681338,
-0.029728934168815613,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testUsingAsPythonValueFails(self):
# Ensure that we raise an error when the user attempts to treat a
# `Tensor` as a Python `bool`.
b = constant_op.constant(False)
with self.assertRaises(TypeError):
if b:
pass
x = constant_op.constant(3)
y = constant_op.constant(4)
with se... | |
10,872 | [
0.009810464456677437,
-0.01647905632853508,
0.06788463145494461,
0.015608417801558971,
0.023709148168563843,
-0.004731735214591026,
0.03641543537378311,
0.000400620250729844,
-0.01723613403737545,
0.04620697349309921,
-0.01068110391497612,
-0.007722191978245974,
0.029122253879904747,
0.023... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testBCast(self):
shapes = [
([1, 3, 2], [1]),
([1, 3, 2], [2]),
([1, 3, 2], [3, 2]),
([1, 3, 2], [3, 1]),
([1, 3, 2], [1, 3, 2]),
([1, 3, 2], [2, 3, 1]),
([1, 3, 2], [2, 1, 1]),
([1, 3, 2], [1, 3, 1]),
([2, 1, 5], [2, 3, 1]),
([2, 0... | |
10,873 | [
-0.008368788287043571,
-0.02861911989748478,
0.008188934996724129,
-0.009402942843735218,
0.059576328843832016,
-0.0033806755673140287,
-0.0025994388852268457,
-0.0005381540977396071,
0.034441862255334854,
0.03929789364337921,
0.004431691952049732,
-0.01823260448873043,
0.009060097858309746,... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "c", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _compare(self, c, x, y, use_gpu):
np_ans = np.where(c, x, y)
with self.test_session(use_gpu=use_gpu,
force_gpu=use_gpu and test_util.is_gpu_available()):
out = array_ops.where(c, x, y)
tf_ans = out.eval()
self.assertAllEqual(np_ans, tf_ans)
self.assertShapeEqua... | |
10,874 | [
0.005190915893763304,
0.022927291691303253,
0.012527530081570148,
-0.018564173951745033,
0.057377997785806656,
0.02464863285422325,
0.0350244864821434,
-0.020321374759078026,
0.047575924545526505,
0.01597020961344242,
0.008971288800239563,
-0.02780442126095295,
-0.006126296706497669,
0.047... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "c", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _compareGradientX(self, c, x, y, numeric_gradient_type=None):
with self.cached_session():
inx = ops.convert_to_tensor(x)
iny = ops.convert_to_tensor(y)
out = array_ops.where(c, inx, iny)
s = list(np.shape(c))
jacob_t, jacob_n = gradient_checker.compute_gradient(
inx, s, o... | |
10,875 | [
0.005695210304111242,
0.026182396337389946,
0.014217065647244453,
-0.0159417986869812,
0.055239345878362656,
0.03382391855120659,
0.038039933890104294,
-0.019019966945052147,
0.035788197070360184,
0.01917567104101181,
0.009054845198988914,
-0.030733773484826088,
-0.009869302622973919,
0.04... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "c", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _compareGradientY(self, c, x, y, numeric_gradient_type=None):
with self.cached_session():
inx = ops.convert_to_tensor(x)
iny = ops.convert_to_tensor(y)
out = array_ops.where(c, inx, iny)
s = list(np.shape(c))
jacob_t, jacob_n = gradient_checker.compute_gradient(
iny, s, o... | |
10,876 | [
-0.011978590860962868,
-0.026223909109830856,
0.04520931839942932,
-0.015078120864927769,
0.03882240504026413,
-0.002546937670558691,
-0.01951138861477375,
0.00839691050350666,
0.019160736352205276,
0.05254800245165825,
-0.006211584899574518,
-0.022992882877588272,
-0.016956625506281853,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testScalar(self):
c = True
x = np.random.rand(1, 3, 2) * 100
y = np.random.rand(1, 3, 2) * 100
for t in [
np.float16, np.float32, np.float64, np.int32, np.int64, np.complex64,
np.complex128
]:
xt = x.astype(t)
yt = y.astype(t)
self._compare(c, xt, yt, use_gpu=Fa... | |
10,877 | [
-0.026537390425801277,
0.0007874174625612795,
0.07657317072153091,
-0.03098820522427559,
0.01823398657143116,
0.008279474452137947,
0.019083470106124878,
0.013603702187538147,
0.02469484694302082,
0.047642871737480164,
-0.009996388107538223,
-0.002904396504163742,
-0.047762516885995865,
0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testGradients(self):
c = np.random.randint(0, 2, 6).astype(np.bool).reshape(1, 3, 2)
x = np.random.rand(1, 3, 2) * 100
y = np.random.rand(1, 3, 2) * 100
for t in [np.float16, np.float32, np.float64]:
xt = x.astype(t)
yt = y.astype(t)
if t == np.float16:
# Compare fp16 theor... | |
10,878 | [
-0.02583368867635727,
-0.034058086574077606,
0.06291916221380234,
-0.007051285356283188,
0.020624063909053802,
-0.022541407495737076,
0.012544727884232998,
0.030172942206263542,
0.026540078222751617,
0.04997708648443222,
-0.014216097071766853,
-0.020359167829155922,
-0.011043650098145008,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testBasic(self):
c = np.random.randint(0, 2, 6).astype(np.bool).reshape(1, 3, 2)
x = np.random.rand(1, 3, 2) * 100
y = np.random.rand(1, 3, 2) * 100
for t in [
np.float16, np.float32, np.float64, np.int32, np.int64, np.complex64,
np.complex128
]:
xt = x.astype(t)
yt =... | |
10,879 | [
0.008627637289464474,
-0.013942163437604904,
0.03630874305963516,
-0.012322557158768177,
0.017329173162579536,
-0.013806683011353016,
0.020629968494176865,
0.036087051033973694,
0.02862331084907055,
0.01545708067715168,
0.0026110766921192408,
-0.009422045201063156,
0.013437191024422646,
0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testEmptyTensor(self):
c = np.random.randint(0, 3, 0).astype(np.bool).reshape(1, 3, 0)
x = np.random.rand(1, 3, 0) * 100
y = np.random.rand(1, 3, 0) * 100
z_expected = np.zeros((1, 3, 0), dtype=np.float32)
with self.cached_session():
xt = x.astype(np.float32)
yt = y.astype(np.float32... | |
10,880 | [
-0.01342038530856371,
-0.011753406375646591,
0.05972132086753845,
0.030827023088932037,
0.017201285809278488,
0.006072996184229851,
-0.00115888228174299,
0.01803477481007576,
-0.01881994679570198,
0.023784643039107323,
0.010062268935143948,
-0.01606580801308155,
0.030174728482961655,
0.033... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testShapeMismatch(self):
c = np.random.randint(0, 2, 6).astype(np.bool).reshape(1, 3, 2)
x = np.random.rand(1, 3, 2) * 100
y = np.random.rand(2, 5, 3) * 100
for t in [
np.float16, np.float32, np.float64, np.int32, np.int64, np.complex64,
np.complex128
]:
xt = x.astype(t)
... | |
10,881 | [
0.004893197678029537,
0.02286875806748867,
0.012109097093343735,
-0.018474135547876358,
0.058085452765226364,
0.024039065465331078,
0.03596903383731842,
-0.0192981269210577,
0.04738549888134003,
0.0150945745408535,
0.008526523597538471,
-0.027012601494789124,
-0.006669557187706232,
0.04669... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "c", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _compareGradientX(self, c, x, y, numeric_gradient_type=None):
with self.cached_session():
inx = ops.convert_to_tensor(x)
iny = ops.convert_to_tensor(y)
out = array_ops.where(c, inx, iny)
s = list(np.shape(x))
jacob_t, jacob_n = gradient_checker.compute_gradient(
inx, s, o... | |
10,882 | [
-0.007682857569307089,
-0.030282797291874886,
-0.00033437254023738205,
-0.01744064874947071,
0.05132373422384262,
-0.0032946562860161066,
-0.0016809756634756923,
0.0008033353369683027,
0.03156140446662903,
0.04253050684928894,
0.0004135844937991351,
-0.018225757405161858,
0.01131118554621934... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "c", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _compare(self, c, x, y, use_gpu):
np_ans = np.dstack(
[x_i if c_i else y_i for c_i, x_i, y_i in zip(c, x, y)]).transpose(
[2, 0, 1])
with self.test_session(use_gpu=use_gpu,
force_gpu=use_gpu and test_util.is_gpu_available()):
out = array_ops.where(c, x, y... | |
10,883 | [
0.004415222443640232,
0.02775966376066208,
0.014466134831309319,
-0.01699082925915718,
0.05427492782473564,
0.03240222856402397,
0.0372123084962368,
-0.018893321976065636,
0.03714051470160484,
0.013903762213885784,
0.007986885495483875,
-0.03161251172423363,
-0.010068860836327076,
0.043075... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "c", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _compareGradientY(self, c, x, y, numeric_gradient_type=None):
with self.cached_session():
inx = ops.convert_to_tensor(x)
iny = ops.convert_to_tensor(y)
out = array_ops.where(c, inx, iny)
s = list(np.shape(x))
jacob_t, jacob_n = gradient_checker.compute_gradient(
iny, s, o... | |
10,884 | [
-0.022458765655755997,
-0.031274594366550446,
0.061177272349596024,
-0.0061990260146558285,
0.021658482030034065,
-0.020667653530836105,
0.005716315004974604,
0.032367043197155,
0.0254820603877306,
0.050887905061244965,
-0.011477089487016201,
-0.025672605261206627,
-0.015395941212773323,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testBasic(self):
c = np.random.randint(0, 2, 16).astype(np.bool)
x = np.random.rand(16, 2, 8) * 100
y = np.random.rand(16, 2, 8) * 100
for t in [
np.float16, np.float32, np.float64, np.int32, np.int64, np.complex64,
np.complex128
]:
xt = x.astype(t)
yt = y.astype(t)
... | |
10,885 | [
-0.012343643233180046,
-0.006092734634876251,
0.05679657310247421,
0.03521192818880081,
0.023409727960824966,
0.007774852681905031,
-0.008170287124812603,
0.019345877692103386,
-0.02233901247382164,
0.024054590612649918,
0.0150143476203084,
-0.014503324404358864,
0.029736680909991264,
0.03... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testShapeMismatch(self):
c = np.random.randint(0, 2, 8).astype(np.bool)
x = np.random.rand(16, 3, 2) * 100
y = np.random.rand(16, 3, 2) * 100
for t in [
np.float16, np.float32, np.float64, np.int32, np.int64, np.complex64,
np.complex128
]:
xt = x.astype(t)
yt = y.asty... | |
10,886 | [
-0.02476567216217518,
0.0020263094920665026,
0.0730491355061531,
-0.028845289722085,
0.01875423826277256,
0.010948970913887024,
0.014026681892573833,
0.014914598315954208,
0.02438170835375786,
0.052171096205711365,
-0.006713368929922581,
-0.008003247901797295,
-0.046579621732234955,
0.0081... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testGradients(self):
c = np.random.randint(0, 2, 16).astype(np.bool)
x = np.random.rand(16, 2, 8) * 100
y = np.random.rand(16, 2, 8) * 100
for t in [np.float16, np.float32, np.float64]:
xt = x.astype(t)
yt = y.astype(t)
if t == np.float16:
# Compare fp16 theoretical gradien... | |
10,887 | [
-0.032315853983163834,
-0.009375721216201782,
0.023547817021608353,
-0.04357973858714104,
0.05538620427250862,
-0.023526115342974663,
0.015181289054453373,
0.010005109943449497,
0.03589685633778572,
0.008540153503417969,
0.0031198144424706697,
-0.0019492058781906962,
-0.048050571233034134,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _compare(self, x, y, use_gpu):
np_min, np_max = np.minimum(x, y), np.maximum(x, y)
with self.test_session(
use_gpu=use_gpu,
force_gpu=use_gpu and test_util.is_gpu_available()) as sess:
inx = ops.convert_to_tensor(x)
iny = ops.convert_to_tensor(y)
omin, omax = math_ops.minim... | |
10,888 | [
-0.028642481192946434,
-0.016226744279265404,
0.040147408843040466,
-0.017748750746250153,
0.0519639328122139,
0.0003291937755420804,
-0.00044828778482042253,
0.0071726045571267605,
0.034634631127119064,
0.0071606202982366085,
-0.013434402644634247,
-0.009365731850266457,
-0.0152080785483121... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null... | class MinMaxOpTest(test.TestCase):
def _compare(self, x, y, use_gpu):
np_min, np_max = np.minimum(x, y), np.maximum(x, y)
with self.test_session(
use_gpu=use_gpu,
force_gpu=use_gpu and test_util.is_gpu_available()) as sess:
inx = ops.convert_to_tensor(x)
iny = ops.convert_to_tenso... | |
10,889 | [
-0.00449978094547987,
0.029316218569874763,
-0.01518749538809061,
-0.03176315873861313,
0.07924319803714752,
0.007211413234472275,
0.03865693882107735,
-0.0094760088250041,
0.07279645651578903,
0.025386998429894447,
0.0006238666828721762,
-0.009828932583332062,
-0.022787125781178474,
0.023... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "func", "annotation": null, "type_comment": null}}, {"_type": "arg... | def _compareGradientX(self, func, x, y):
with self.cached_session():
inx = ops.convert_to_tensor(x)
iny = ops.convert_to_tensor(y)
out = func(inx, iny)
s = list(np.shape(x))
jacob_t, jacob_n = gradient_checker.compute_gradient(
inx, s, out, s, x_init_value=x)
if x.dtype =... | |
10,890 | [
-0.009813944809138775,
0.035450734198093414,
-0.013140404596924782,
-0.029731348156929016,
0.0754864290356636,
0.014889308251440525,
0.03946848213672638,
-0.0075746397487819195,
0.06404765695333481,
0.025713598355650902,
-0.0006621162756346166,
-0.012644094415009022,
-0.02325568161904812,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "func", "annotation": null, "type_comment": null}}, {"_type": "arg... | def _compareGradientY(self, func, x, y):
with self.cached_session():
inx = ops.convert_to_tensor(x)
iny = ops.convert_to_tensor(y)
out = func(inx, iny)
s = list(np.shape(x))
jacob_t, jacob_n = gradient_checker.compute_gradient(
iny, s, out, s, x_init_value=y)
if x.dtype =... | |
10,891 | [
-0.037782806903123856,
-0.007788342423737049,
0.06958416849374771,
-0.028511563315987587,
0.049346938729286194,
-0.004380163736641407,
0.026866666972637177,
-0.016885126009583473,
0.034866850823163986,
0.023664100095629692,
-0.013209029100835323,
-0.00022917197202332318,
-0.03995108231902122... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testGradients(self):
x = np.random.rand(1, 3, 2) * 100.
# ensure x != y
y = x + (np.random.randint(2, size=x.shape) - .5) * 2 # -1 or +1
self._compareGradientX(math_ops.maximum, x, y)
self._compareGradientY(math_ops.maximum, x, y)
self._compareGradientX(math_ops.minimum, x, y)
self._com... | |
10,892 | [
0.0023847653064876795,
0.006370978895574808,
0.007336278911679983,
-0.04673950374126434,
0.01974908448755741,
0.035776227712631226,
0.012571052648127079,
-0.0015879974234849215,
0.010710081085562706,
0.015482776798307896,
0.016115760430693626,
0.01478649489581585,
-0.027572762221097946,
0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null... | class MathOpsOverloadTest(test.TestCase):
def _computeTensorAndLiteral(self, x, y, dtype, func):
with self.test_session(use_gpu=False):
inx = ops.convert_to_tensor(x, dtype=dtype)
z = func(inx, y) # Should use __add__, __sub__, etc.
return z.eval()
def _computeLiteralAndTensor(self, x, y, d... | |
10,893 | [
0.009207705035805702,
0.023205991834402084,
0.03636721521615982,
-0.02912982925772667,
0.03229779377579689,
0.03358558565378189,
0.010604958049952984,
0.02468695119023323,
0.003464157460257411,
0.05140861123800278,
0.034203726798295975,
0.01792604848742485,
-0.02704360894858837,
0.00862819... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testOverload(self):
dtypes = [
dtypes_lib.float16,
dtypes_lib.float32,
dtypes_lib.float64,
dtypes_lib.int32,
dtypes_lib.int64,
dtypes_lib.complex64,
dtypes_lib.complex128,
]
funcs = [
(np.add, _ADD),
(np.subtract, _SUB),
(np... | |
10,894 | [
0.005695545580238104,
-0.001287756604142487,
0.03151952475309372,
-0.03432348370552063,
0.024196680635213852,
0.03757808357477188,
0.020566552877426147,
0.006553006824105978,
0.006747030653059483,
0.05039618909358978,
0.011491232551634312,
0.004537659697234631,
-0.014533028937876225,
0.000... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testOverloadComparisons(self):
dtypes = [
dtypes_lib.float16,
dtypes_lib.float32,
dtypes_lib.float64,
dtypes_lib.int32,
dtypes_lib.int64,
]
funcs = [
(np.less, _LT),
(np.less_equal, _LE),
(np.greater, _GT),
(np.greater_equal, _GE),
... | |
10,895 | [
-0.017566461116075516,
-0.011177587322890759,
0.044663283973932266,
-0.012495365925133228,
0.04348669946193695,
-0.009853925555944443,
-0.02122564986348152,
0.01604866236448288,
0.027555694803595543,
0.025861406698822975,
0.014083759859204292,
-0.02703799493610859,
-0.02957942523062229,
0.... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null... | class IsFiniteInfNanTest(test.TestCase):
def _compare(self, x, use_gpu):
np_finite, np_inf, np_nan = np.isfinite(x), np.isinf(x), np.isnan(x)
with self.test_session(
use_gpu=use_gpu,
force_gpu=use_gpu and test_util.is_gpu_available()) as sess:
inx = ops.convert_to_tensor(x)
ofinit... | |
10,896 | [
-0.022269034758210182,
-0.003988746087998152,
0.002648914000019431,
-0.004407535307109356,
0.07141085714101791,
-0.03713458403944969,
-0.0022008391097187996,
0.01435011439025402,
0.0485912449657917,
0.05107469484210014,
0.03666600584983826,
-0.006132477428764105,
-0.040648896247148514,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _compare(self, x, use_gpu):
np_finite, np_inf, np_nan = np.isfinite(x), np.isinf(x), np.isnan(x)
with self.test_session(
use_gpu=use_gpu,
force_gpu=use_gpu and test_util.is_gpu_available()) as sess:
inx = ops.convert_to_tensor(x)
ofinite, oinf, onan = math_ops.is_finite(inx), mat... | |
10,897 | [
-0.0011344572994858027,
-0.021242836490273476,
0.041962843388319016,
-0.010598686523735523,
-0.006148942746222019,
-0.006882042624056339,
-0.05105555057525635,
0.02064044401049614,
0.015491698868572712,
0.044986166059970856,
0.027960073202848434,
-0.0030602640472352505,
-0.03677999973297119,... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testSqrt(self):
for dtype in [np.float16, np.float32, np.float64]:
fi = np.finfo(dtype)
for size in [1, 3, 4, 7, 8, 63, 64, 65]:
# For float32 Eigen uses Carmack's fast vectorized sqrt algorithm.
# It is not accurate for very large arguments, so we test for
# fi.max/100 inste... | |
10,898 | [
-0.030759481713175774,
-0.011336499825119972,
0.04155614972114563,
-0.04843075945973396,
0.04082902520895004,
-0.027035733684897423,
-0.04272394999861717,
-0.0041286232881248,
0.013572951778769493,
0.01850857026875019,
0.010179714299738407,
0.00797631312161684,
-0.01594160869717598,
0.0088... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "dtype", "annotation": null, "type_comment": null}}], "kwarg": nul... | def _testDtype(self, dtype):
fi = np.finfo(dtype)
data = np.array([
0, -1, 1, fi.resolution, -fi.resolution, fi.min, fi.max, -np.inf,
np.inf, np.nan
]).astype(dtype)
self._compare(data, use_gpu=False)
self._compare(data, use_gpu=True) | |
10,899 | [
-0.010357390157878399,
-0.016588008031249046,
0.03375399485230446,
-0.031234003603458405,
0.08646570891141891,
0.013767467811703682,
0.019616618752479553,
0.013455359265208244,
0.04230808839201927,
0.020552946254611015,
0.012299400754272938,
-0.011386193335056305,
-0.01877276971936226,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def _compare(self, x):
np_floor, np_ceil = np.floor(x), np.ceil(x)
with self.cached_session() as sess:
inx = ops.convert_to_tensor(x)
ofloor, oceil = math_ops.floor(inx), math_ops.ceil(inx)
tf_floor, tf_ceil = sess.run([ofloor, oceil])
self.assertAllEqual(np_floor, tf_floor)
self.asser... | |
10,900 | [
-0.005366244353353977,
-0.019276857376098633,
0.058793820440769196,
-0.04766295105218887,
0.0409083217382431,
0.018646584823727608,
0.00004998336953576654,
0.012510336004197598,
0.023641204461455345,
0.019169829785823822,
0.0005674691637977958,
-0.0036716407630592585,
-0.027874739840626717,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null... | class RoundingTest(test.TestCase):
def _compare_values(self, x, y=None):
y = np.rint(x) if y is None else np.asarray(y)
with self.cached_session() as sess:
tf_rint = math_ops.rint(x)
np_rint = sess.run(tf_rint)
self.assertAllEqual(y, np_rint)
self.assertShapeEqual(y, tf_rint)
def _comp... |