query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Sets the sign_request of this Notification. | def sign_request(self, sign_request):
self._sign_request = sign_request | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signrequest(self, signrequest):\n\n self._signrequest = signrequest",
"def sign_request(self):\n return self._sign_request",
"def sign_date(self, sign_date):\n\n self._sign_date = sign_date",
"def signature_flag(self, signature_flag):\n\n self._signature_flag = signature_flag"... | [
"0.84742993",
"0.64590573",
"0.620037",
"0.6148148",
"0.6113091",
"0.5792947",
"0.5792947",
"0.57670236",
"0.57670236",
"0.5736216",
"0.5673617",
"0.5673617",
"0.56619704",
"0.5566606",
"0.55310297",
"0.5487905",
"0.5442937",
"0.5238676",
"0.52140945",
"0.5198234",
"0.5179636... | 0.8737033 | 0 |
Gets the signature_receipt of this Notification. | def signature_receipt(self):
return self._signature_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getReceipt(self):\n return self._Receipt",
"def signature(self):\n return self._signature",
"def signature(self):\n return self._signature",
"def signature(self):\n return self._signature",
"def signature(self) -> object:\n return self._signature",
"def signature(se... | [
"0.70089465",
"0.6790117",
"0.6790117",
"0.6790117",
"0.67468214",
"0.67468214",
"0.66194445",
"0.6583787",
"0.6546591",
"0.6222418",
"0.60791725",
"0.59909457",
"0.59747934",
"0.59122163",
"0.5862758",
"0.5801572",
"0.5718406",
"0.566632",
"0.55493283",
"0.5482278",
"0.54530... | 0.87627965 | 0 |
Sets the signature_receipt of this Notification. | def signature_receipt(self, signature_receipt):
self._signature_receipt = signature_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature(self, signature):\n\n self._signature = signature",
"def signature(self, signature):\n\n self._signature = signature",
"def signature(self, signature: object):\n\n self._signature = signature",
"def signature(self, signature: object):\n\n self._signature = signature"... | [
"0.6701163",
"0.6701163",
"0.6632486",
"0.6632486",
"0.6313848",
"0.62911636",
"0.6196344",
"0.6086643",
"0.6081512",
"0.59637827",
"0.5959168",
"0.58943254",
"0.58943254",
"0.5879025",
"0.5794835",
"0.5639368",
"0.5639368",
"0.562514",
"0.5517498",
"0.5482735",
"0.54577374",... | 0.8634348 | 0 |
Gets the final_receipt of this Notification. | def final_receipt(self):
return self._final_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getReceipt(self):\n return self._Receipt",
"def final_receipt(self, final_receipt):\n\n self._final_receipt = final_receipt",
"def signature_receipt(self):\n return self._signature_receipt",
"def expired_receipt(self):\n return self._expired_receipt",
"def canceled_receipt(s... | [
"0.77169365",
"0.7076309",
"0.6723085",
"0.61884576",
"0.5989326",
"0.52719885",
"0.51912034",
"0.5185656",
"0.5172056",
"0.51552427",
"0.51406",
"0.5103925",
"0.51008695",
"0.50596833",
"0.5029491",
"0.5015495",
"0.5008211",
"0.49744728",
"0.49663818",
"0.49422437",
"0.49082... | 0.8890507 | 0 |
Sets the final_receipt of this Notification. | def final_receipt(self, final_receipt):
self._final_receipt = final_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def final_receipt(self):\n return self._final_receipt",
"def final_fee(self, final_fee):\n\n self._final_fee = final_fee",
"def signature_receipt(self, signature_receipt):\n\n self._signature_receipt = signature_receipt",
"def receipt_date(self, receipt_date):\n\n self._receipt_da... | [
"0.71738446",
"0.68162334",
"0.59358484",
"0.55554044",
"0.55554044",
"0.5494866",
"0.54874605",
"0.510274",
"0.5064916",
"0.47631332",
"0.46558532",
"0.46454015",
"0.4602984",
"0.45904246",
"0.45539644",
"0.44825977",
"0.4455887",
"0.44092995",
"0.43887445",
"0.43840337",
"0... | 0.9068991 | 0 |
Gets the expired_receipt of this Notification. | def expired_receipt(self):
return self._expired_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getReceipt(self):\n return self._Receipt",
"def canceled_receipt(self):\n return self._canceled_receipt",
"def expired_receipt(self, expired_receipt):\n\n self._expired_receipt = expired_receipt",
"def signature_receipt(self):\n return self._signature_receipt",
"def final_re... | [
"0.6830866",
"0.6528994",
"0.64108986",
"0.6122404",
"0.611016",
"0.5972135",
"0.59301025",
"0.58057636",
"0.57681483",
"0.56331587",
"0.5622614",
"0.56137514",
"0.55514413",
"0.55232537",
"0.5511145",
"0.5458906",
"0.54523116",
"0.5428282",
"0.53302795",
"0.5286335",
"0.5271... | 0.8766947 | 0 |
Sets the expired_receipt of this Notification. | def expired_receipt(self, expired_receipt):
self._expired_receipt = expired_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expired_receipt(self):\n return self._expired_receipt",
"def set_expired(self, bExpired):\n self._bExpired = bExpired",
"def canceled_receipt(self, canceled_receipt):\n\n self._canceled_receipt = canceled_receipt",
"def receipt_date(self, receipt_date):\n\n self._receipt_date ... | [
"0.69136924",
"0.65413976",
"0.6506499",
"0.6205384",
"0.6205384",
"0.58310276",
"0.57295185",
"0.5686164",
"0.5681967",
"0.56405723",
"0.55964017",
"0.5468952",
"0.53696054",
"0.53485996",
"0.52808875",
"0.52037495",
"0.51817936",
"0.51682025",
"0.514733",
"0.5086682",
"0.50... | 0.89509016 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Notification):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Default encoder for the configuration. Basically, it encodes the dictionary of configuration values in a JSON or pickle file. It is necessary that every value is serializable. | def serialize(cls, obj):
return json.dumps(obj, cls=CustomTypeEncoder) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self):\n return json.dumps(self._config, default=lambda o: o.__dict__, sort_keys=True, indent=4)",
"def serialize(self):\n return json.dumps(self._config, default=lambda o: o.__dict__, sort_keys=True, indent=4)",
"def __json_encode__(self):\r\n return self.config()",
"def _... | [
"0.67518497",
"0.67518497",
"0.666391",
"0.6614831",
"0.65843654",
"0.6383003",
"0.6227762",
"0.61965716",
"0.6076121",
"0.6041518",
"0.58445024",
"0.5726644",
"0.5711411",
"0.5708056",
"0.56904864",
"0.56858945",
"0.56858945",
"0.5652299",
"0.56503516",
"0.56424916",
"0.5626... | 0.5541028 | 28 |
Write a signed Int8 Address The address of the device Register The register to write to Int8 Data to write | def Write_Int8(self,Address,Register,Int8):
self.Transaction(chr(Address)+chr(Register)+struct.pack('b',Int8)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write_uInt8(self,Address,Register,uInt8):\n self.Transaction(chr(Address)+chr(Register)+struct.pack('B',uInt8))",
"def Write_uInt8s(self,Address,Register,*Bytes):\n\n self.Transaction(chr(Address)+chr(Register)+''.join([chr(b) for b in Bytes]))",
"def write8(self, register, value):\n r... | [
"0.78396",
"0.7361376",
"0.7318864",
"0.71235067",
"0.69756967",
"0.67618924",
"0.67304933",
"0.6645114",
"0.6605967",
"0.65409344",
"0.6473072",
"0.64430517",
"0.63728863",
"0.63628685",
"0.63356644",
"0.63318735",
"0.63112986",
"0.62819844",
"0.62717485",
"0.62658685",
"0.6... | 0.7935615 | 0 |
Write a unsigned Int8 Address The address of the device Register The register to write to Int8 Data to write | def Write_uInt8(self,Address,Register,uInt8):
self.Transaction(chr(Address)+chr(Register)+struct.pack('B',uInt8)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write_Int8(self,Address,Register,Int8):\n self.Transaction(chr(Address)+chr(Register)+struct.pack('b',Int8))",
"def Write_uInt8s(self,Address,Register,*Bytes):\n\n self.Transaction(chr(Address)+chr(Register)+''.join([chr(b) for b in Bytes]))",
"def i2c_write8(self, address, register, value):\... | [
"0.783875",
"0.73918885",
"0.7331926",
"0.72815585",
"0.7139815",
"0.6933486",
"0.69315565",
"0.687477",
"0.6825541",
"0.66600263",
"0.66334826",
"0.66192186",
"0.6473537",
"0.64359456",
"0.6399895",
"0.63837516",
"0.63691723",
"0.6330402",
"0.627311",
"0.6237708",
"0.6192998... | 0.78742146 | 0 |
Write a signed Int32 Address The address of the device Register The register to write to Int32 Data to write | def Write_Int32(self,Address,Register,Int32):
self.Transaction(chr(Address)+chr(Register)+struct.pack('i',Int32)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write_uInt32(self,Address,Register,uInt32):\n self.Transaction(chr(Address)+chr(Register)+struct.pack('I',uIt32))",
"def memory_write32(self, addr, data, zone=None):\n return self.memory_write(addr, data, zone, 32)",
"def flash_write32(self, addr, data):\n return self.flash_write(addr,... | [
"0.7897174",
"0.7593963",
"0.6945903",
"0.6867116",
"0.68060774",
"0.6795882",
"0.67681146",
"0.6661644",
"0.66553354",
"0.6640903",
"0.65995103",
"0.65927786",
"0.6588998",
"0.6540409",
"0.64840925",
"0.6438452",
"0.6419408",
"0.6414085",
"0.6382138",
"0.6367795",
"0.6358461... | 0.802687 | 0 |
Write a unsigned Int32 Address The address of the device Register The register to write to uInt32 Data to write | def Write_uInt32(self,Address,Register,uInt32):
self.Transaction(chr(Address)+chr(Register)+struct.pack('I',uIt32)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write_Int32(self,Address,Register,Int32):\n self.Transaction(chr(Address)+chr(Register)+struct.pack('i',Int32))",
"def memory_write32(self, addr, data, zone=None):\n return self.memory_write(addr, data, zone, 32)",
"def write_u32(self, addr, data, control):\n if not self._is_u32(addr):... | [
"0.7766806",
"0.7403072",
"0.7294441",
"0.7015551",
"0.691147",
"0.68457687",
"0.67176855",
"0.6678525",
"0.66594285",
"0.6647543",
"0.65600866",
"0.65094566",
"0.6473076",
"0.6463868",
"0.6458747",
"0.6426765",
"0.64085823",
"0.6339451",
"0.63279176",
"0.6283313",
"0.6238975... | 0.81594443 | 0 |
Close the filehandle to this bus | def Close(self):
posix.close(self.File) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _close(self):\n self.fh.close()",
"def close(self):\n self.handle.close()",
"def close(self):\r\n self._fd.close()",
"def close_file_handle(self):\n if self.file_handle and self.output_file:\n self.file_handle.close()",
"def close(self):\n os.close(self.fd)... | [
"0.7445804",
"0.74371564",
"0.7410252",
"0.72857034",
"0.727605",
"0.7249526",
"0.7210702",
"0.7210702",
"0.71414965",
"0.7103806",
"0.709843",
"0.709843",
"0.7092495",
"0.7092495",
"0.7092495",
"0.7082921",
"0.7073966",
"0.7060477",
"0.7052362",
"0.7049571",
"0.70376474",
... | 0.69809353 | 25 |
returns the Serial Number of this board Serial Long | def Serial(self):
ret,buf= self.Bus.Transaction(chr(self.Address+1)+chr(Serial),0x06)
return struct.unpack(">L", buf[2:6])[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_serial_number(self):\n\n\t\treturn struct.unpack('<Q', self.boot_sector_data[72 : 80])[0]",
"def serial_number(self):\n return self._serialno",
"def serial_num(self) -> int:\n return self._serial_num",
"def get_serial_number(self):\n serial = create_string_buffer(64)\n sel... | [
"0.81441593",
"0.7933836",
"0.78950536",
"0.78207827",
"0.76367116",
"0.76166934",
"0.75781405",
"0.7563854",
"0.7560149",
"0.75235504",
"0.7460144",
"0.74524283",
"0.7430194",
"0.7343056",
"0.72238165",
"0.7198541",
"0.715532",
"0.715532",
"0.7087341",
"0.7060499",
"0.706049... | 0.7046791 | 22 |
Show the cursor and/or set it to blink | def Cursor(self,on=True,blink=False):
value = 8+4
if on and blink:
value+=1
elif on and not blink:
value+=2
self.Bus.Write_uInt8(self.Address,0x01,value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blink_cursors(self):\n\n self.cursor_state = not self.cursor_state\n self.update_cursors()",
"def ToggleCursor(self):\n self.displaycontrol ^= self.LCD_CURSORON\n self.write_lcd(self.LCD_DATA_E1, self.LCD_DISPLAYCONTROL | self.displaycontrol)\n self.write_lcd(self.LCD_DATA_... | [
"0.7993861",
"0.7549508",
"0.7379869",
"0.70386684",
"0.6987444",
"0.69067925",
"0.67578983",
"0.6694744",
"0.65565705",
"0.6457728",
"0.6445899",
"0.6379026",
"0.6356474",
"0.6341418",
"0.6306821",
"0.6254512",
"0.6247628",
"0.62136817",
"0.6193067",
"0.6169867",
"0.6162127"... | 0.6763201 | 6 |
Get the current state of this pin. | def Get(self):
value=False
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return self.state",
"def get_state(self):\n return self.state",
"def state(self):\n return self.get_state()",
"def get_state(self):\n return self._state",
"def get_state(self):\n return self._state",
"def get_state(self):\n return self._sta... | [
"0.8106498",
"0.8106498",
"0.80002385",
"0.79767424",
"0.79767424",
"0.79767424",
"0.79767424",
"0.79767424",
"0.78926545",
"0.7879503",
"0.78530645",
"0.78530645",
"0.78530645",
"0.78431505",
"0.783363",
"0.7820778",
"0.77443224",
"0.77443224",
"0.7695198",
"0.7654024",
"0.7... | 0.0 | -1 |
Flatten list of lists. | def flatten_list(l):
return [item for sublist in l for item in sublist] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten(list_of_lists: List[List]) -> List:\n return reduce(iconcat, list_of_lists, [])",
"def flattened(list_of_lists):\n res = functools.reduce(operator.iconcat, list_of_lists, [])\n return res",
"def flatten(listoflists):\r\n return [j for i in listoflists for j in i]",
"def flatten(list... | [
"0.8277591",
"0.82616365",
"0.82516885",
"0.81921995",
"0.81382173",
"0.8118168",
"0.81036675",
"0.81036675",
"0.80791485",
"0.8047256",
"0.80401933",
"0.802821",
"0.8004715",
"0.79775715",
"0.7946494",
"0.79408866",
"0.79357725",
"0.7883838",
"0.78309923",
"0.7822978",
"0.78... | 0.8165552 | 4 |
Global variables for all datasets. | def globals(self):
return {
'tf_types': { # How to store each in tfrecords
'neural_trace_trimmed': 'float',
'proc_stimuli': 'string',
'ROImask': 'string',
'pupil_size': 'float',
'running_speed': 'float',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datasets(self):\n pass",
"def datasets(self):\n return [Dataset.GWAS_CATALOG, Dataset.CLINVAR, Dataset.EFO]",
"def global_variables():\n item_catalog_app.jinja_env.globals[\"ALL_CATEGORIES\"] = act.all_categories()\n __logged_in_user__ = act.user(\n pointer=login_session.get(\"user_i... | [
"0.66456234",
"0.64155716",
"0.6086604",
"0.6080541",
"0.6076861",
"0.6004928",
"0.59806836",
"0.5888649",
"0.5860831",
"0.5860831",
"0.5836086",
"0.5835069",
"0.5830126",
"0.5824196",
"0.57506293",
"0.57166445",
"0.5715169",
"0.57030284",
"0.56757045",
"0.5673825",
"0.565998... | 0.5843807 | 10 |
Determines whether the env is terminated or not. Checks whether 1) the front leg is bent too much 2) the time exceeds the manually set weights or 3) if the minitaur has "fallen" | def _termination(self):
if self._never_terminate:
return False
if self._counter >= self._max_steps:
return True
return self.is_fallen() # terminates automatically when in fallen state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_termination(self):\r\n \r\n # First check if we are doing termination based on running time\r\n if (self.options.time_limit):\r\n self.time = time.clock - self.time_start\r\n if (self.time >= self.options.maxtime):\r\n self.term_reason = 'Exceeded... | [
"0.6076148",
"0.59227043",
"0.5868008",
"0.58303267",
"0.5826887",
"0.5826736",
"0.5824325",
"0.58233535",
"0.57914",
"0.56882244",
"0.56711346",
"0.56290364",
"0.56114876",
"0.5607404",
"0.56020474",
"0.55838466",
"0.55817133",
"0.55491143",
"0.55214965",
"0.55069107",
"0.55... | 0.5918213 | 2 |
Heaviside function is defined as f(x) = | def test_heaviside(self):
self.assertEqual(mlu.heaviside(-1), 0)
self.assertEqual(mlu.heaviside(0), 1)
self.assertEqual(mlu.heaviside(1), 1)
vector_in = np.asarray((-2, -1, 0, 1, 2))
vector_out = np.asarray((0, 0, 1, 1, 1))
np.testing.assert_equal(mlu.heaviside(vector_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heaviside(x, eps=0.001):\n def f(xp):\n return 0.5*(1 + (2/math.pi)*math.atan(math.pi*xp/eps))\n vh = num.vectorize(f)\n return vh(x)",
"def heaviside(x, bias=0):\n indicator = 1 if x >= bias else 0\n return indicator",
"def _hessian(self):\n log_g = np.log(self._gv())\n log_f =... | [
"0.7570816",
"0.7516681",
"0.6851904",
"0.68398684",
"0.678397",
"0.6766889",
"0.6603055",
"0.6539785",
"0.64496213",
"0.6404635",
"0.6350459",
"0.6325054",
"0.6304393",
"0.6208279",
"0.61666775",
"0.61507636",
"0.6141496",
"0.6138659",
"0.61356765",
"0.6114484",
"0.61015815"... | 0.7426182 | 2 |
Computes P(s' | s, \\pi) for a specific state s. Returns a vector of probabilities if `return_probs_vector` is `True` and a list of stateprobability pairs otherwise. | def forward_step(self, state, return_probs_vector=False):
state_id = self.env.get_num_from_state(state)
probs = (
sum(
self.env.T_matrix[state_id * self.env.nA + a, :]
* self.policy[state_id, a]
for a in range(self.env.nA)
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_probs(self, states, actions):\n # YOUR CODE HERE\n \n # So we need to determine for every input state-action pair, what the resulting policy distribution is\n # This means that the input will be a single state and a single action per index. \n # We then need to determine ... | [
"0.60987765",
"0.6054221",
"0.60365963",
"0.60087544",
"0.5896026",
"0.5841013",
"0.5826882",
"0.58019924",
"0.5788409",
"0.57433766",
"0.5736822",
"0.557122",
"0.5533197",
"0.55139434",
"0.5458439",
"0.5425665",
"0.5424908",
"0.5399827",
"0.537517",
"0.53459674",
"0.53398776... | 0.5938135 | 4 |
Computes P(s | s', \\pi) at timestep t for a specific state s. Returns a vector of probabilities if `return_probs_vector` is `True` and a list of stateprobability pairs otherwise. Makes a step from t to t1 and raises an exception if there is no valid transition that could have lead to `state` at timestep `t1`. | def backward_step(self, state, t, return_probs_vector=False):
if t <= 0:
raise ValueError("timestep t must be greater than 0")
state_id = self.env.get_num_from_state(state)
T_inv_t, policy_inv_t = self._get_inverse_dynamics(t - 1)
if self.inverse_policy is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_step(self, state, return_probs_vector=False):\n state_id = self.env.get_num_from_state(state)\n probs = (\n sum(\n self.env.T_matrix[state_id * self.env.nA + a, :]\n * self.policy[state_id, a]\n for a in range(self.env.nA)\n ... | [
"0.6709171",
"0.6317503",
"0.62317556",
"0.6221467",
"0.5993525",
"0.59783036",
"0.59708977",
"0.5943793",
"0.5927305",
"0.5870798",
"0.58020073",
"0.57866013",
"0.5758635",
"0.5730279",
"0.57159114",
"0.5707568",
"0.56384766",
"0.5602324",
"0.55871403",
"0.5536482",
"0.55350... | 0.6265659 | 2 |
Test that creating an edge table succeeds. | def test_create_edge_table(populated_workspace, managed_user, server):
workspace, _, node_table, edge_table = populated_workspace
aql = f"FOR doc in {edge_table} RETURN doc"
new_table_name = "new_table"
with conftest.login(managed_user, server):
resp = server.post(
f"/api/workspace... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_node_table(populated_workspace, managed_user, server):\n workspace, _, node_table, edge_table = populated_workspace\n\n aql = f\"FOR doc in {node_table} RETURN doc\"\n new_table_name = \"new_table\"\n\n with conftest.login(managed_user, server):\n resp = server.post(\n ... | [
"0.71406615",
"0.6742009",
"0.6662753",
"0.66114295",
"0.6584163",
"0.6562892",
"0.64749646",
"0.6457786",
"0.6446716",
"0.63280934",
"0.6242969",
"0.6199534",
"0.61590916",
"0.61175025",
"0.61146593",
"0.6104747",
"0.6094407",
"0.6081413",
"0.60717505",
"0.60520136",
"0.6040... | 0.8062909 | 0 |
Test that creating a non edge/node table results in an error. | def test_unsupported_table(populated_workspace, managed_user, server):
workspace, _, node_table, edge_table = populated_workspace
aql = f"FOR doc in {edge_table} RETURN {{ name: 'something' }}"
new_table_name = "new_table"
with conftest.login(managed_user, server):
resp = server.post(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_unexpected_problem(self):\n pass",
"def test_table_false_positives(self):\n pass",
"def test_attempting_to_create_abstract_table_fails(self):\r\n from cqlengine.management import create_table\r\n with self.assertRaises(CQLEngineException):\r\n create_table... | [
"0.724987",
"0.7189592",
"0.71796453",
"0.70079803",
"0.68420964",
"0.678729",
"0.6786821",
"0.67594784",
"0.66616976",
"0.6653428",
"0.6652638",
"0.6608151",
"0.6580489",
"0.65685093",
"0.65571487",
"0.6527677",
"0.6496195",
"0.64895874",
"0.64840484",
"0.648389",
"0.6480859... | 0.7055366 | 3 |
Pads attention scores to fixed length. This is a hack because raw_rnn requirs a fully defined shape for all outputs. | def _pad_att_scores(self, scores):
# TODO: File a tensorflow bug and get rid of this hack
max_len = self.attention_inputs_max_len
scores = tf.pad(scores, [[0, 0], [0, max_len - tf.shape(scores)[1]]])
scores.set_shape([None, max_len])
return scores | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pad_feature_sequences(sequences, pad=PAD, feature_dims=768):\n lengths = [tf.shape(x)[0] for x in sequences]\n padded_size = tf.reduce_max(lengths)\n padded_sequences = tf.stack([\n tf.pad(x,\n paddings=[[0, padded_size - lengths[i]], [0, 0]],\n mode='CONSTANT',\n c... | [
"0.5921612",
"0.58181566",
"0.5778595",
"0.5759778",
"0.5745317",
"0.5699408",
"0.56947744",
"0.56926167",
"0.56926167",
"0.5650541",
"0.5650541",
"0.5638927",
"0.5627136",
"0.5626704",
"0.56203145",
"0.55972654",
"0.5548791",
"0.55334276",
"0.54725224",
"0.54442996",
"0.5438... | 0.79294074 | 0 |
set default as start of date | def get_today_start():
return datetime.combine(datetime.today(), time.min) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_start_date(self, date):\n pass",
"def init_date( self ) -> datetime:\n return datetime( 2011 ,2 ,1 )",
"def interview_date_default(self, interview_date_default):\n\n self._interview_date_default = interview_date_default",
"def starting_date(self):\n return datetime.date(2... | [
"0.75000775",
"0.7047486",
"0.7029049",
"0.6953524",
"0.69279623",
"0.6873103",
"0.68284357",
"0.67803514",
"0.6710255",
"0.66928655",
"0.6655892",
"0.6644002",
"0.66183037",
"0.6616364",
"0.65842813",
"0.65725195",
"0.65526825",
"0.65526825",
"0.6549142",
"0.6549142",
"0.654... | 0.6014226 | 65 |
Simple month number > Name conversion | def monthName(self, num):
monthNames = {
'1': 'January',
'2': 'February',
'3': 'March',
'4': 'April',
'5': 'May',
'6': 'June',
'7': 'July',
'8': 'August',
'9': 'September',
'10': 'Oct... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def named_month(pMonthNumber):\n return datetime.date(1900, pMonthNumber, 1).strftime('%B')",
"def named_month(month_number):\n return date(1900, month_number, 1).strftime(\"%B\")",
"def get_month_name(month_of_year):\n return VALID_MONTHS[month_of_year - 1].title()",
"def month_name(month_number):\... | [
"0.81404334",
"0.80535823",
"0.7878824",
"0.7876861",
"0.7692885",
"0.7680382",
"0.76396465",
"0.74839294",
"0.7439894",
"0.7430571",
"0.7197458",
"0.71760815",
"0.7175387",
"0.7119662",
"0.70344055",
"0.7000854",
"0.69850427",
"0.6970787",
"0.69658434",
"0.68975216",
"0.6864... | 0.81763744 | 0 |
Initiate EBL photon density model class. | def __init__(self, z, lmu, nuInu, kx = 2, ky = 2, model = ''):
self._z = np.array(z)
self._loglmu= np.log10(lmu)
self._nuInu= np.log10(nuInu)
self.__eblSpline = RBSpline(self._loglmu,self._z,self._nuInu,kx=kx,ky=ky)
self._model = model
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n logger.debug('Initializing %s model.' % self.__class__.__name__)\n self.dependent_attributes = ['_alpha',\n '_log_like',\n '_gradient','_K',\n '_log_det']\n self._p... | [
"0.6806149",
"0.6730243",
"0.6685659",
"0.65119797",
"0.6319659",
"0.6312873",
"0.6229022",
"0.6197962",
"0.6107916",
"0.6064497",
"0.6029681",
"0.60239947",
"0.6014844",
"0.6011441",
"0.60084003",
"0.598554",
"0.5967971",
"0.59607494",
"0.5959647",
"0.5951626",
"0.59434503",... | 0.0 | -1 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
match_labels = None
if dictionary.get('matchLabels') != None:
match_labels = list()
for structure in dictionary.ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.83181584",
"0.8168118",
"0.8168118",
"0.8118749",
"0.8089047",
"0.79787344",
"0.7949278",
"0.79231393",
"0.7898951",
"0.78923255",
"0.788838",
"0.7882321",
"0.7882212",
"0.7876749",
"0.78585315",
"0.7836853",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",... | 0.0 | -1 |
Return a friendly HTTP greeting. | def hello():
return render_template("index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_greeting(name):\n\n greeting = (f\"Hello, {name.title()}. It's nice to meet you!\")\n return greeting",
"def welcome():\n return 'Welcome to Flask!'",
"def greeting_message(name):\n print('My name is ' + name)",
"def Welcome():\n return (\n f\"Welcome to the Surf's Up API!\... | [
"0.67860854",
"0.6719625",
"0.67095745",
"0.6680697",
"0.6663219",
"0.6638394",
"0.6633062",
"0.6628187",
"0.6556032",
"0.6536937",
"0.64776874",
"0.6477268",
"0.64715713",
"0.64644194",
"0.6443056",
"0.6435385",
"0.6400719",
"0.6400167",
"0.637615",
"0.637615",
"0.6367243",
... | 0.0 | -1 |
Return a random nickname. | def nickname():
return jsonify(name=getRandomLine(nickNamesFile)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nick(infraction_id: int, member_id: int) -> str:\n rng = random.Random(str(infraction_id) + str(member_id))\n return rng.choice(STAR_NAMES)",
"def random_username():\n return str(uuid.uuid4().hex.upper())",
"def create_random_username() -> str:\n return str(uuid.uuid4())",
"def generate_u... | [
"0.7731821",
"0.7605116",
"0.71987265",
"0.7109871",
"0.7044811",
"0.70312864",
"0.701071",
"0.69502795",
"0.6930679",
"0.69274116",
"0.6888902",
"0.684871",
"0.68305653",
"0.67882365",
"0.678088",
"0.676321",
"0.67560416",
"0.67244273",
"0.6709511",
"0.6670801",
"0.66545403"... | 0.793278 | 0 |
Sets the evolution converter used to compute the evolution. | def evolution(self, evol) -> None:
self._invalidate()
self._evolution = evol | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_convert(self, connection_conv):\n self.convert = connection_conv",
"def convert(self, converter=None):\n if converter is not None:\n self.converter = converter\n self.code(self.prepare)",
"def converterValue(self, converter):\n pass",
"def converter(self):\r\n ... | [
"0.666601",
"0.63738805",
"0.61876196",
"0.61807424",
"0.61444634",
"0.5900283",
"0.5798855",
"0.57551205",
"0.56930846",
"0.5682907",
"0.5643302",
"0.55675966",
"0.5518216",
"0.5507545",
"0.5483523",
"0.54001415",
"0.5385187",
"0.5335318",
"0.5302228",
"0.52945787",
"0.51791... | 0.46748906 | 46 |
The operators that are evolved in this circuit. | def operators(self):
return self._operators | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operators(self):\n return self.domain.operators.keys()",
"def operartors(self) -> List[Operator]:\n return list(self.__ops.keys())",
"def target_iops(self):\n return self._target_iops",
"def opschrift(self):\n return self._opschrift.get_waarde()",
"def commutative_operators(... | [
"0.72724944",
"0.7149426",
"0.66538227",
"0.64726526",
"0.63937265",
"0.63606274",
"0.6252834",
"0.62380904",
"0.62157017",
"0.61217785",
"0.61166877",
"0.6110983",
"0.6102505",
"0.6101349",
"0.60718983",
"0.60718983",
"0.60451394",
"0.6039561",
"0.60343015",
"0.60126996",
"0... | 0.7647899 | 0 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def haversine(lon1, lat1, lon2, lat2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * asin(sqrt(a))
r = 637... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.81450045",
"0.7863265",
"0.76322985",
"0.76064754",
"0.75978696",
"0.75965863",
"0.75944835",
"0.75720793",
"0.75630087",
"0.7555095",
"0.7528691",
"0.7517629",
"0.7492963",
"0.7467739",
"0.7452678",
"0.7434477",
"0.73914117",
"0.7357736",
"0.73484355",
"0.73318124",
"0.73... | 0.0 | -1 |
Set the data in the given channels to zero. | def applyChannelMask(self, chanmask, outfilename=None, gulp=512,
back_compatible=True, **kwargs):
if outfilename is None:
outfilename = f"{self.header.basename}_masked.fil"
mask = np.array(chanmask).astype("ubyte")
out_file = self.header.prepOutfile(outfilena... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dacs_zero(self):\n # First set all \"parameters\" to zero.\n # this ensures that the safe slow rampdown is used and that the\n # correct values are known to the instrument.\n for ch in self.channel_map:\n self.set(ch, 0)\n\n # \"brute-set\" all sources in known... | [
"0.6664525",
"0.5971566",
"0.59695035",
"0.5924546",
"0.5921477",
"0.5900231",
"0.5882948",
"0.58298093",
"0.58235085",
"0.58070046",
"0.57962054",
"0.57827437",
"0.5740477",
"0.570242",
"0.56733406",
"0.56454927",
"0.55730385",
"0.55720246",
"0.5566449",
"0.55515754",
"0.553... | 0.0 | -1 |
Closes the SQLite3 connection | def close(self):
return self._connection.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db(connection: sqlite3.Connection):\n connection.commit()\n connection.close()",
"def close_db(error):\n conn = g.get('sqlite_db', None)\n if conn is not None:\n conn.close()",
"def close(self):\n self.clean()\n\n for conn in self.conn__.values():\n try:\n ... | [
"0.8186011",
"0.77928865",
"0.76291245",
"0.7602056",
"0.7574998",
"0.75629514",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
"0.7551546",
... | 0.0 | -1 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
pay_period = dictionary.get('payPeriod')
billable = dictionary.get('billable')
asset_id = dictionary.get('assetId')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.83181584",
"0.8168118",
"0.8168118",
"0.8118749",
"0.8089047",
"0.79787344",
"0.7949278",
"0.79231393",
"0.7898951",
"0.78923255",
"0.788838",
"0.7882321",
"0.7882212",
"0.7876749",
"0.78585315",
"0.7836853",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",... | 0.0 | -1 |
takes a json response and an int value as an input and gets the id and title of the recipe which are used to create a recipe object. | def parseIdAndTitle(json_response, value):
value -= 1
recipe_id = json_response[value].get("id")
title = json_response[value].get("title")
chosen_recipe = Recipe(recipe_id, title)
return chosen_recipe | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recipe(index):\n try:\n if request.method == 'GET':\n return Response(\n json.dumps(recipebook.recipes[index].to_json_dict()),\n mimetype=\"application/json\")\n elif request.method == 'DELETE':\n del recipebook.recipes[index]\n ... | [
"0.6462986",
"0.64035267",
"0.62267154",
"0.62179077",
"0.61062384",
"0.610319",
"0.6008811",
"0.5932115",
"0.5921812",
"0.58959126",
"0.5851059",
"0.5830453",
"0.5796052",
"0.5793681",
"0.57863414",
"0.57809633",
"0.57797873",
"0.57645226",
"0.57598555",
"0.5718678",
"0.5712... | 0.86446846 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes, std=False,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Greens):
if normalize:
normalization = cm.sum(axis=1)[:, np.newaxis]
cm = cm.astype('float') / normalization
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194862",
"0.80949175",
"0.8029915",
"0.8019153",
"0.79941195",
"0.7991258",
"0.7980955",
"0.7976606",
"0.79610753",
"0.79590565",
"0.79378676",
"0.7934962",
"0.7934504",
"0.79313844",
"0.7926313",
"0.7924577",
"0.79241234",
"0.7923211",
"0.7923023",
"0.7921931",
"0.791787... | 0.0 | -1 |
Constructs blockdiagonal matrices from a list of batched 2D tensors. | def block_diagonal(matrices, dtype=tf.float32):
matrices = [tf.convert_to_tensor(matrix, dtype=dtype)
for matrix in matrices]
blocked_rows = tf.Dimension(0)
blocked_cols = tf.Dimension(0)
batch_shape = tf.TensorShape(None)
for matrix in matrices:
full_matrix_shape = matrix.ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_diagonal(matrices, dtype=tf.float32):\n matrices = [tf.convert_to_tensor(matrix, dtype=dtype) for matrix in matrices]\n blocked_rows = tf.Dimension(0)\n blocked_cols = tf.Dimension(0)\n batch_shape = tf.TensorShape(None)\n for matrix in matrices:\n full_matrix_shape = matrix.get_sha... | [
"0.6619513",
"0.6613682",
"0.655527",
"0.5562392",
"0.5511607",
"0.5471755",
"0.5449592",
"0.54316026",
"0.54224735",
"0.53800976",
"0.53526396",
"0.53514004",
"0.5349552",
"0.53482145",
"0.53291816",
"0.52584076",
"0.5256403",
"0.52407396",
"0.52090025",
"0.51927626",
"0.518... | 0.6632318 | 0 |
Generate a random string of alphanumerical characters. | def random_string(length):
return ''.join(SystemRandom().choice(ascii_letters + digits)
for i in range(length)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_alphanumeric_string():\n return get_random_string(char_choice=string.ascii_letters + string.digits)",
"def rand_string():\n out = ''\n for _ in range(24):\n out += choice(ascii_letters)\n return out",
"def get_random_alphabetic_string():\n return get_random_string(char_choi... | [
"0.8783218",
"0.84086496",
"0.83163387",
"0.8171725",
"0.8160886",
"0.8122387",
"0.8110304",
"0.8078449",
"0.79643476",
"0.79641324",
"0.7958791",
"0.7952674",
"0.7951925",
"0.7900828",
"0.783053",
"0.7811141",
"0.78060514",
"0.7783679",
"0.7738004",
"0.7730008",
"0.76867896"... | 0.7441662 | 46 |
Remove stop words from list of tokenized words | def remove_stopwords(words):
new_words = []
for word in words:
# print(word)
if word not in stopwords.words('english'):
new_words.append(word)
return new_words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stop_words(stop_list, tokens):\n return [t for t in tokens if len(t) > 2 and not t in stop_list]",
"def remove_stopwords(tokens):\n stop_words = set(stopwords.words('english'))\n\n tokens = [w for w in tokens if w not in stop_words]\n\n return tokens",
"def remove_stop_words(tokenized_wo... | [
"0.86630034",
"0.86183923",
"0.85973936",
"0.8596811",
"0.8580546",
"0.8363658",
"0.8350171",
"0.8328014",
"0.8318595",
"0.8263289",
"0.82468146",
"0.820217",
"0.81783086",
"0.81630206",
"0.8158307",
"0.8138284",
"0.81271654",
"0.8113883",
"0.8099041",
"0.8048383",
"0.8027641... | 0.79606515 | 30 |
Lemmatize verbs in list of tokenized words | def lemmatize_verbs(words):
lemmatizer = WordNetLemmatizer()
lemmas = []
for word in words:
lemma = lemmatizer.lemmatize(word, pos='v')
lemmas.append(lemma)
return lemmas | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lemmatization(tokenized_word_list):\n porter=nltk.stem.PorterStemmer()\n filtered_tokens = [porter.stem(word) for word in tokenized_word_list]\n return filtered_tokens",
"def lemmatize_verbs(self):\n lemmas = []\n # lemmas = \"\"\n for word in self.words:\n lemma = wn.lemmatize(word, p... | [
"0.8030228",
"0.79704237",
"0.7929821",
"0.78893256",
"0.78252596",
"0.7756634",
"0.77332175",
"0.77103",
"0.7703726",
"0.7699928",
"0.76371783",
"0.7631672",
"0.75700194",
"0.7544735",
"0.7536392",
"0.75226045",
"0.7492601",
"0.7471889",
"0.74653155",
"0.7435697",
"0.7369444... | 0.7741538 | 8 |
Return the number of levels in the expression tree. | def depth(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nlevels(self) -> int:\n return len(self._levels)",
"def Nlevels(self):\n return self._nlevels",
"def n_levels(self):\n return self.primary_header['Number of levels']",
"def get_num_levels(self):\n return len(self._Psi)",
"def expression_depth(expr):\n \n return depth_h... | [
"0.7758086",
"0.77128774",
"0.74730057",
"0.74253535",
"0.7204459",
"0.7023346",
"0.70019656",
"0.69284856",
"0.68512124",
"0.68505543",
"0.6809938",
"0.6804044",
"0.67352176",
"0.67022157",
"0.66273373",
"0.6563495",
"0.6560661",
"0.6558952",
"0.65195847",
"0.6481258",
"0.64... | 0.0 | -1 |
Return whether this expression is in disjunctive normal form. | def is_dnf(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_nf(self):\n return (\n self.depth <= 2 and\n all(isinstance(arg, Literal) or isinstance(arg, self.DUAL)\n for arg in self._args)\n )",
"def is_normal_form(self):\n return all(\n production.is_normal_form() for production in self._product... | [
"0.63540214",
"0.6168131",
"0.61323255",
"0.58655226",
"0.5686432",
"0.54941297",
"0.5454944",
"0.54240996",
"0.54229563",
"0.5420374",
"0.5351045",
"0.53348505",
"0.53325415",
"0.5269123",
"0.52501345",
"0.5242808",
"0.523502",
"0.5206791",
"0.51913923",
"0.51809907",
"0.512... | 0.48992416 | 47 |
Return the maxterm indices. | def max_indices(self):
return {term.maxterm_index for term in self.iter_maxterms()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxterms(self):\n return {term for term in self.iter_maxterms()}",
"def find_max_row_idx(self) -> int:\n return np.argmax([r.free_spots for r in self.rows])",
"def calcMaxIDX(fls, noct):\n freq_l = fls[-1] / (2.0 ** (1 / (2.0 * noct)))\n max_idx = np.array(abs(fls - freq_l)).argmin()\n ... | [
"0.7510647",
"0.6439072",
"0.6402897",
"0.6388593",
"0.6372091",
"0.6313786",
"0.6313786",
"0.6313786",
"0.6246103",
"0.61829925",
"0.6137347",
"0.60862005",
"0.60851663",
"0.60530096",
"0.60490596",
"0.6045112",
"0.6043904",
"0.6017721",
"0.5998949",
"0.5979813",
"0.59256333... | 0.87908155 | 0 |
Return whether this expression is in disjunctive normal form. | def is_dnf(self):
return self.is_nf() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_nf(self):\n return (\n self.depth <= 2 and\n all(isinstance(arg, Literal) or isinstance(arg, self.DUAL)\n for arg in self._args)\n )",
"def is_normal_form(self):\n return all(\n production.is_normal_form() for production in self._product... | [
"0.63540214",
"0.6168131",
"0.61323255",
"0.58655226",
"0.5686432",
"0.54941297",
"0.54240996",
"0.54229563",
"0.5420374",
"0.5351045",
"0.53348505",
"0.53325415",
"0.5269123",
"0.52501345",
"0.5242808",
"0.523502",
"0.5206791",
"0.51913923",
"0.51809907",
"0.5128575",
"0.511... | 0.5454944 | 6 |
Return an array with the minimum price data | def minimum(self):
return self.cleaning('Mínimo') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stock_min(stock):\n min_price=1000000\n for i in stock['Close']:\n if i < min_price:\n min_price=i\n return min_price",
"def Min(data):\n return data.min()",
"def get_minimum():\n return [\n convert_variables([0.78547, 0.78547, 0.78547]),\n ]",
"def ... | [
"0.7042131",
"0.6940381",
"0.68871355",
"0.64727473",
"0.64686173",
"0.633713",
"0.62529695",
"0.6242365",
"0.62190795",
"0.6217313",
"0.62162054",
"0.6205306",
"0.6194865",
"0.6167775",
"0.6145838",
"0.6104108",
"0.60649186",
"0.6064523",
"0.60616034",
"0.6037852",
"0.602595... | 0.0 | -1 |
return Data Frame or an array data | def date(self, kind='DataFrame'):
"""
:param kind:
:return:
"""
if kind.lowe() == 'dataframe':
return self.df['Fecha']
elif kind.lower() == 'array':
return np.array(self.df['Fecha'])
else:
print('kind must be equal to: "DataFr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(self)->pd.DataFrame:\n pass",
"def data_frame(self, arg=None):\n if arg is None:\n return pl.DataFrame()\n if isinstance(arg, pl.DataFrame):\n return arg\n if isinstance(arg, pl.LazyFrame):\n return arg.collect()\n return pl.DataFra... | [
"0.7250164",
"0.7066147",
"0.67737645",
"0.6654278",
"0.6526929",
"0.6520449",
"0.6484593",
"0.64468455",
"0.6411995",
"0.6395425",
"0.6326827",
"0.6320346",
"0.6293561",
"0.6284922",
"0.6235683",
"0.6209105",
"0.61970127",
"0.61527413",
"0.61254823",
"0.6113022",
"0.6079973"... | 0.5932498 | 34 |
Convert a minibatch of images from uint8 to float32 with configurable dynamic range. Can be used as an input transformation for Network.run(). | def convert_images_from_uint8(images, drange=[-1,1], nhwc_to_nchw=False):
if nhwc_to_nchw:
imgs_roll=np.rollaxis(images, 3, 1)
return imgs_roll/ 255 *(drange[1] - drange[0])+ drange[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __resize_to_32x(input_data):\n rate = 1\n while min(input_data['img'].shape[:2])>736:\n test_size = 736\n if input_data['img'].shape[0] > input_data['img'].shape[1]:\n if True: # input_data['img'].shape[1] < 512:\n rate = test_size / input_... | [
"0.6355272",
"0.62103593",
"0.6209441",
"0.59978896",
"0.59885925",
"0.5987573",
"0.5966948",
"0.59485495",
"0.5946522",
"0.59114385",
"0.5906307",
"0.59051603",
"0.5900019",
"0.5897256",
"0.5861134",
"0.5861134",
"0.5829561",
"0.5810791",
"0.5803264",
"0.5803264",
"0.5793219... | 0.61759233 | 3 |
Constructs a version of 'fn' that applies to smaller batches. | def batchify(fn, chunk):
if chunk is None:
return fn
def ret(inputs, styles, alpha, feature):
results = []
for i in range(0, inputs.shape[0], chunk):
input_chunk = inputs[i:i + chunk]
style_chunk = styles[i:i + chunk]
alpha_chunk = alpha[i:i + chunk] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minibatched_call(fn, mbsize, *args, **kwargs):\n tensor_list, _ = tree_util.tree_flatten((args, kwargs))\n batchsize = tensor_list[0].shape[0]\n mbs = [\n fn(*tree_slice(args, inds), **tree_slice(kwargs, inds))\n for inds in th.arange(batchsize).split(mbsize)\n ]\n return tree_cat(... | [
"0.68100464",
"0.64958173",
"0.61957973",
"0.607114",
"0.5799871",
"0.5749444",
"0.57317525",
"0.57095826",
"0.5580774",
"0.557718",
"0.55540234",
"0.5553517",
"0.55492264",
"0.5467045",
"0.5456915",
"0.5452786",
"0.54423714",
"0.5421315",
"0.5418292",
"0.5408055",
"0.5398568... | 0.68411267 | 0 |
Get default embedding configuration. | def get_default_embedding_config():
return EmbeddingConfig() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_config() -> Dict[Text, Any]:\n # please make sure to update the docs when changing a default parameter\n return {\n # ## Architecture of the used neural network\n # Hidden layer sizes for layers before the embedding layers for user message\n # and labe... | [
"0.7179934",
"0.66281974",
"0.6496941",
"0.64729774",
"0.64209044",
"0.63767695",
"0.6296511",
"0.6274945",
"0.62699425",
"0.6251885",
"0.6230376",
"0.6224931",
"0.6210615",
"0.61945677",
"0.6151559",
"0.6142973",
"0.6136437",
"0.61231786",
"0.61219054",
"0.61194086",
"0.6024... | 0.92465454 | 0 |
Returns whether or not this function's is zero. | def isZero(self):
return (self.p.isZero() & (self.q.isZero() == False)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero(self):\n return float(self.coeff.nominator) / self.coeff.denominator == 0.0",
"def _iszero(x):\n return getattr(x, 'is_zero', None)",
"def is_zero(self):\n return self._express.is_zero()",
"def is_zero(self) -> bool:\n return self.field.zero == self",
"def is_zero(self):... | [
"0.7959498",
"0.7948897",
"0.7917833",
"0.78993416",
"0.78755593",
"0.7787352",
"0.7749111",
"0.77026546",
"0.7701648",
"0.7634745",
"0.76274806",
"0.7608437",
"0.7552009",
"0.7447371",
"0.74133384",
"0.73432654",
"0.73386484",
"0.7303627",
"0.7295245",
"0.7283645",
"0.727493... | 0.80330807 | 0 |
Get a collection with current mtgjson data. | def build_collection(data_path, include_online_only):
mtgjson.fetch_mtgjson(data_path)
print('Reading mtgjson data.')
mtgjsondata = mtgjson.read_mtgjson(data_path)
return collection.Collection(
mtgjsondata, include_online_only=include_online_only) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_collection(self) -> Any:\n return self.anki.Collection(self.db_location, log=True)",
"def collection(self):\n return self._collection",
"def collection(collection_id):\n\tcollection = models.Collection.query.get(collection_id)\n\tif not collection:\n\t\tabort(404)\n\treturn jsonify(colle... | [
"0.692255",
"0.6764781",
"0.6633865",
"0.66204077",
"0.65857047",
"0.6519674",
"0.6511806",
"0.6480024",
"0.6476107",
"0.6459133",
"0.6335465",
"0.62615633",
"0.6203542",
"0.61701983",
"0.6163128",
"0.6147961",
"0.6126997",
"0.6118164",
"0.60916036",
"0.6081088",
"0.6070931",... | 0.7596141 | 0 |
Determine whether or not Daylight Savings Time (DST) | def is_dst ():
x = datetime(datetime.now().year, 1, 1, 0, 0, 0, tzinfo=pytz.timezone(timezonename)) # Jan 1 of this year
y = datetime.now(pytz.timezone(timezonename))
# if DST is in effect, their offsets will be different
return not (y.utcoffset() == x.utcoffset()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_dst(now):\n dst_start_date = datetime.datetime(now.year, 4, 1)\n dst_end_date = datetime.datetime(now.year, 11, 1)\n dston = dst_start_date - datetime.timedelta(days=dst_start_date.weekday() + 1)\n dstoff = dst_end_date - datetime.timedelta(days=dst_end_date.weekday() + 1)\n\n if dston <= now... | [
"0.6935293",
"0.6616067",
"0.6516993",
"0.6215939",
"0.61475027",
"0.6123925",
"0.57812285",
"0.5767174",
"0.57259715",
"0.57187515",
"0.56875944",
"0.5667125",
"0.56590027",
"0.5591161",
"0.55905336",
"0.55732495",
"0.55648273",
"0.5506323",
"0.54255176",
"0.5410302",
"0.539... | 0.754301 | 0 |
Combine conditions of multi nets into a single condition nets. Unlike MergeConditionNets, the actual body of condition_nets is not copied into the combine condition net. One example is about multi readers. Each reader net has a reader_done condition. When we want to check whether all readers are done, we can use this f... | def CombineConditions(name, condition_nets, relation):
if not condition_nets:
return None
if not isinstance(condition_nets, list):
raise ValueError('condition_nets must be a list of nets.')
if len(condition_nets) == 1:
condition_blob = GetConditionBlobFromNet(condition_nets[0])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MergeConditionNets(name, condition_nets, relation):\n if not isinstance(condition_nets, list):\n return condition_nets\n if len(condition_nets) <= 1:\n return condition_nets[0] if condition_nets else None\n\n merged_net = core.Net(name)\n for i in range(len(condition_nets)):\n ... | [
"0.7624063",
"0.55943316",
"0.54562604",
"0.5378349",
"0.5304795",
"0.53004134",
"0.5258702",
"0.51748735",
"0.5158123",
"0.51136285",
"0.4949369",
"0.49080285",
"0.4888869",
"0.48692665",
"0.48304552",
"0.480443",
"0.47744024",
"0.47574097",
"0.4734627",
"0.4730543",
"0.4715... | 0.77654374 | 0 |
Create a pendulum manager using the pendulum. | def __init__(self, pendulum, name="Pendulum", dt=0.01):
super().__init__(name=name)
self.pendulum = pendulum
self.dt = dt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_pendulum_example(duration=1.0, playback=True, show=True):\n\n builder = DiagramBuilder()\n plant, scene_graph = AddMultibodyPlantSceneGraph(builder, 0.0)\n parser = Parser(plant)\n parser.AddModelFromFile(FindResourceOrThrow(\n \"drake/examples/pendulum/Pendulum.urdf\")\n )\n plant... | [
"0.5572172",
"0.5564887",
"0.5278047",
"0.52359414",
"0.52278715",
"0.5187613",
"0.5168771",
"0.5145004",
"0.5140956",
"0.51336116",
"0.5036661",
"0.5008107",
"0.49763557",
"0.49757063",
"0.49223414",
"0.49202704",
"0.488684",
"0.48858172",
"0.4875343",
"0.48744062",
"0.48677... | 0.6602725 | 0 |
Returns the optimizer corresponding to the task model | def get_task_optimizer(self) -> torch.optim.Optimizer:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_optimizer(self):\n raise NotImplementedError",
"def get_optimizer(model):\n optimizer = optim.Adam(model.parameters(), lr=0.001, betas=(0.5, 0.999))\n return optimizer",
"def optimizer(self):\n return self._optimizer",
"def get_optimizer(args, model: torch.nn.Module):\n return... | [
"0.76700234",
"0.7577644",
"0.73444307",
"0.7105193",
"0.7072981",
"0.7061312",
"0.69659466",
"0.693067",
"0.6903654",
"0.68924415",
"0.67964715",
"0.6715774",
"0.66913575",
"0.66694355",
"0.66452295",
"0.6603657",
"0.6600693",
"0.658666",
"0.65843916",
"0.6572727",
"0.656210... | 0.8302514 | 0 |
Get the script type of a Process. | def get_script_type(self, instance):
return (
"FA"
if instance.script == instance.project.pipeline.fa_script
else "G2P"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_type(process_dict):\n if 'class' not in process_dict:\n exit_perm_fail(\"No class attribute in process\")\n if process_dict['class'] not in ['Workflow', 'CommandLineTool']:\n exit_perm_fail('Invalid class {} in process'.format(process_dict['class']))\n return process_dict['class'... | [
"0.7310262",
"0.6894707",
"0.6026639",
"0.6019192",
"0.5985235",
"0.5971364",
"0.59486324",
"0.5832096",
"0.5825621",
"0.5820312",
"0.56788653",
"0.5675672",
"0.56579584",
"0.5630491",
"0.5630491",
"0.5630491",
"0.5630491",
"0.5630491",
"0.5630491",
"0.5630491",
"0.5630491",
... | 0.65153635 | 2 |
Get the status string of a Process. | def get_status_string(self, instance):
return instance.get_status_string() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pr_status(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"pr_status\")",
"def status(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"status\")",
"def status(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"status\")",
"def status(self) -> pulumi.Output[str]:... | [
"0.71455675",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6862706",
"0.6751803",
... | 0.65457654 | 25 |
Get the value of the ParameterSetting belonging to the Parameter. | def get_value(self, instance):
try:
return ParameterSetting.objects.get(
base_parameter=instance,
project=self.context.get("view").kwargs.get("project"),
).raw_value
except ParameterSetting.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parameter_value(self, parameter_name):\n if parameter_name in self.description[\"config\"][\"values\"].keys():\n return self.description[\"config\"][\"values\"][parameter_name][\"value\"]\n else:\n return \"No such parameter\"",
"def get_setting_value(self, title, sett... | [
"0.75089955",
"0.72683305",
"0.719738",
"0.7082149",
"0.6969672",
"0.66878647",
"0.66652334",
"0.66424656",
"0.6629938",
"0.6611464",
"0.65800935",
"0.65537184",
"0.654167",
"0.64994437",
"0.6398343",
"0.635788",
"0.6313034",
"0.6302036",
"0.6298701",
"0.62826157",
"0.6194984... | 0.7832906 | 0 |
Get the type of a Parameter. | def get_type(self, instance):
if instance.type == BaseParameter.BOOLEAN_TYPE:
return "Boolean"
elif instance.type == BaseParameter.STATIC_TYPE:
return "Static"
elif instance.type == BaseParameter.STRING_TYPE:
return "String"
elif instance.type == BaseP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datatype(parameter):\n return type(parameter)",
"def get_parameter_type(self, name):\n raise NotImplementedError()",
"def get_parameter_type(self, name):\n phil_scope = phil.parse(\n \"\"\"include scope dials.command_line.scale.phil_scope\"\"\",\n process_includes=Tru... | [
"0.7857371",
"0.76349926",
"0.7578121",
"0.6985135",
"0.69841665",
"0.69405156",
"0.690184",
"0.6629156",
"0.6613052",
"0.64169127",
"0.64036614",
"0.6280436",
"0.6215339",
"0.6133637",
"0.60631216",
"0.6052896",
"0.60367334",
"0.6024503",
"0.60084426",
"0.60046446",
"0.60046... | 0.64620465 | 9 |
Render the homepage template on the / route | def homepage():
return render_template('home/index.html', title="Home") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n return render_template(\"home/index.html\")",
"def home():\n return render_template('homepage.html')",
"def homepage():\n return render_template('homepage.html')",
"def homepage():\n return render_template(\"home/index.html\", title=\"Welcome\")",
"def render_home():\r\n\treturn... | [
"0.8596693",
"0.8568932",
"0.8526821",
"0.8473926",
"0.8473321",
"0.84519774",
"0.84239286",
"0.84239286",
"0.8387553",
"0.8311804",
"0.82661605",
"0.82661605",
"0.82661605",
"0.82661605",
"0.82661605",
"0.82661605",
"0.8263859",
"0.8259376",
"0.82504493",
"0.82504493",
"0.82... | 0.8420498 | 8 |
Calculate the maximum number of tokens possible to generate for a model. | def modelname_to_contextsize(self, modelname: str) -> int:
if modelname == "text-davinci-003":
return 4097
elif modelname == "text-curie-001":
return 2048
elif modelname == "text-babbage-001":
return 2048
elif modelname == "text-ada-001":
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_tokens_for_prompt(self, prompt: str) -> int:\n num_tokens = self.get_num_tokens(prompt)\n\n # get max context size for model by name\n max_size = self.modelname_to_contextsize(self.model_name)\n return max_size - num_tokens",
"def num_tokens(self, index):\n return max(s... | [
"0.7710128",
"0.6487071",
"0.64776677",
"0.64752084",
"0.6397246",
"0.6377367",
"0.6341963",
"0.62035483",
"0.61707234",
"0.61568385",
"0.61433417",
"0.6134858",
"0.61269504",
"0.60923815",
"0.604848",
"0.6003006",
"0.5985438",
"0.5957933",
"0.5934543",
"0.59207404",
"0.59075... | 0.5405074 | 82 |
Calculate the maximum number of tokens possible to generate for a prompt. | def max_tokens_for_prompt(self, prompt: str) -> int:
num_tokens = self.get_num_tokens(prompt)
# get max context size for model by name
max_size = self.modelname_to_contextsize(self.model_name)
return max_size - num_tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ensure_token_limit(self, prompt: Union[str, List[Dict[str, str]]]) -> Union[str, List[Dict[str, str]]]:\n return self.model_invocation_layer._ensure_token_limit(prompt=prompt)",
"def token_length(self):\n return 32",
"def length(self):\n return len(self.tokens)",
"def num_tokens(self, i... | [
"0.6558024",
"0.6252478",
"0.6161205",
"0.6102598",
"0.5933351",
"0.593217",
"0.5908406",
"0.58827394",
"0.58744806",
"0.5792451",
"0.57583874",
"0.5740858",
"0.57305473",
"0.568128",
"0.568128",
"0.5602474",
"0.5593359",
"0.556781",
"0.55656433",
"0.55546653",
"0.5554541",
... | 0.83333635 | 0 |
translate x by subtracting its mean (so the result has mean 0) | def de_mean(x):
x_bar = mean(x)
return [x_i - x_bar for x_i in x] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def de_mean(x):\n x_bar = mean(x)\n return [ x_i - x_bar for x_i in x]",
"def normalize(x):\n MEAN_VALUES = np.array([104, 117, 123])\n means = theano.shared(MEAN_VALUES.astype(\"float32\"))\n return x[:, ::-1, :, :] - means[np.newaxis, :, np.newaxis, np.newaxis]",
"def normalize(self, X):\n ... | [
"0.7772704",
"0.7279913",
"0.72375005",
"0.7177458",
"0.6941483",
"0.6937111",
"0.67930126",
"0.67930126",
"0.67337644",
"0.6732362",
"0.6711969",
"0.67096215",
"0.6683993",
"0.6597472",
"0.6592291",
"0.6550586",
"0.65502095",
"0.6534051",
"0.65015817",
"0.649354",
"0.6475552... | 0.77328527 | 3 |
pseudorandomly returns true on 25% of dates | def state_should_change(date, salt):
salted_date_string = (date.strftime('%Y-%m-%d') + salt).encode('utf-8')
salted_date_hex = hashlib.md5(salted_date_string).hexdigest()
return int(salted_date_hex[-1], 16) % 4 == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_date(start: datetime = datetime(2015, 1, 1), end: datetime = datetime(2020, 1, 1)\r\n ) -> datetime:\r\n delta = end - start\r\n return start + timedelta(days=random.randint(0, delta.days + 1))",
"def test_generate_random_dates():\n random_start_date, random_end_d... | [
"0.6428512",
"0.6334742",
"0.63057375",
"0.62703127",
"0.6248453",
"0.620783",
"0.60915285",
"0.6058875",
"0.60532635",
"0.6044358",
"0.6013509",
"0.60132474",
"0.5995169",
"0.5995169",
"0.599205",
"0.599205",
"0.599205",
"0.599205",
"0.599205",
"0.5980523",
"0.5958317",
"0... | 0.57031435 | 43 |
As for the pure bf16 training, if users set `use_bf16_guard` to True, only those ops created in the context manager `bf16_guard` will be transformed as float16 type. | def bf16_guard():
with framework.name_scope(prefix=_bf16_guard_pattern):
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast_model_to_bf16(\n program, startup_prog=None, amp_lists=None, use_bf16_guard=True\n):\n\n if amp_lists is None:\n amp_lists = AutoMixedPrecisionListsBF16()\n global_block = program.global_block()\n keep_fp32_ops = set()\n to_bf16_var_names = set()\n to_bf16_pre_cast_ops = set()\n ... | [
"0.69334507",
"0.6916362",
"0.6891244",
"0.68489355",
"0.68107957",
"0.6723085",
"0.6648476",
"0.66472733",
"0.64323175",
"0.62423635",
"0.62134993",
"0.61664546",
"0.6085439",
"0.59530544",
"0.5925317",
"0.59003675",
"0.5865266",
"0.5853169",
"0.5784056",
"0.5740745",
"0.572... | 0.54310966 | 46 |
Tests the get_user_info function when the admin field is True. | def test_get_user_info_admin(self):
cookie_value = self.get_cookie_value(EMAIL, NICKNAME, True)
http_cookie = 'one=two; %s=%s; three=four' % (COOKIE_NAME, cookie_value)
email, admin, _ = login.get_user_info(http_cookie,
cookie_name=COOKIE_NAME)
self.assertEqua... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_admin_user(self):\n admin = User.objects.get(email='testadminuser@test.com')\n self.assertEqual(admin.is_staff, True)",
"def test_get_user_info_not_admin(self):\n cookie_value = self.get_cookie_value(EMAIL, NICKNAME, False)\n\n http_cookie = 'one=two; %s=%s; three=four' % (COOKIE_... | [
"0.7072122",
"0.6841851",
"0.6809871",
"0.67893255",
"0.6786528",
"0.670962",
"0.6709356",
"0.66757923",
"0.66489637",
"0.6550116",
"0.6550116",
"0.6543555",
"0.6538715",
"0.653235",
"0.6511328",
"0.6461367",
"0.6455847",
"0.6444189",
"0.6428759",
"0.63951445",
"0.63951445",
... | 0.68284166 | 2 |
Tests the get_user_info function when the admin field is False. | def test_get_user_info_not_admin(self):
cookie_value = self.get_cookie_value(EMAIL, NICKNAME, False)
http_cookie = 'one=two; %s=%s; three=four' % (COOKIE_NAME, cookie_value)
email, admin, user_id = login.get_user_info(http_cookie,
cookie_name=COOKIE_NAME)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validateUser(self,admin):\n \n res=admin.helper.getOneUser(self.name)\n if res == False:\n return True\n else:\n return False",
"def test_is_admin_user(self):\n admin = User.objects.get(email='testadminuser@test.com')\n self.assertEqual(admin.is_sta... | [
"0.6896076",
"0.6887528",
"0.6798139",
"0.67940813",
"0.6712394",
"0.6679977",
"0.6638127",
"0.6596083",
"0.6589716",
"0.658818",
"0.6582883",
"0.6567789",
"0.65620404",
"0.6507496",
"0.6487471",
"0.6432266",
"0.6428761",
"0.6415647",
"0.6392807",
"0.6362695",
"0.6350299",
... | 0.70198023 | 0 |
Tests the get_user_info function when the admin field is False. | def test_get_user_info_invalid_email(self):
cookie_value = self.get_cookie_value('foo', NICKNAME, False)
cookie_value = 'foo:True:%s' % USER_ID
http_cookie = 'one=two; %s=%s; three=four' % (COOKIE_NAME, cookie_value)
email, admin, user_id = login.get_user_info(http_cookie,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_user_info_not_admin(self):\n cookie_value = self.get_cookie_value(EMAIL, NICKNAME, False)\n\n http_cookie = 'one=two; %s=%s; three=four' % (COOKIE_NAME, cookie_value)\n email, admin, user_id = login.get_user_info(http_cookie,\n cookie_name=COOKIE... | [
"0.7020773",
"0.6896199",
"0.688936",
"0.6798195",
"0.6794977",
"0.67136943",
"0.6680014",
"0.66396827",
"0.6595958",
"0.6589698",
"0.65885013",
"0.658424",
"0.6569092",
"0.656173",
"0.65078896",
"0.6486914",
"0.6430686",
"0.64288545",
"0.6415596",
"0.63926387",
"0.6363666",
... | 0.0 | -1 |
Tests the get_user_info function when the admin field is True. | def test_get_user_info_from_dict_admin(self):
cookie_value = self.get_cookie_value(EMAIL, NICKNAME, True)
cookie_dict = {'one': 'two', COOKIE_NAME: cookie_value, 'three': 'four'}
email, admin, user_id = login._get_user_info_from_dict(
cookie_dict, cookie_name=COOKIE_NAME)
self.assertEqual(EMAI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_admin_user(self):\n admin = User.objects.get(email='testadminuser@test.com')\n self.assertEqual(admin.is_staff, True)",
"def test_get_user_info_not_admin(self):\n cookie_value = self.get_cookie_value(EMAIL, NICKNAME, False)\n\n http_cookie = 'one=two; %s=%s; three=four' % (COOKIE_... | [
"0.7072517",
"0.6840295",
"0.6826869",
"0.6810083",
"0.67894435",
"0.67869925",
"0.67115444",
"0.6709156",
"0.66786385",
"0.6648706",
"0.65503246",
"0.65503246",
"0.65441597",
"0.6539757",
"0.6534254",
"0.6512153",
"0.64621776",
"0.64562863",
"0.64463603",
"0.64302117",
"0.63... | 0.6119589 | 48 |
Tests the get_user_info function when the admin field is False. | def test_get_user_info_from_dict_not_admin(self):
cookie_value = self.get_cookie_value(EMAIL, NICKNAME, False)
cookie_dict = {'one': 'two', COOKIE_NAME: cookie_value, 'three': 'four'}
email, admin, user_id = login._get_user_info_from_dict(
cookie_dict, cookie_name=COOKIE_NAME)
self.assertEqual... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_user_info_not_admin(self):\n cookie_value = self.get_cookie_value(EMAIL, NICKNAME, False)\n\n http_cookie = 'one=two; %s=%s; three=four' % (COOKIE_NAME, cookie_value)\n email, admin, user_id = login.get_user_info(http_cookie,\n cookie_name=COOKIE... | [
"0.7020773",
"0.6896199",
"0.688936",
"0.6798195",
"0.6794977",
"0.67136943",
"0.6680014",
"0.66396827",
"0.6595958",
"0.6589698",
"0.65885013",
"0.658424",
"0.6569092",
"0.656173",
"0.65078896",
"0.6486914",
"0.6430686",
"0.64288545",
"0.6415596",
"0.63926387",
"0.6363666",
... | 0.6144884 | 45 |
Returns boolean value indicating whether worker is qualified or not. | def check_worker_qualified(conn, workerId):
query = "SELECT qualified FROM workers WHERE worker_id = '{}'".format(workerId)
result = conn.execute(query).fetchall()
return (len(result) != 0) and bool(result[0][0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_worker_thread():\n try:\n return worker_thread_data.is_worker_thread\n except AttributeError:\n return False",
"def _is_working():\n global _worker\n return _worker is not None and _worker.is_alive()",
"def _in_multi_worker_mode(self):\n return False",
"def enabled(self) -... | [
"0.681578",
"0.68015456",
"0.6114835",
"0.6076708",
"0.6049261",
"0.60308766",
"0.60308766",
"0.60308766",
"0.5960439",
"0.58858544",
"0.58520836",
"0.5835419",
"0.5825732",
"0.5807578",
"0.5696778",
"0.5655905",
"0.5597184",
"0.5589834",
"0.55825716",
"0.55738634",
"0.553469... | 0.78638095 | 0 |
Initialize 'ref' with all zeros, ref tensor should be uninitialized. If already initialized, you will get ValueError. This op is intended to save memory during initialization. | def zero_initializer(ref, use_locking=True, name="zero_initializer"):
loader.load_op_library(
resource_loader.get_path_to_datafile("_variable_ops.so"))
return gen_variable_ops.zero_initializer(ref, name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DefaultValue(self):\n return tf.zeros(self.shape, dtype=self.dtype)",
"def DefaultValue(self):\n return tf.zeros(self.shape, dtype=self.dtype)",
"def resetDataRef(self, is_train):\n self.data_ref = 0",
"def test_set_mat_to_zero(self):\n self.init()\n set_to_zero_by_ref(self.ff6... | [
"0.59268457",
"0.59268457",
"0.5816813",
"0.565309",
"0.5617504",
"0.55825675",
"0.55707854",
"0.5561487",
"0.5524925",
"0.54330224",
"0.54095167",
"0.5403954",
"0.54024076",
"0.5357347",
"0.53501093",
"0.53265244",
"0.52999145",
"0.5279869",
"0.5273931",
"0.5263101",
"0.5246... | 0.6309964 | 0 |
Create a variable with a value and add it to `GraphKeys.LOCAL_VARIABLES`. | def local_variable(initial_value,
validate_shape=True,
name=None,
use_resource=None):
return variable_scope.variable(
initial_value, trainable=False,
collections=[ops.GraphKeys.LOCAL_VARIABLES],
validate_shape=validate_shape,
use_resourc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_embedding_variable(self, name, initial_value):\n if name not in self._tls._embed_variables:\n embed_var = tf.Variable(\n initial_value,\n name=name + str(threading.get_ident()),\n shape=(None, None),\n dtype=tf.float32,\n ... | [
"0.6494083",
"0.6411489",
"0.64073545",
"0.63730663",
"0.6278127",
"0.62588215",
"0.6255319",
"0.62234885",
"0.6126168",
"0.6126168",
"0.6119956",
"0.61105245",
"0.60072553",
"0.5958282",
"0.5918667",
"0.5897518",
"0.5867681",
"0.57880676",
"0.57880676",
"0.5781109",
"0.57636... | 0.66381794 | 0 |
Adds a variable to the `GraphKeys.MODEL_VARIABLES` collection. | def add_model_variable(var):
if var not in ops.get_collection(ops.GraphKeys.MODEL_VARIABLES):
ops.add_to_collection(ops.GraphKeys.MODEL_VARIABLES, var) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_variable(self, name, var):\n self.variables.append(_3ds_named_variable(name, var))",
"def add_variable(self, name, var):\n self.variables.append(_3ds_named_variable(name, var))",
"def add_variable(self, variable):\n self.variables.append(variable)",
"def add_variable(self, var):\... | [
"0.6889913",
"0.6889913",
"0.67037183",
"0.67030597",
"0.667306",
"0.66068846",
"0.64225525",
"0.6380908",
"0.6310279",
"0.6283835",
"0.62624043",
"0.6235285",
"0.6161782",
"0.60932153",
"0.6046209",
"0.59172356",
"0.58616495",
"0.58549076",
"0.58199143",
"0.5705129",
"0.5675... | 0.83408505 | 0 |
Gets the list of variables, filtered by scope and/or suffix. | def get_variables(scope=None, suffix=None,
collection=ops.GraphKeys.GLOBAL_VARIABLES):
if isinstance(scope, variable_scope.VariableScope):
scope = scope.name
if suffix is not None:
if ':' not in suffix:
suffix += ':'
scope = (scope or '') + '.*' + suffix
return ops.get_collecti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_variables_by_suffix(suffix, scope=None):\n return get_variables(scope=scope, suffix=suffix)",
"def vars(self, scope: str = '') -> VarCollection:\n return self.__wrapped__.vars(scope=scope)",
"def get_vars_by_prefix(self, prefix):\n\n t_vars = tf.global_variables()\n return [var fo... | [
"0.7807971",
"0.7135843",
"0.7124688",
"0.7069396",
"0.7029748",
"0.68707967",
"0.6811423",
"0.6780924",
"0.67694354",
"0.6661847",
"0.6593601",
"0.65763617",
"0.64618665",
"0.64023626",
"0.6369196",
"0.6364975",
"0.6359857",
"0.6333704",
"0.63267547",
"0.63213676",
"0.630687... | 0.7720821 | 1 |
Gets the list of model variables, filtered by scope and/or suffix. | def get_model_variables(scope=None, suffix=None):
return get_variables(scope, suffix, ops.GraphKeys.MODEL_VARIABLES) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vars(scope=''):\n return [x for x in tf.trainable_variables() if scope in x.name]",
"def get_variables_by_suffix(suffix, scope=None):\n return get_variables(scope=scope, suffix=suffix)",
"def get_variables(scope=None, suffix=None,\n collection=ops.GraphKeys.GLOBAL_VARIABLES):\n if i... | [
"0.7322999",
"0.7263353",
"0.7148944",
"0.6973614",
"0.68849725",
"0.68298435",
"0.6811995",
"0.67827094",
"0.67236155",
"0.6673829",
"0.66443145",
"0.64663595",
"0.64436364",
"0.6428099",
"0.6425308",
"0.6422452",
"0.64095706",
"0.63515556",
"0.6343175",
"0.63409114",
"0.633... | 0.7651817 | 0 |
Gets the list of local variables, filtered by scope and/or suffix. | def get_local_variables(scope=None, suffix=None):
return get_variables(scope, suffix, ops.GraphKeys.LOCAL_VARIABLES) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vars(scope=''):\n return [x for x in tf.trainable_variables() if scope in x.name]",
"def get_variables(scope=None, suffix=None,\n collection=ops.GraphKeys.GLOBAL_VARIABLES):\n if isinstance(scope, variable_scope.VariableScope):\n scope = scope.name\n if suffix is not None:\n if ... | [
"0.6875429",
"0.6824919",
"0.67630106",
"0.66059744",
"0.65536577",
"0.6468472",
"0.6430241",
"0.6300913",
"0.62455904",
"0.62303483",
"0.61487556",
"0.61461043",
"0.6144172",
"0.61348397",
"0.6104915",
"0.6091263",
"0.608885",
"0.6044582",
"0.60349077",
"0.6014716",
"0.60085... | 0.7953546 | 0 |
Gets the list of trainable variables, filtered by scope and/or suffix. | def get_trainable_variables(scope=None, suffix=None):
return get_variables(scope, suffix, ops.GraphKeys.TRAINABLE_VARIABLES) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vars(scope=''):\n return [x for x in tf.trainable_variables() if scope in x.name]",
"def _get_variables_to_train():\n if FLAGS.trainable_scopes is None:\n return tf.trainable_variables()\n else:\n scopes = [scope.strip() for scope in FLAGS.trainable_scopes.split(',')]\n\n variables_to_train = [... | [
"0.78808016",
"0.75817424",
"0.7568647",
"0.75665385",
"0.75665385",
"0.73803556",
"0.73149925",
"0.7256115",
"0.72557074",
"0.7138855",
"0.7028941",
"0.69406384",
"0.6830125",
"0.6721636",
"0.66265166",
"0.66203827",
"0.6610239",
"0.6607596",
"0.65703636",
"0.64747226",
"0.6... | 0.8058095 | 0 |
Gets the list of the variables to restore. | def get_variables_to_restore(include=None, exclude=None):
if include is None:
# Include all variables.
vars_to_include = get_variables()
else:
if not isinstance(include, (list, tuple)):
raise TypeError('include is provided but is not a list or a tuple.')
vars_to_include = []
for scope in i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variables(self):\n if save_context.in_save_context():\n return [self._vars[0]]\n return self._vars",
"def get_all_variables(self):\n return []",
"def get_variables(self):\n\t\treturn self.variables",
"def get_variables_to_restore():\n# checkpoint_exclude_scopes=[\"distance-module\",... | [
"0.7365129",
"0.7336453",
"0.72029054",
"0.7134725",
"0.708888",
"0.70763904",
"0.70547456",
"0.7048377",
"0.7020138",
"0.6986312",
"0.69066834",
"0.6893118",
"0.68591523",
"0.6783938",
"0.6744217",
"0.6632024",
"0.66080105",
"0.66080105",
"0.66080105",
"0.6590427",
"0.657582... | 0.6638661 | 15 |
Gets the list of variables that end with the given suffix. | def get_variables_by_suffix(suffix, scope=None):
return get_variables(scope=scope, suffix=suffix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_files(suffix):\n lst = os.listdir(\".\")\n return filter(lambda x: x.endswith(suffix), lst)",
"def suffix(self):\n return self[\"suffix\"]",
"def suffix(self):\n return self[\"suffix\"]",
"def ends_with(strn, suffix):\n return strn.endswith(suffix)",
"def get_variables(scope=... | [
"0.57985854",
"0.5758867",
"0.5758867",
"0.5738691",
"0.57285994",
"0.57257175",
"0.5674938",
"0.56073433",
"0.55960876",
"0.5585065",
"0.5577938",
"0.55548906",
"0.5553235",
"0.5546447",
"0.55234176",
"0.5510119",
"0.5484863",
"0.5478595",
"0.54667115",
"0.5464406",
"0.53634... | 0.7658006 | 0 |
Gets the list of variables that were given that name. | def get_variables_by_name(given_name, scope=None):
suffix = '/' + given_name + ':|^' + given_name + ':'
return get_variables(scope=scope, suffix=suffix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getVariableInfo(self, variables, name):\r\n\r\n return [var.return_variable_dict() for var in variables if var.name == name][0]",
"def GetListVariable(self, name):\n var = self._makefile.variables.get(name, expand=True)[2]\n if not var:\n return []\n return var.resolvesplit(self._makefil... | [
"0.762169",
"0.7489604",
"0.7305183",
"0.72534794",
"0.71724236",
"0.699031",
"0.6919749",
"0.68733865",
"0.68554085",
"0.6822857",
"0.6821953",
"0.68016016",
"0.6783934",
"0.6773277",
"0.6735259",
"0.6731562",
"0.67203206",
"0.67203206",
"0.67203206",
"0.66997427",
"0.667652... | 0.7342688 | 2 |
Get the states of all involved random generators Returns states of random generators | def get_states(self):
states = {}
if hasattr(self, 'random_mask_state'):
states['random_mask_state'] = self.random_mask_state.get_state()
if hasattr(self, 'deformrandomstate'):
states['deformrandomstate'] = self.deformrandomstate.get_state()
states['randomstate'] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getstate(self):\n return (self.baseseed, self.counter, self.randbits_remaining)",
"def get_states(self):\n return product(*[phi.automaton().states for phi in self])",
"def generate(self):\n node = self.generate_random()\n\n while True:\n yield node.state[-1]\n ... | [
"0.6900002",
"0.67688364",
"0.66751266",
"0.6632256",
"0.6576247",
"0.65511715",
"0.6532857",
"0.65048647",
"0.64383984",
"0.64160836",
"0.64156777",
"0.64104337",
"0.6384705",
"0.6376139",
"0.63631177",
"0.633151",
"0.63241243",
"0.6309301",
"0.6260468",
"0.62059975",
"0.618... | 0.6430726 | 9 |
Returns the shape of the input data (with the batchsize set to None) Returns | def get_shape(self):
if not self.channels_first:
return [None] + self.w + [self.numoffeatures]
else:
return [None] + [self.numoffeatures] + self.w | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_size(self):\n self.validate_shape_and_dtype()\n return self.rgb.shape[0]",
"def get_input_shape(self):\n return self.network.inputs[self.input_blob].shape",
"def get_input_tensor_shape(self):\n return self._engine.get_input_tensor_shape()",
"def shape_for_keras(data):\n raise Not... | [
"0.7672198",
"0.7559191",
"0.7502382",
"0.74820626",
"0.74452686",
"0.7415401",
"0.74053395",
"0.739648",
"0.739648",
"0.739648",
"0.73878026",
"0.7377351",
"0.73518455",
"0.7279457",
"0.72454506",
"0.72449887",
"0.72449887",
"0.72449887",
"0.72449887",
"0.72449887",
"0.72371... | 0.0 | -1 |
Returns the shape of all available data concatenated in the batch dimension Returns | def get_data_dims(self):
return [len(self.tps)] + self.get_shape()[1:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_shape():\n return DATA_SHAPE",
"def shape(self,squeeze=True):\n return np.shape(self.getData(squeeze=squeeze))",
"def shape(self):\n return self.dataset.shape",
"def output_shape(self) ->torch.Size:\n input_shape = self.input_shape\n if self._reduce_mode in {None, 'non... | [
"0.72022074",
"0.71371967",
"0.70825624",
"0.6984716",
"0.6964873",
"0.69589156",
"0.69589156",
"0.69589156",
"0.69589156",
"0.69589156",
"0.6911568",
"0.69022757",
"0.6878662",
"0.68327177",
"0.68327177",
"0.68327177",
"0.68210924",
"0.68091804",
"0.67998934",
"0.67672265",
... | 0.7027653 | 3 |
Returns for sample in folder all feature and mask files | def _get_features_and_masks(self, folder, featurefiles=None, maskfiles=None):
if callable(folder):
return folder()
if featurefiles is None:
featurefiles = self.featurefiles
if maskfiles is None:
maskfiles = self.maskfiles
features = [self.load(os.path.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_samples_file(foldername, filter=None):\n samples = []\n for file in os.listdir(foldername):\n if filter and file.find(filter) == -1:\n continue\n for sample in sfile(foldername + '/' + file, None).get_samples():\n samples.append(sample)\n return samples",
"def... | [
"0.66166914",
"0.66130835",
"0.6608933",
"0.6530711",
"0.64481103",
"0.64200455",
"0.6325328",
"0.6314397",
"0.63045084",
"0.6299184",
"0.62664604",
"0.6253515",
"0.6250402",
"0.62471473",
"0.62376136",
"0.6235346",
"0.61357194",
"0.61341506",
"0.6125646",
"0.61032313",
"0.60... | 0.6891864 | 0 |
Threaded version of DataSetCollection. Basically a thin wrapper which employs num_threads threads to preload random samples. This will however result in possibly nonreproducible sampling patterns, as the threads run concurrently. | def __init__(self, w, p, location, foldername, featurefiles, maskfiles, nclasses, kw={}, num_threads=4, batch_size=1):
super(ThreadedDataSetCollection, self).__init__(w, p, location, foldername, featurefiles, maskfiles, nclasses, kw={})
# data_kw, kw = compile_arguments(ThreadedDataSetCollection, kw, tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_sample(self, batch_size=1, dtype=None, tp=None, **kw):\n if dtype is not None or tp is not None:\n logging.getLogger('data').warning(\n 'cant handle any special terms in random sample in this step, will use next one. this will just return preloaded stuff. terms were: {},... | [
"0.66802025",
"0.6138111",
"0.5902051",
"0.5768021",
"0.5732783",
"0.5608655",
"0.5605206",
"0.55981016",
"0.55981016",
"0.55952644",
"0.55910057",
"0.5583792",
"0.5565052",
"0.5463837",
"0.546073",
"0.5447372",
"0.54222655",
"0.5351216",
"0.53342015",
"0.53146595",
"0.531126... | 0.7136719 | 0 |
Returns length range to sample from for given entropy. | def length_range_for_entropy(entropy):
min_length = 3
max_length = min_length + int(entropy / 2)
return min_length, max_length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_length(self, prob_end):\n try:\n x = random.random()\n return int(ceil(log(1 - x) / log(1 - self.prob_end)))\n except ZeroDivisionError:\n return float(\"inf\")\n except ValueError:\n return 1",
"def in_range(entropy, first, last):\n ... | [
"0.6674703",
"0.65702325",
"0.6277708",
"0.6152844",
"0.58854973",
"0.5875688",
"0.58664584",
"0.57293844",
"0.5678779",
"0.56634486",
"0.5618282",
"0.559013",
"0.5576008",
"0.55733544",
"0.5560943",
"0.55545115",
"0.55454737",
"0.55331683",
"0.5531522",
"0.5525172",
"0.54975... | 0.7723809 | 0 |
A view that allows you to change username and profile picture | def account():
form = UpdateUserForm()
if form.validate_on_submit():
print(form)
if form.picture.data:
username = current_user.username
pic = add_profile_pic(form.picture.data,username)
current_user.profile_image = pic
current_user.username = form.u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile():\n\n if not g.user:\n flash(\"Access unauthorized.\", \"danger\")\n return redirect(\"/\")\n\n form = UserEditForm(obj=g.user)\n\n if form.validate_on_submit():\n if not User.authenticate(g.user.username, form.data[\"password\"]):\n flash(\"Invalid password.\"... | [
"0.72693646",
"0.7206467",
"0.7082939",
"0.70310736",
"0.6950603",
"0.6898906",
"0.6840599",
"0.6831586",
"0.68028486",
"0.6788022",
"0.6785205",
"0.6777212",
"0.6750762",
"0.6709945",
"0.67059636",
"0.6676785",
"0.6675287",
"0.66504407",
"0.664496",
"0.6637804",
"0.6636361",... | 0.6847176 | 6 |
Evaluate the model. Still passes the data through the model in the specified batchsize in order to prevent out of memory errors. Basically performs a whole epoch of feed forward steps and collects the results. | def evaluate(self):
assert tf.train.checkpoint_exists(str(self.checkpoint_dir)), \
'No checkpoint found in logdir: {}'.format(self.checkpoint_dir)
results = []
handle_op = self.dataset.create_test_feed()
kwargs = dict(checkpoint_dir=self.checkpoint_dir)
with tf.train... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(self, data: dataset.Dataset, batch_size: int = 32) -> Any:\n ds = data.gen_tf_dataset(\n batch_size, is_training=False, preprocess=self._preprocess)\n return self._model.evaluate(ds)",
"def evaluate(epoch_number):\r\n model.eval() # turn on the eval() switch to disable dropout\r\n ... | [
"0.6895104",
"0.6760886",
"0.67508525",
"0.67489356",
"0.67483455",
"0.6737642",
"0.6725519",
"0.67241186",
"0.67066133",
"0.66847426",
"0.66736877",
"0.665812",
"0.66552526",
"0.6644089",
"0.66414607",
"0.66414607",
"0.66256803",
"0.6622139",
"0.65921044",
"0.65911394",
"0.6... | 0.0 | -1 |
Compute the accuracy of the predictions with respect to onehot labels. | def accuracy(y, y_hat):
return np.mean(np.argmax(y, axis=1) == np.argmax(y_hat, axis=1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy_onehot(labels, preds):\n\tassert labels.shape[0]==preds.shape[0]\n\treturn np.sum(np.argmax(preds, axis=1) == np.argmax(labels, axis=1))/float(labels.shape[0])",
"def accuracy(predictions, test_labels):\n return f1_score(test_labels, predictions, average='micro') * 100",
"def accuracy(preds... | [
"0.84541327",
"0.830733",
"0.8239924",
"0.81366247",
"0.8103277",
"0.8062484",
"0.8004806",
"0.79857546",
"0.794683",
"0.7890365",
"0.7811949",
"0.7767405",
"0.7747657",
"0.77325326",
"0.76701725",
"0.76475084",
"0.7645841",
"0.76373875",
"0.7607567",
"0.7607274",
"0.760691",... | 0.0 | -1 |
Create a onehot encoding of x of size k. | def one_hot(x, dtype=np.float32):
return np.array(x[:, None] == np.arange(x.max()+1), dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _one_hot(z, K):\n z_one_hot = np.zeros((z.size, K))\n z_one_hot[np.arange(z.size), z] = 1\n return z_one_hot",
"def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)",
"def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)... | [
"0.804429",
"0.801011",
"0.7974455",
"0.78977334",
"0.7889785",
"0.7800311",
"0.7714966",
"0.75706875",
"0.75658363",
"0.7427502",
"0.7418045",
"0.73576915",
"0.735553",
"0.7347711",
"0.7343637",
"0.7291789",
"0.7286171",
"0.7206042",
"0.72045",
"0.7190287",
"0.7164403",
"0... | 0.6986427 | 40 |
Takes an index and returns the object with parameters set for that system. Note Currently requires a bunch of arrays to exist outside of this functions scope, e.g. `stype`, `dist`, `temps`, `rads`, `lums` | def prep_ith_star(self, i):
# Get index with matching stellar type in stellar properties table
imatch = match_stellar_type(self.STARS['stype'][i], verbose = True)
# Set system distance
self.cn.planet.distance = self.STARS['dist'][i]
# Set stellar temperature
self.cn.st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, ind):\n # This is used to make discrete sampling without replacement memory\n # efficient.\n for sub_grid in self.param_grid:\n # XXX: could memoize information used here\n if not sub_grid:\n if ind == 0:\n return {}... | [
"0.6223194",
"0.6170838",
"0.60591584",
"0.5901348",
"0.56127715",
"0.5591533",
"0.55506444",
"0.5517261",
"0.54739875",
"0.54663473",
"0.5458142",
"0.5442084",
"0.54359823",
"0.5395736",
"0.53889525",
"0.5387327",
"0.5376234",
"0.53715646",
"0.53554636",
"0.53239304",
"0.530... | 0.0 | -1 |
sum series(n,v1=0,v2=1) return "n"th value of sum series having v1 and v2 as first and second values | def sum_series(n,v1=0,v2=1):
L1=v2
L2=v1
if n<0:
print("please enter positive int value")
elif n==0:
return v1
elif n==1:
return v2
else:
for i in range(n-1):
C=L1+L2
L2=L1
L1=C
return C | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_series(n, first_val = 0, second_val = 1):\n if n == 0:\n return first_val\n elif n == 1:\n return second_val\n else:\n return (sum_series(n-1,first_val,second_val) +\n sum_series(n-2, first_val, second_val))",
"def sum_series(n, first_value=0, second_value=1):... | [
"0.85407114",
"0.8399829",
"0.83239585",
"0.830645",
"0.8302319",
"0.8260728",
"0.8238859",
"0.8155529",
"0.7858599",
"0.7824844",
"0.7818001",
"0.75618297",
"0.75481045",
"0.7455415",
"0.73083234",
"0.72955143",
"0.7232084",
"0.71643716",
"0.71105635",
"0.7031175",
"0.694662... | 0.8511392 | 1 |
Returns a copy of the locals for this instance | def get_locals_copy(self): # this function has none of its own testing because of its simplicity
return copy.deepcopy(self.__locals) # a copy is made so no changes propagate after function call
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_locals(self):\n self._locals = dict()",
"def __body__(cls):\n return locals()",
"def init_locals(self):\n pass",
"def variables(self):\n if save_context.in_save_context():\n return [self._vars[0]]\n return self._vars",
"def variables(self):\n return self._.v... | [
"0.6877947",
"0.68744916",
"0.68468225",
"0.66331345",
"0.6561542",
"0.65314925",
"0.6527621",
"0.65117097",
"0.6501746",
"0.64978904",
"0.64862746",
"0.64292955",
"0.6360151",
"0.6355349",
"0.6337556",
"0.63040286",
"0.62848973",
"0.6276612",
"0.62608",
"0.6234804",
"0.62323... | 0.8474401 | 0 |
Sets the rotation's direction. | def setDirection(self,stepDir = 2):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setdirection(self, *args, **kwargs):\n return _coordsys.coordsys_setdirection(self, *args, **kwargs)",
"def set_direction(self, new_dir):\n self.__direction = new_dir",
"def direction(self, direction):\n\n self._direction = direction",
"def setRobotDirection(self, direction):\n ... | [
"0.7363957",
"0.73441803",
"0.73064333",
"0.7275796",
"0.7275796",
"0.72202396",
"0.7088385",
"0.7088385",
"0.70790553",
"0.7018912",
"0.7004867",
"0.6911489",
"0.68941694",
"0.6808482",
"0.67923534",
"0.67668426",
"0.6751844",
"0.67489773",
"0.6653499",
"0.66181445",
"0.6611... | 0.67892313 | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.