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
Return True if other is the same transformed dimension as self
def test_eq(self, tdim, tdim2): assert tdim != tdim2 assert tdim == copy.deepcopy(tdim)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(self, other: InputTransform) -> bool:\n if hasattr(self, \"indices\") == hasattr(other, \"indices\"):\n if hasattr(self, \"indices\"):\n return (\n super().equals(other=other)\n and (self._d == other._d)\n and (sel...
[ "0.74769163", "0.7461343", "0.7431696", "0.7418275", "0.7384892", "0.733227", "0.72038674", "0.70793736", "0.70232356", "0.70046", "0.69433606", "0.6897116", "0.68180907", "0.6749451", "0.67321247", "0.6652727", "0.6650199", "0.6641426", "0.6639131", "0.66374886", "0.66291857...
0.0
-1
Return True if other is the same transformed dimension as self
def test_eq(self, rdim, rdim2): assert rdim != rdim2 assert rdim == copy.deepcopy(rdim)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(self, other: InputTransform) -> bool:\n if hasattr(self, \"indices\") == hasattr(other, \"indices\"):\n if hasattr(self, \"indices\"):\n return (\n super().equals(other=other)\n and (self._d == other._d)\n and (sel...
[ "0.74769163", "0.7461343", "0.7431696", "0.7418275", "0.7384892", "0.733227", "0.72038674", "0.70793736", "0.70232356", "0.70046", "0.69433606", "0.6897116", "0.68180907", "0.6749451", "0.67321247", "0.6652727", "0.6650199", "0.6641426", "0.6639131", "0.66374886", "0.66291857...
0.0
-1
Check that `TransformedSpace` is actually a `Space`.
def test_extends_space(self, tspace): assert isinstance(tspace, Space)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _type_check(data):\n if data.__class__.__name__ != \"Matrix3\":\n return False\n return True", "def _verify_space(self) -> None:\n\n for dimension in self.space.values():\n\n if dimension.type != \"fidelity\" and dimension.prior_name not in [\n \"unif...
[ "0.59165066", "0.5815204", "0.56940687", "0.56208855", "0.56109524", "0.55884075", "0.55550355", "0.5464319", "0.5382364", "0.5334029", "0.5321505", "0.5317447", "0.5314689", "0.5279454", "0.52695096", "0.52522856", "0.52046174", "0.52046174", "0.51809", "0.51526594", "0.5148...
0.6737286
0
Get compute agents. Use guest agents to access files on the disk, configure networking, and run other applications and scripts in the guest while it runs. This hypervisorspecific extension is not currently enabled for KVM. Use of guest agents is possible only if the underlying service provider uses the Xen driver.
def compute_agents(self): path = '/os-agents' res = self.compute.call(path, 'GET', data='', token=self.manager.identity.token) self.logger.debug('Get openstack compute agents: %s' % truncate(res)) return res[0]['agents']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_hypervisors(self):\n path = '/os-hypervisors/detail'\n res = self.compute.call(path, 'GET', data='', \n token=self.manager.identity.token)\n self.logger.debug('Get openstack hypervisors: %s' % truncate(res))\n return res[0]['hypervisors']", "...
[ "0.6458925", "0.6154987", "0.5959654", "0.58983904", "0.58913994", "0.5722453", "0.5641106", "0.56048274", "0.54892385", "0.5450502", "0.5443963", "0.5421937", "0.53946143", "0.5384687", "0.5319538", "0.5302619", "0.5273059", "0.5199747", "0.51558447", "0.51141316", "0.507338...
0.7959732
0
Lists subnets to which the tenant has access.
def list(self, tenant=None, network=None, gateway_ip=None, cidr=None): path = '%s/subnets' % self.ver query = {} if tenant is not None: query['tenant_id'] = tenant if network is not None: query['network_id'] = network if gateway_ip is not Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_subnet(self):\n _url = \"http://\" + self.host_ip + \":9696/v2.0/subnets\"\n _headers = {'Content-type': 'application/json',\n 'x-auth-token': self.project_info[\"token_project\"]}\n _body = None\n\n response = self.request(\"GET\", _url, _headers, _body)\n ...
[ "0.8531323", "0.79958993", "0.7942642", "0.79011506", "0.78252876", "0.7814283", "0.7814283", "0.7730211", "0.7675656", "0.7664111", "0.75469536", "0.75244284", "0.74490345", "0.7352497", "0.72571266", "0.7254593", "0.7083893", "0.6965801", "0.6705647", "0.6690456", "0.666573...
0.78085834
7
Shows details for a subnet.
def get(self, oid=None, name=None): if oid is not None: path = '%s/subnets/%s' % (self.ver, oid) elif name is not None: path = '%s/subnets?display_name=%s' % (self.ver, name) else: raise OpenstackError('Specify at least subnet id or name') res = self.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_subnet(self, subnet, **_params):\r\n return self.get(self.subnet_path % (subnet), params=_params)", "def subnet(self) -> pulumi.Output[Optional['outputs.ResourceIdResponse']]:\n return pulumi.get(self, \"subnet\")", "def list_subnet(self):\n _url = \"http://\" + self.host_ip + \":...
[ "0.8429034", "0.70768046", "0.7010376", "0.6952971", "0.68266225", "0.66001695", "0.6381003", "0.6232393", "0.6221301", "0.6172939", "0.61491007", "0.60868365", "0.60788554", "0.60192174", "0.60051167", "0.59034646", "0.59007144", "0.5885185", "0.58671004", "0.5840484", "0.58...
0.62246644
8
Update a subnet on a network.
def update(self, oid, name=None, network_id=None, tenant_id=None, gateway_ip=None, cidr=None, allocation_pools=None, enable_dhcp=None, host_routes=None, dns_nameservers=None): data = { "subnet": { } } if network_id is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subnet_update(auth=None, **kwargs):\n cloud = get_operator_cloud(auth)\n kwargs = _clean_kwargs(**kwargs)\n return cloud.update_subnet(**kwargs)", "def update_subnet(\n self,\n name_or_id,\n subnet_name=None,\n enable_dhcp=None,\n gateway_ip=None,\n disable_...
[ "0.7362183", "0.71798444", "0.7071078", "0.70009536", "0.68884283", "0.66508627", "0.6450915", "0.640929", "0.6350988", "0.62960285", "0.6243553", "0.6222917", "0.60798806", "0.60401106", "0.5955932", "0.59451294", "0.59042954", "0.5894636", "0.5873514", "0.58574474", "0.5833...
0.7478109
0
Remove a security group
def delete(self, oid): path = '%s/security-groups/%s' % (self.ver, oid) res = self.client.call(path, 'DELETE', data='', token=self.manager.identity.token) self.logger.debug('Delete openstack security group: %s' % truncate(res)) return res[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_security_group(self, security_group):\r\n return self.delete(self.security_group_path % (security_group))", "def do_remove_security_group(cs, args):\n opts = {}\n opts['id'] = args.container\n opts['security_group'] = args.security_group\n opts = zun_utils.remove_null_parms(**opts)\...
[ "0.79705936", "0.78012633", "0.7765746", "0.7751246", "0.7728149", "0.75009376", "0.74173313", "0.7298204", "0.7271513", "0.71524966", "0.71470153", "0.7123041", "0.71001816", "0.7089805", "0.70890915", "0.70636207", "0.7028668", "0.6992364", "0.6927609", "0.69040203", "0.683...
0.7312577
7
Get the temp dir path
def get_path(self): return self.path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_temp_path():\n return os.getcwd() + \"/temp/\"", "def temp_directory(self):\n\n return self.get_raw(\"temp_directory\")", "def getTmpdir(self):\n pass", "def get_temp_dir():\n return settings.FILE_STORE_TEMP_DIR", "def getTempFilePath(self):\n return self.tempDir + os.sep...
[ "0.8884603", "0.86335194", "0.8360228", "0.8353304", "0.8297364", "0.8283807", "0.8273937", "0.82212317", "0.81991416", "0.81927425", "0.81623155", "0.80707955", "0.8067768", "0.79986084", "0.79350203", "0.7918394", "0.79107386", "0.79059833", "0.78962046", "0.7873188", "0.78...
0.0
-1
Remove all empty fields in a nested dict
def clean_dict(d): if not isinstance(d, (dict, list)): return d if isinstance(d, list): return [v for v in (clean_dict(v) for v in d) if v] return OrderedDict([(k, v) for k, v in ((k, clean_dict(v)) for k, v in list(d.items())) if v])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_empty_fields(obj: dict) -> dict:\n return {k: v for k, v in obj.items() if v is not None}", "def remove_empty_fields(data_):\n if isinstance(data_, dict):\n for key, value in data_.items():\n\n # Dive into a deeper level.\n if isinstance(value, dict) or isinstance(va...
[ "0.81086636", "0.7953483", "0.78173953", "0.77531606", "0.7605871", "0.730308", "0.7292084", "0.71517026", "0.7143359", "0.7134379", "0.7130958", "0.7125585", "0.7113601", "0.7088326", "0.6882478", "0.68753076", "0.6848598", "0.68315417", "0.6754588", "0.6707885", "0.6689893"...
0.0
-1
Returns a QuerySet from a Model, Manager, or QuerySet. Created to make get_object_or_404 and get_list_or_404 more DRY. Raises a ValueError if klass is not a Model, Manager, or QuerySet.
def _get_queryset(klass): if isinstance(klass, QuerySet): return klass elif isinstance(klass, Manager): manager = klass elif isinstance(klass, ModelBase): manager = klass._default_manager else: if isinstance(klass, type): klass__name = klass.__name__ e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(\n cls,\n qs: Union[models.QuerySet[_T], models.Manager[_T]],\n info: ResolverInfo,\n ) -> models.QuerySet[_T]:\n if isinstance(qs, models.Manager):\n qs = qs.get_queryset()\n\n if not cls.check_permissions(info.context.user):\n return qs...
[ "0.7157338", "0.7090669", "0.6907455", "0.68056244", "0.6725871", "0.64539725", "0.6452662", "0.6449619", "0.64377844", "0.64312", "0.6378838", "0.6259126", "0.61922276", "0.6115421", "0.60732144", "0.60718566", "0.60150015", "0.5963587", "0.5905534", "0.58375347", "0.5797705...
0.83135176
0
Make sure the top/left of our tile is always onscreen.
def testMuchTiling(self): launcher.TextFrame._ResetTiling() area = wx.Display().GetClientArea() lc = launcher.TextFrame('super dooper tytle 4 roolerz and doodz') # Needs to be real big in case you have a large monitor. ~1000 # iterations needed for a (1440,874) laptop before a full reset # happ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keepInBounds(self):\n screenWidth, screenHeight = self.screen.get_size()\n\n self.pos.x = max(0, self.pos.x)\n self.pos.x = min(screenWidth, self.pos.x)\n\n self.pos.y = max(0, self.pos.y)\n self.pos.y = min(screenHeight, self.pos.y)", "def stay_on_screen(self):\n if...
[ "0.70133376", "0.6571967", "0.6561268", "0.6546092", "0.64929986", "0.6462556", "0.6333862", "0.62992734", "0.6279137", "0.6262198", "0.6246176", "0.623206", "0.61855304", "0.6155855", "0.615256", "0.60575604", "0.60350025", "0.6002097", "0.5987849", "0.5982607", "0.59453785"...
0.5719401
39
Attempts to convert a potential user_id to a User. If this fails returns None
async def get_user(self, user_target: str) -> Optional[User]: if len(user_target) >= 17: try: user_id = int(user_target) except ValueError: pass else: user: User = self.bot.get_user(user_id) if user is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(cls, user_id):\n try:\n return User.objects.get(pk=user_id)\n except User.DoesNotExist:\n return None", "def get_user(self, user_id):\n User = get_user_model()\n try:\n return User.objects.get(pk=user_id)\n except User.DoesNotExist:...
[ "0.7615357", "0.74973273", "0.7454623", "0.7402494", "0.73484975", "0.7277747", "0.72662467", "0.72662467", "0.72662467", "0.7235947", "0.72089773", "0.7153019", "0.71501863", "0.7136881", "0.7126822", "0.7113505", "0.70275253", "0.7022546", "0.69937736", "0.6910486", "0.6906...
0.7146676
13
Set default sink by name.
def set_default_sink(self, name): self._set_default_source = pa_context_success_cb_t(self._context_success_cb) pa_context_set_default_sink(self._context, name, self._set_default_source, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_default_source(self, name):\n self._set_default_source = pa_context_success_cb_t(self._context_success_cb)\n pa_context_set_default_source(self._context,\n name,\n self._set_default_source,\n ...
[ "0.58313465", "0.57462263", "0.53973925", "0.5345024", "0.53018135", "0.5261482", "0.5229726", "0.52092725", "0.51855946", "0.5164614", "0.5121892", "0.5104802", "0.510166", "0.509217", "0.5079069", "0.5053735", "0.5049662", "0.50251245", "0.50161564", "0.49898723", "0.497857...
0.7945534
0
Create one layer of 3d convolution.
def __init__(self, inpt, inpt_height, inpt_width, inpt_depth, n_inpt, filter_height, filter_width, filter_depth, n_output, transfer='identity', n_samples=None, declare=None, name=None, border_mode='valid', implementation='dnn_conv3d', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BasicConv3d(in_planes, out_planes, kernel_size, stride=(1, 1, 1), padding=(0, 0, 0),\n bias=False, dw_t_conv=False):\n return nn.Conv3d(in_planes, out_planes, kernel_size=kernel_size,\n stride=stride, padding=padding, bias=bias,\n groups=in_planes if dw...
[ "0.73872864", "0.7383941", "0.7326078", "0.7303103", "0.7285542", "0.72814775", "0.72814775", "0.72814775", "0.72814775", "0.72814775", "0.72814775", "0.72814775", "0.7261971", "0.7251925", "0.7245168", "0.72388566", "0.72388566", "0.72388566", "0.72388566", "0.72388566", "0....
0.68215966
100
Return an integer containing the number of messages stored.
def stored_cookie_messages_count(storage, response): # Get a list of cookies, excluding ones with a max-age of 0 (because # they have been marked for deletion). cookie = response.cookies.get(storage.cookie_name) if not cookie or cookie['max-age'] == 0: return 0 data = storage._decode(cookie....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_count(self):\n return len(self.messages)", "def message_count(self):\n pass", "def get_message_count(self):\n return self.buffer.count()", "def message_count(self):\n return self._message_count", "def message_count(self) -> int:\n return len(self._leased_messa...
[ "0.81768167", "0.7992513", "0.79738927", "0.7942304", "0.7807104", "0.7744766", "0.7695045", "0.73453796", "0.73015505", "0.72745776", "0.7212893", "0.7187935", "0.7170842", "0.71500313", "0.6980668", "0.6941083", "0.69313616", "0.6924685", "0.6917474", "0.69018745", "0.68835...
0.6806529
28
Build and return a data loader.
def get_loader(image_dir, attr_path, selected_attrs, crop_size=178, image_size=128, batch_size=16, dataset='CelebA', mode='train', num_workers=0): transform = [] if mode == 'train': transform.append(T.RandomHorizontalFlip()) transform.append(T.CenterCrop(crop_size)) transform.app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loader(data, json, batch_size, shuffle, num_workers):\n dataset = FinNumDataset(data, json)\n\n data_loader = torch.utils.data.DataLoader(dataset=dataset,\n batch_size=batch_size,\n shuffle=shuffle,\n ...
[ "0.74889874", "0.73519504", "0.711431", "0.70320064", "0.6991118", "0.6990211", "0.6968911", "0.6925782", "0.69233835", "0.6864498", "0.68342435", "0.6819947", "0.68127316", "0.6809393", "0.68059325", "0.6692377", "0.6691707", "0.6687672", "0.66781133", "0.66521686", "0.66456...
0.6543141
24
Sends a 401 response that enables basic auth
def authenticate(): return Response( 'Could not verify your access level for that URL, need token.\n', 403, {'WWW-Authenticate': 'Basic realm="token Required"'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})", "def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )", "def authenticate():\n return Response(\n 'You have to login with pro...
[ "0.8093736", "0.80926424", "0.7958403", "0.7852648", "0.7843114", "0.7824419", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", ...
0.7591923
43
Test Agency lookup by subtier.
def test_get_by_subtier(): toptier = mommy.make("references.ToptierAgency", cgac_code="xyz", name="yo") subtier = mommy.make("references.SubtierAgency", subtier_code="abc", name="hi") mommy.make( "references.Agency", toptier_agency=toptier, subtier_agency=mommy.make("references.Subt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_by_subtier():\n toptier = baker.make(\"references.ToptierAgency\", toptier_code=\"xyz\", name=\"yo\")\n subtier = baker.make(\"references.SubtierAgency\", subtier_code=\"abc\", name=\"hi\")\n\n baker.make(\n \"references.Agency\",\n toptier_agency=toptier,\n subtier_agenc...
[ "0.7818659", "0.7781944", "0.75642794", "0.7398047", "0.73941875", "0.64692754", "0.6263812", "0.61549133", "0.5755122", "0.56919444", "0.5664852", "0.56367433", "0.5626359", "0.55386436", "0.5515981", "0.5342531", "0.5175839", "0.5162787", "0.5147197", "0.5106574", "0.509974...
0.7690697
2
Test Agency lookup by subtier.
def test_get_by_toptier_subtier(): toptier = mommy.make("references.ToptierAgency", cgac_code="xyz", name="yo") subtier = mommy.make("references.SubtierAgency", subtier_code="abc", name="hi") mommy.make( "references.Agency", toptier_agency=toptier, subtier_agency=mommy.make("referen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_by_subtier():\n toptier = baker.make(\"references.ToptierAgency\", toptier_code=\"xyz\", name=\"yo\")\n subtier = baker.make(\"references.SubtierAgency\", subtier_code=\"abc\", name=\"hi\")\n\n baker.make(\n \"references.Agency\",\n toptier_agency=toptier,\n subtier_agenc...
[ "0.7818659", "0.7781944", "0.7690697", "0.75642794", "0.73941875", "0.64692754", "0.6263812", "0.61549133", "0.5755122", "0.56919444", "0.5664852", "0.56367433", "0.5626359", "0.55386436", "0.5515981", "0.5342531", "0.5175839", "0.5162787", "0.5147197", "0.5106574", "0.509974...
0.7398047
4
Conver string time to float time (seconds).
def parse_time(value: str) -> float: return float(value[:-1]) * TIME[value[-1]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_seconds(time):\n return 3600 * time", "def time2secs(time_str):\r\n try:\r\n time_str = float(time_str)\r\n return get_simple_digit_str(time_str)\r\n except:\r\n pass\r\n try:\r\n final_secs = 0\r\n new_time = re.split(\"\\s+\", time_str)\r\n day_hour_...
[ "0.72550255", "0.72118527", "0.71878624", "0.71372527", "0.70929056", "0.6931881", "0.6929267", "0.6785158", "0.6760134", "0.6743247", "0.6723999", "0.66939324", "0.66875446", "0.6634287", "0.6572309", "0.65669805", "0.6539454", "0.6482747", "0.64818585", "0.64389896", "0.642...
0.7143329
3
Convert degrees kelvin to mired shift.
def decode(self, device: "XDevice", payload: dict, value: int): payload[self.attr] = int(1000000.0 / value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_eV_kcalmol(en_eV):\n return en_eV/kcalmol_eV", "def convertKelvinToCelsius(K):\n if isinstance(K, str) == True:\n raise ValueError(\"Kelvin cannot be a string value\")\n if isinstance(K,complex) == True:\n raise ValueError(\"Kelvin cannot be a complex value\")\n if isinstanc...
[ "0.61126906", "0.6014034", "0.5962969", "0.58621544", "0.5831765", "0.5825429", "0.57594615", "0.5719692", "0.57189494", "0.5683838", "0.5681102", "0.56319225", "0.55746275", "0.5568884", "0.55574036", "0.5502497", "0.5470246", "0.5405953", "0.5395607", "0.53812826", "0.53373...
0.0
-1
Create a connection instance based on the given uri. Raises ValueError if the given uri was not valid.
def create_connection(loop, uri): proto_pos = uri.find('://') protocol_name = uri[0:proto_pos] if protocol_name not in PROTOCOL_MAP: raise ValueError("Unknown protocol %s" % protocol_name) address_str = uri[proto_pos + 3:] protocol_cls, address_parser = PROTOCOL_MAP[protocol_name] a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(uri: str, *args: Any, **kwargs: Any) -> Connection:\n match = _uri_regex.match(uri)\n if match:\n scheme, path = match.groups()\n connector, engine_kls = Connection.get_connector(scheme)\n return connector(engine_kls(), path, *args, **kwargs)\n raise InvalidURI(f\"Invalid ...
[ "0.7389015", "0.60644", "0.5998256", "0.5841502", "0.57807666", "0.5774932", "0.57639134", "0.56511384", "0.5599638", "0.55574524", "0.55373484", "0.5500499", "0.54730445", "0.5424272", "0.53745556", "0.5348025", "0.53000194", "0.52937883", "0.5272822", "0.5180025", "0.517507...
0.7927823
0
Returns serializable state dict.
def get_state(self) -> dict: return { "name": self.name, "namespace": self.namespace, "args": self.args, "kwargs": self.kwargs, "class_name": self.class_name, "call_hash": self.call_hash, "key": self.key, "hash": sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_state_to_dict(self):\n return self.__dict__.copy()", "def get_state_dict(self):\n raise NotImplemented()", "def __getstate__(self):\n return dict(self.items())", "def __getstate__(self):\n return dict(self.items())", "def to_state_json(self) -> Dict[str, Any]:\n ...
[ "0.8483683", "0.8226812", "0.8070852", "0.8070852", "0.8035853", "0.79427695", "0.79396343", "0.78691465", "0.7843865", "0.7797128", "0.77952635", "0.7740005", "0.7717077", "0.77159333", "0.7706244", "0.76585126", "0.7623279", "0.76151896", "0.76082677", "0.75897986", "0.7563...
0.8143474
2
Returns True if POT should be used for quantization, False otherwise.
def should_use_pot(advanced_parameters: Optional[AdvancedQuantizationParameters]) -> bool: use_pot = USE_POT_AS_DEFAULT if advanced_parameters is not None: use_pot = advanced_parameters.backend_params.get(BackendParameters.USE_POT, USE_POT_AS_DEFAULT) if not use_pot: return False try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_buy(self):\n return(copysign(1, self.volume)>0)", "def check_if_quantized(model: Any) -> bool:\n nodes = model.get_ops()\n for op in nodes:\n if \"FakeQuantize\" == op.get_type_name():\n return True\n return False", "def is_use_qps(self) -> bool:\n if self.qps > ...
[ "0.6806259", "0.6785799", "0.66605526", "0.66076815", "0.63469636", "0.6257122", "0.6186776", "0.5894863", "0.58781624", "0.58376676", "0.5737352", "0.572669", "0.56811714", "0.56710845", "0.5654712", "0.5647227", "0.5639821", "0.5630454", "0.5614904", "0.5587647", "0.5574776...
0.67399424
2
Implementation of the `quantize()` method for the OpenVINO backend via the OpenVINO Runtime API.
def native_quantize_impl( model: ov.Model, calibration_dataset: Dataset, preset: QuantizationPreset = QuantizationPreset.PERFORMANCE, target_device: TargetDevice = TargetDevice.ANY, subset_size: int = 300, fast_bias_correction: bool = True, model_type: Optional[ModelType] = None, ignored...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _quantize_one_value(self, value):\n add = 0.5 if value > 0 else -0.5\n return int(value / self._quantization_factor + add)", "def _quantize(self):\n self._quantized_subsamples = [0] * self._number_of_subsamples\n for index, value in enumerate(self._subsamples):\n self._quantized_subsamples[i...
[ "0.6333058", "0.6240977", "0.60589254", "0.60455686", "0.59652454", "0.58371264", "0.579589", "0.5766606", "0.5751158", "0.57337105", "0.5724337", "0.568619", "0.5682013", "0.5669367", "0.5665488", "0.5651451", "0.56388074", "0.5631077", "0.56061655", "0.5560327", "0.55280983...
0.6066695
2
Random select some elements from the gallery. It seems that Pytorch's implementation is slower than numpy so we use numpy to randperm the indices.
def random_choice(gallery, num): assert len(gallery) >= num if isinstance(gallery, list): gallery = np.array(gallery) cands = np.arange(len(gallery)) np.random.shuffle(cands) rand_inds = cands[:num] if not isinstance(gallery, np.ndarray): rand_inds...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose(n, a):\n return torch.as_tensor([a[idx] for idx in torch.randperm(len(a))[:n]])", "def random_choice(self, gallery, num):\n assert len(gallery) >= num\n\n is_tensor = isinstance(gallery, torch.Tensor)\n if not is_tensor:\n gallery = torch.tensor(\n gal...
[ "0.7213696", "0.6995074", "0.6795658", "0.67338973", "0.6728321", "0.66386425", "0.65705615", "0.6518825", "0.6503902", "0.6475108", "0.64717215", "0.646535", "0.6456446", "0.6454149", "0.6450245", "0.6425671", "0.6400427", "0.63948756", "0.63854903", "0.63599473", "0.6359421...
0.73129493
1
Do not return anything, modify rooms inplace instead.
def wallsAndGates(self, rooms: List[List[int]]) -> None: if not rooms: return rooms ind_0s = [] len_row = len(rooms) len_col = len(rooms[0]) for i in range(len_row): for j in range(len_col): if rooms[i][j] == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rooms(self, rooms):\n\n self._rooms = rooms", "def _add_rooms(self):\r\n rooms = self.model.get_all_rooms()\r\n\r\n for room in rooms:\r\n self._add_room(room)", "def rooms(*args):\n send.system_message('\\n'.join(rooms()))", "def all_rooms(self):\n pass", ...
[ "0.67922777", "0.61478335", "0.598253", "0.5948323", "0.594002", "0.5908321", "0.57992345", "0.5784805", "0.5763563", "0.5696209", "0.5658307", "0.5652552", "0.56459254", "0.5635183", "0.5579419", "0.5570451", "0.554039", "0.5532352", "0.5532352", "0.5527118", "0.54926485", ...
0.0
-1
Assembles a matrix corresponding to the weights of in the finite difference computation of derivatives, i.e. assembles the weight matrix W, giving the difference matrix d
def assemble_finite_difference_weight_matrix(zN, N, FD_schemes ): imax = zN - 1 Wz = np.zeros([N, zN, zN]) # includes zeroeth order derivative container (not used) # i.e. Wz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _adj(w):\r\n return (w[:d * d] - w[d * d:]).reshape([d, d])", "def d_dweight(self, ):\n return self.gen_df_dw(self.params, self.output_shape)(self.current_input)", "def derivativeW(self, w, x, y, z):\n wa = np.asarray(w)\n xa = np.asarray(x)\n ya = np.asarray(y)\n ...
[ "0.68223935", "0.65287614", "0.64400613", "0.6419982", "0.63826627", "0.62841994", "0.61400217", "0.6075504", "0.60749817", "0.5997607", "0.591929", "0.5918122", "0.59150994", "0.59051", "0.5893019", "0.58626854", "0.5855607", "0.5855607", "0.58459395", "0.5841853", "0.581329...
0.63337183
6
Assembles a matrix corresponding to the weights of in the finite difference computation of derivatives, i.e. assembles the weight matrix W, giving the difference matrix d
def assemble_finite_difference_weight_matrix_const_dn_const_LTE(zN, FD_scheme_const_dn, dn = 1, LTE = 6 ): imax = zN - 1 W_dn_LTE = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _adj(w):\r\n return (w[:d * d] - w[d * d:]).reshape([d, d])", "def d_dweight(self, ):\n return self.gen_df_dw(self.params, self.output_shape)(self.current_input)", "def derivativeW(self, w, x, y, z):\n wa = np.asarray(w)\n xa = np.asarray(x)\n ya = np.asarray(y)\n ...
[ "0.6821999", "0.6528738", "0.64400256", "0.6419608", "0.6383164", "0.6332276", "0.6332276", "0.62838477", "0.6140474", "0.6075531", "0.6075277", "0.59961605", "0.59192204", "0.59156007", "0.5914654", "0.5904736", "0.5892554", "0.58625627", "0.58454204", "0.5843213", "0.581320...
0.58556604
19
returns a formatted datetime given a datetime object.
def get_date_str(datetime, str_format="datetime", locale="en_US", tz="America/New_York"): timezone = pytz.timezone(tz) datetime = datetime.astimezone(timezone) if str_format == "date": return dates.format_date(datetime, locale=locale) elif str_format == "time": return dates.format_time(datetime, locale=locale)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_datetime(dt):\r\n return dateformat.format(make_naive(dt), 'r')", "def format_datetime(self, datetime):\n return datetime.isoformat()", "def getFormattedDate(self, dt):\n if DATE_FORMAT_STRING == '':\n return time.strftime('%Y-%m-%d %H:%M:%S', dt.timetuple())\n els...
[ "0.7265636", "0.702801", "0.6990824", "0.69874233", "0.6929377", "0.69235766", "0.6914798", "0.6896786", "0.6876234", "0.68333375", "0.67983025", "0.66946226", "0.66253805", "0.6623812", "0.6611879", "0.65798044", "0.65776664", "0.65613353", "0.65485", "0.65158814", "0.650619...
0.61975634
37
A name for this provider, defaults to the class name.
def provider_name(cls) -> str: return cls.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provider_name(self):\n raise NotImplementedError", "def provider_name(self):\n return self.resource_class.name", "def provider_name(self):\n return self.resource_class.name", "def name(cls):\n return cls.NAME", "def name(cls):\n return cls.NAME", "def name(cls):\n ...
[ "0.8493824", "0.83859503", "0.83859503", "0.80046093", "0.80046093", "0.79020476", "0.77843344", "0.77743965", "0.7749188", "0.7648971", "0.76172245", "0.76172245", "0.76172245", "0.76172245", "0.76146996", "0.7614251", "0.75949824", "0.75847566", "0.7583006", "0.7570663", "0...
0.8861296
0
get column with specific name
def get_column_by_name(self, data_name: str, column_name: str, as_list: bool = True): data = self.__data[data_name][column_name] if as_list: return list(data) else: return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_column(cls, name):\r\n return cls._columns[name]", "def _get_column(self, name):\r\n return self.column(name)", "def getCol(self, column_name):\n idx = self.colnames.index(column_name)\n return self.getColByIdx(idx)", "def col(self, name):\n # Identify the column c...
[ "0.8817791", "0.8721819", "0.8018119", "0.7957317", "0.7900995", "0.78150874", "0.77832127", "0.75105786", "0.74855053", "0.7367596", "0.7307458", "0.73040986", "0.7247948", "0.72446734", "0.7190667", "0.7063529", "0.7056497", "0.70492345", "0.70258653", "0.69793904", "0.6963...
0.712627
15
Do not return anything, modify rooms inplace instead.
def wallsAndGates(self, rooms: List[List[int]]) -> None: ## bfs: queue= [] for r in range(len(rooms)): for c in range(len(rooms[0])): if rooms[r][c]==0: queue.append((r,c, 0)) while queue: r,c, l= queue.pop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rooms(self, rooms):\n\n self._rooms = rooms", "def _add_rooms(self):\r\n rooms = self.model.get_all_rooms()\r\n\r\n for room in rooms:\r\n self._add_room(room)", "def rooms(*args):\n send.system_message('\\n'.join(rooms()))", "def all_rooms(self):\n pass", ...
[ "0.67922723", "0.6150443", "0.5985418", "0.59520423", "0.5938853", "0.5910455", "0.5802791", "0.5788961", "0.57677865", "0.56960684", "0.56584203", "0.56518275", "0.5649922", "0.56375164", "0.5580176", "0.5570199", "0.5540112", "0.5534412", "0.5534412", "0.5529608", "0.549605...
0.51096535
58
creating two distincts lists of booked and nonbooked rooms
def check_room(rooms): free_rooms = [] booked_rooms = [] for element in rooms: if element['booked'] == False: free_rooms.append(element) else: booked_rooms.append(element) return free_rooms, booked_rooms
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_room_list():\n room_list = []\n # 0\n room = Room(\n \"Patio. You are in a patio, it is surrounded by four long walls.\\n\\\n The south wall has a metal door.\",\n north = None,\n east = None,\n south = 2,\n west = None\n )\n room_list.append(room)\...
[ "0.65403295", "0.636613", "0.6288054", "0.624086", "0.6025219", "0.59999627", "0.59983283", "0.5979315", "0.59743315", "0.5881299", "0.5862943", "0.5842839", "0.5787145", "0.5724712", "0.5723215", "0.5719323", "0.571849", "0.5699821", "0.56556034", "0.5650907", "0.56048715", ...
0.7956473
0
Ability to book a room
def booking(): room_choice = int(input("Room you want to book: ")) for x in rooms: if room_choice == x['number']: if x['booked'] == True: print("The room is already booked!") else: x['booked'] = True print("The room you picked is no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def booking(self, customer, room):\n self.room[room] = customer\n return True", "def give_book(self):\n pass", "def create_room(self, name, typ):\n if typ == \"O\":\n if not name in self.all_rooms.keys():\n new_room = Office(name)\n self.offi...
[ "0.7108774", "0.65300405", "0.64268565", "0.6410336", "0.608352", "0.6069608", "0.6068689", "0.6063456", "0.6016459", "0.58313286", "0.58215725", "0.5806468", "0.57746536", "0.5758167", "0.5715385", "0.56636345", "0.56445223", "0.56432754", "0.5625628", "0.5599806", "0.554857...
0.6318861
4
set_range(value) It sets the maximum value of gauge widget
def set_range(self, value): self.gauge.SetRange(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_progress_range(self, maximum):\r\n\r\n pass", "def setRange(self, range):\n\t\tself.range = range\n\t\tself.slider.setMinimum(0.0)\n\t\tself.slider.setMaximum(100.0)\n\t\tself.spinbox.setRange(self.range[0], self.range[1])\n\n\t\tdiff = self.range[1] - self.range[0]\n\t\tif diff <= 1:\n\t\t\tself....
[ "0.74155194", "0.7338499", "0.72948724", "0.71547735", "0.6990074", "0.69325423", "0.6911576", "0.6911576", "0.68774766", "0.6833068", "0.680402", "0.67790985", "0.67261904", "0.66644067", "0.6577866", "0.6540281", "0.6504725", "0.6504725", "0.6501373", "0.64873946", "0.64803...
0.8797237
0
GetBaseClasses Iterates through the class list and makes a list with classes that have no base.
def GetClassBases(self,cls): name = "" for i in cls: if i != ")": name+=i lst = name.split("(") cls_lst = lst[-1].split(",") if cls_lst: return cls_lst else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_all_bases(class_or_name: Union[str, Type]) -> List[str]:\n if isinstance(class_or_name, str):\n return [class_or_name]\n\n classes = [class_or_name.__name__]\n for base in class_or_name.__bases__:\n classes.extend(_get_all_bases(base))\n\n return deduplicate(classes)", "def get...
[ "0.6977559", "0.6936384", "0.6935393", "0.68849516", "0.68341506", "0.67447174", "0.65734553", "0.6485608", "0.64805645", "0.643915", "0.6431166", "0.6411359", "0.6406317", "0.63907236", "0.6367154", "0.63570523", "0.62923175", "0.6291641", "0.62679046", "0.626506", "0.626506...
0.6524548
7
InheritsFrom Takes the sting argument base_class and checks if it the base of the string argument child_class. Returns True or False.
def InheritsFrom(self,base_class,child_class): if self.CleanName(base_class) in child_class.split("(")[-1]: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inherits_from(child, parent_name):\n if inspect.isclass(child):\n if parent_name in [c.__name__ for c in inspect.getmro(child)[1:]]:\n return True\n return False", "def _has_base(cls, base):\n if cls is base:\n return True\n elif cls is None:\n return False\n tr...
[ "0.77421993", "0.7262353", "0.72584265", "0.6801463", "0.6723592", "0.66751736", "0.6662766", "0.664373", "0.66168654", "0.65986854", "0.6554053", "0.6550121", "0.6542382", "0.65101343", "0.6509406", "0.64974266", "0.63985306", "0.6365256", "0.63649184", "0.63649184", "0.6349...
0.8677296
0
Load user by ID.
def load_user(user_id): return User.get_by_id(int(user_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_user(id):\n return User.get_by_id(int(id))", "def load_user(id):\n\treturn User.query.get(int(id))", "def load_user(id):\n return User.query.get(int(id))", "def load_user(id):\n return User.query.get(int(id))", "def load_user(id):\n return User.query.get(int(id))", "def load_user(id)...
[ "0.8996386", "0.8917922", "0.8851071", "0.8851071", "0.8851071", "0.8851071", "0.8824558", "0.8784457", "0.8637541", "0.8552219", "0.8500475", "0.8500475", "0.8500475", "0.8500475", "0.8500475", "0.8500475", "0.8487927", "0.84707946", "0.8445067", "0.84212524", "0.83829105", ...
0.8620829
10
test that we can mark more than one resource file that is part of a model program aggregation as a specific model program file type (e.g., software)
def test_mark_multiple_res_files_as_mp_file_type(composite_resource, mock_irods): res, user = composite_resource file_path = 'pytest/assets/{}' txt_file_path = file_path.format('generic_file.txt') vrt_file_path = file_path.format('logan.vrt') upload_folder = 'mp_folder' ResourceFile.create_fold...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mark_res_file_as_mp_file_type_failure_1(composite_resource, mock_irods):\n\n res, user = composite_resource\n file_path = 'pytest/assets/generic_file.txt'\n upload_folder = ''\n file_to_upload = UploadedFile(file=open(file_path, 'rb'),\n name=os.path.basename(f...
[ "0.70462394", "0.6993886", "0.6956276", "0.65077543", "0.64259875", "0.6191012", "0.59706336", "0.5962549", "0.5881162", "0.57660496", "0.57494575", "0.5555213", "0.55268186", "0.5523321", "0.54912806", "0.54545224", "0.5423029", "0.5394124", "0.5351198", "0.53439105", "0.534...
0.7488738
0
test that metadata form validation is NOT successful when metadata schema json file with invalid json schema is uploaded 'mi_schema_invalid.json' contains invalid value type for an attribute 'mi_schema_invalid_missing_title.json' missing 'title' attribute at the inner object level 'mi_schema_invalid_missing_additionalP...
def test_metadata_schema_json_invalid_file_upload(invalid_schema_file, mock_irods): schema_file_path = 'pytest/assets/{}'.format(invalid_schema_file) file_size = os.stat(schema_file_path).st_size assert file_size > 0 file_to_upload = UploadedFile(file=open(schema_file_path, 'rb'), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_metadata_schema_json_invalid(invalid_schema_file, mock_irods):\n\n schema_file_path = 'pytest/assets/{}'.format(invalid_schema_file)\n file_size = os.stat(schema_file_path).st_size\n assert file_size > 0\n file_to_upload = UploadedFile(file=open(schema_file_path, 'rb'),\n ...
[ "0.8340236", "0.79244566", "0.78442764", "0.74029845", "0.7071982", "0.7060269", "0.70045", "0.6925097", "0.68604314", "0.67076963", "0.6702599", "0.6613756", "0.6530918", "0.6522233", "0.65046114", "0.64806193", "0.6438153", "0.63915026", "0.6390635", "0.6384964", "0.6380938...
0.79802454
1
Generates a full directory path from a local path
def get_full_dir(self, path): full_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), path) if not os.path.exists(full_dir): os.makedirs(full_dir) return full_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def completePath(path):\n return os.getcwd() + convertString(path)", "def make_local_path(self, *args):\n return os.path.normpath(os.path.join(\n os.path.dirname(api.env.real_fabfile), *args).rstrip(os.path.sep))", "def localdir():\n root = __file__\n if os.path.islink(root):\n root =...
[ "0.68651825", "0.6813009", "0.67939574", "0.67695403", "0.6760823", "0.67346305", "0.66924006", "0.6676545", "0.66764385", "0.66740227", "0.6636628", "0.6595422", "0.6580359", "0.65780324", "0.6556433", "0.6550611", "0.65363395", "0.64925855", "0.64650834", "0.6442295", "0.63...
0.6622758
11
Creates a MLEngine training job.
def train(project_id, python_module=None, package_uris=None, region=None, args=None, job_dir=None, python_version=None, runtime_version=None, master_image_uri=None, worker_image_uri=None, training_input=None, job_id_prefix=None, wait_interval=30): if not training_input: training_input = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_training_job(TrainingJobName=None, HyperParameters=None, AlgorithmSpecification=None, RoleArn=None, InputDataConfig=None, OutputDataConfig=None, ResourceConfig=None, VpcConfig=None, StoppingCondition=None, Tags=None, EnableNetworkIsolation=None):\n pass", "def train(args):\n print(args)\n\n #...
[ "0.6775324", "0.63566697", "0.63522995", "0.6290437", "0.6252337", "0.6176657", "0.61395854", "0.6130863", "0.60432154", "0.5990268", "0.59689564", "0.5958073", "0.5956542", "0.5938882", "0.5922113", "0.5909557", "0.59087366", "0.58934045", "0.58740056", "0.5861276", "0.58488...
0.61483043
6
Determine if a position is inside the sphere
def isInside(self, position, maxDimLens): dim = len(position); deltas = [0] * dim; distSqr = 0; for i in range(0, dim): deltas[i] = math.fabs(position[i] - self.mSample[i]); if math.fabs(maxDimLens[i] - deltas[i]) < deltas[i]: deltas[i] = math.fabs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains(self, position):\n return np.linalg.norm(position - self._center) < self._radius", "def is_point_inside_hypersphere(point: np.array, c: List[float], r: float) -> bool:\n return np.linalg.norm(point - c) < r", "def intersects( self, sphere, dim ):\n nearest = self.__findFarestPoint__( ...
[ "0.7676418", "0.7215747", "0.7113888", "0.6813809", "0.6729059", "0.6713413", "0.6673091", "0.6614205", "0.6461593", "0.64517695", "0.6435828", "0.6418234", "0.6417305", "0.6388935", "0.6350988", "0.62861764", "0.62840956", "0.6279648", "0.62793344", "0.6255625", "0.62375295"...
0.6815435
3
Compares differente quantiles of dichotomization.
def dichotomize_plot(args): # Read the files. df = _parse_data(args) df["group"] = np.nan df["intercept"] = 1 df = df[["group", "intercept", "grs", args.phenotype]] # Init the statistical test. test = model_map[args.test]() qs = [] upper_ci = [] lower_ci = [] ns = [] b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantiles(self, q: int):\n return self.dist.quantiles(q)", "def test__quantile(self):\r\n # regular cases\r\n sample_data = array(range(25, 42))\r\n assert_almost_equal(_quantile(sample_data, 0.5), median(sample_data))\r\n\r\n # sorted data is assumed for this function\r\n ...
[ "0.6122129", "0.605095", "0.59829944", "0.58995926", "0.5646603", "0.56409997", "0.5626854", "0.55985636", "0.5588547", "0.55840945", "0.554937", "0.5505753", "0.5499198", "0.54492456", "0.5440881", "0.5425319", "0.54174876", "0.54053193", "0.5390248", "0.5340854", "0.5301277...
0.0
-1
find median point of pha postion
def find_med(x): total = 0 for ent in x: total += ent half = int(0.5 * total) sum = 0 for i in range(0, len(x)): sum += x[i] if sum > half: pos = i break return i - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def median(self):\n # TO DO\n pass", "def rec_median(p):\n\n if len(p) <= 2:\n return p[-1]\n\n\n return rec_median(p[1:-1])", "def median(points):\r\n\t\tN = len(points)\r\n\t\tif (N%2 == 0):\t\t\t\r\n\t\t\tleftOfCentre = points[N//2-1]\r\n\t\t\trightOfCentre = points[N//2]\r\n\t\t\...
[ "0.73820436", "0.7122121", "0.7102691", "0.7084111", "0.7026251", "0.70166135", "0.70045966", "0.6976317", "0.6966008", "0.6958685", "0.68997544", "0.6885769", "0.6860601", "0.68540686", "0.6851842", "0.6840501", "0.6826091", "0.68134207", "0.6812178", "0.6802533", "0.6792279...
0.0
-1
return the last update tim period
def last_updated() -> str: return GLOBAL.get("last_update")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dt_last_update(self):\n return self.last_update", "def get_last_update_time(self):\n return self.last_update_time", "def last_update_time(self):\n return self._last_update_time", "def last_update_datetime(self):\n return datetime.strptime(self.last_update, \"%Y-%m-%d %H:%M:%S....
[ "0.7845713", "0.77878016", "0.760516", "0.7324919", "0.7324919", "0.7281197", "0.7280159", "0.7240693", "0.7180655", "0.7180655", "0.7167405", "0.7167405", "0.71145153", "0.71074027", "0.7107103", "0.7043528", "0.703168", "0.703168", "0.703168", "0.703168", "0.703168", "0.7...
0.669778
37
Pad list of sentences according to the longest sentence in the batch.
def pad_sents(sents, pad_token): sents_padded = [] max_length = max([len(sent) for sent in sents]) sents_padded = [[sent[i] if i < len(sent) else pad_token for i in range(max_length)] for sent in sents] return sents_padded
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_sentence_batch(sentence_batch):\n max_sentence = max([len(sentence) for sentence in sentence_batch])\n return [sentence + [CODES['<PAD>']] * (max_sentence - len(sentence))\n for sentence in sentence_batch]", "def pad_sentences(sentences, padding_word=\"<PAD/>\"):\n # !!! 一定要注意这里会影响数据的...
[ "0.8136422", "0.7794564", "0.77663773", "0.7751513", "0.7725858", "0.759922", "0.7570084", "0.75679964", "0.7527899", "0.74936646", "0.7382935", "0.7376018", "0.727448", "0.7174443", "0.6994586", "0.6990048", "0.691479", "0.6855713", "0.68387455", "0.67224073", "0.66724813", ...
0.68112546
19
Read file, where each sentence is delineated by a `\n`.
def read_corpus(file_path, source): data = [] for line in open(file_path, encoding='utf-8'): sent = line.strip().split(' ') # only append <s> and </s> to the target sentence if source == 'tgt': sent = ['<s>'] + sent + ['</s>'] data.append(sent) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(input_file):\n with open(input_file, \"r\", encoding=\"utf-8-sig\") as f:\n sentences = f.read().splitlines()\n return sentences", "def _read_sentences(filename):\n with tf.gfile.GFile(filename, \"r\") as f:\n return [sentence.split() for sentence in f.read().split('\\n')]", ...
[ "0.7596553", "0.7383975", "0.6945084", "0.6945084", "0.69411993", "0.69377136", "0.69149745", "0.6895912", "0.6859256", "0.6841924", "0.68198746", "0.6806725", "0.6782659", "0.6735246", "0.6729122", "0.6711463", "0.66998816", "0.66980404", "0.66980404", "0.6667249", "0.662619...
0.0
-1
Returns a datetime object for today with hour/min zeroed out
def today(): today = datetime.utcnow() return datetime(today.year, today.month, today.day)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_today_start():\n return datetime.combine(datetime.today(), time.min)", "def today(cls):\n t = _time.time()\n return cls.fromtimestamp(t)", "def get_today_utc():\n return pytz.utc.localize(datetime.datetime.utcnow()).replace(\n hour=0, minute=0, second=0, microsecond=0\n )"...
[ "0.7258733", "0.71447605", "0.708929", "0.708929", "0.7002939", "0.68827033", "0.68435186", "0.67351913", "0.6714315", "0.6665891", "0.6656839", "0.6656476", "0.6653613", "0.6649227", "0.6629721", "0.6629316", "0.66198295", "0.6601344", "0.6597767", "0.6592813", "0.6586696", ...
0.7432245
0
Close connection after closing the 'with' statement.
def __exit__(self, exc_type, exc_value, traceback): if self._close_on_exit: self.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_connection(self):\n self.conn.close()", "def close_connection(self):\n self.connection.close()", "def close_connection(self):\n self.connection.close()", "def close(self): \n self.connection.close()", "def close_connection(self):\n self.cursor.close()\n s...
[ "0.7871941", "0.78196836", "0.78196836", "0.7781018", "0.7769569", "0.77576584", "0.775178", "0.7744593", "0.7744593", "0.7744593", "0.77400625", "0.77209246", "0.77209246", "0.77209246", "0.77209246", "0.77209246", "0.77209246", "0.77209246", "0.7690833", "0.7686226", "0.768...
0.0
-1
Close connection when deleting the object.
def __del__(self): if self._close_on_exit: self.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self): \n self.connection.close()", "def close(self):\n self.conn.close()\n self.destroy()", "def close(self): \n\t\tself.connection = None", "def _close_connection(self):\n if self.connection:\n self.connection.destroy()\n self.connection = None", ...
[ "0.7772908", "0.7762111", "0.76967174", "0.7691672", "0.7682209", "0.7664887", "0.7607287", "0.75830513", "0.75830513", "0.75356317", "0.74889314", "0.74889314", "0.74889314", "0.74879533", "0.74728984", "0.74728984", "0.74728984", "0.74728984", "0.74728984", "0.74728984", "0...
0.0
-1
Returns True for primes, False for nonprimes and raises ValueError for unsure cases.
def is_miller_rabin_prime(n): if n <= 1: return False elif n == 2: return True elif n % 2 == 0: return False witnesses = get_witnesses(n) if witnesses is None: msg = 'No definite Miller-Rabin test is available for %d' % n raise ValueError(msg) d,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_prime(self, num):\n if num == 2:\n return True\n if num < 2 or num % 2 == 0:\n return False\n for n in range(3, int(num ** 0.5) + 2, 2):\n if num % n == 0:\n return False\n return True", "def is_prime(num: int) -> bool:\n retu...
[ "0.76138324", "0.7479921", "0.7414875", "0.7398994", "0.7391586", "0.73824173", "0.7380472", "0.73761046", "0.736995", "0.7367905", "0.73662955", "0.73622805", "0.7354309", "0.7345719", "0.73420525", "0.73396", "0.7336232", "0.7317688", "0.7303062", "0.72980136", "0.7295776",...
0.0
-1
Serializes this instance to a Python dictionary.
def to_dict(self): output = copy.deepcopy(self.__dict__) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return dumpd(self)", "def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data", "def to_dict(self):\n return to_dict(self.__dict__)", "def to_dict(self):\r\n return self.__dict__", "def to_dict(self):\n return s...
[ "0.8421195", "0.84043926", "0.8362277", "0.83090377", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.8236021", "0.82179517", "0.82133806", "0.82032114", "0.8181652", "0.8179579", "0.81732064", "0.81534773", "0.8118078", "0.8090142", "0....
0.0
-1
Serializes this instance to a JSON string.
def to_json_string(self): return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self) -> str:\n return json.dumps(self.__dict__)", "def serialize(self):\n return json.dumps(self.as_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> st...
[ "0.88999254", "0.8837045", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.87147456", "0.8637419", "0.8619328", "0.8598524", "0.8572258", "0.8568808", "0.8568808", "0.8446259", "0.8446259", "0.8446259", ...
0.0
-1
Instantiate a UniterPreTrainedModel from a pretrained model file or a pytorch state dict.
def from_pretrained(cls, config_file, state_dict, *inputs, **kwargs): config = cls.load_config(config_file) # Instantiate model. model = cls(config, *inputs, **kwargs) model = load_pretrained_weight(model, state_dict) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_pretrained(cls, config_file, state_dict, *inputs, **kwargs):\n # Load config\n config = UniterConfig.from_json_file(config_file)\n logger.info(\"Model config {}\".format(config))\n # Instantiate model.\n model = cls(config, *inputs, **kwargs)\n # Load from a PyTor...
[ "0.7449173", "0.7408204", "0.71856666", "0.69886196", "0.69273704", "0.6786378", "0.6697608", "0.66961324", "0.66773605", "0.6667225", "0.66602", "0.66337097", "0.66125387", "0.6599009", "0.65459657", "0.65408367", "0.64369977", "0.6427597", "0.64250845", "0.64240134", "0.642...
0.7752374
0
Take in image and sigma Threshold image by setting all values in it less than 1 to zero Get the mean and standard deviation of remaining pixels Find best threshold value and threshold image using it Output the mean, standard deviation, best threshold, and number of pixels left after thresholding
def threshold(image, sigma): image[image<1] = 0 mean = np.mean(image[image>=1]) std = np.std(image[image>=1]) if (sigma == 0): thresh = mean + 0.5*std else: thresh = min(mean + 0.5*std, 30/sigma) image[image>thresh] = 255 image[image<=thresh] = 0 numAfterThresh = (image>0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _threshold(data, sigma=2.0):\r\n return np.mean(data)-sigma*np.sqrt(np.var(data))", "def imthresh(img):\n img_vecs = img.flatten()\n\n # pre-calculate the histogram and cumulative histogram.\n vbins = np.arange(0, 257, 1)\n img_hist, hist_edges = np.histogram(img_vecs, vbins)\n vbins = (his...
[ "0.70550203", "0.6948062", "0.68462604", "0.6699616", "0.6623108", "0.66059816", "0.6586835", "0.6585425", "0.6575665", "0.65531975", "0.6522562", "0.6298689", "0.6280009", "0.6257231", "0.625239", "0.6237076", "0.62332165", "0.62279356", "0.6162726", "0.6154294", "0.6136345"...
0.7945116
0
Make layer define support indicating block, by which we can add layers to other blocks within current block. This will make it easy to define cache among while loop.
def wrap_layer_with_block(layer, block_idx): class BlockGuard(object): """ BlockGuard class. BlockGuard class is used to switch to the given block in a program by using the Python `with` keyword. """ def __init__(self, block_idx=None, main_program=None): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_block(_input, growth_rate, layers_per_block, bc_mode, name, is_training):\n output = _input\n for layer in range(layers_per_block):\n with tf.variable_scope(\"%s_layer_%d\" % (name, layer)):\n output = add_internal_layer(output, growth_rate, bc_mode=bc_mode, is_training=is_training...
[ "0.67247957", "0.6588435", "0.6543925", "0.65137106", "0.6328523", "0.6280728", "0.6213091", "0.6132301", "0.6131052", "0.6113549", "0.6065623", "0.5955878", "0.5955738", "0.59523535", "0.5927967", "0.59167486", "0.59165007", "0.5876815", "0.58435446", "0.5815605", "0.5787371...
0.66206586
1
Add residual connection, layer normalization and droput to the out tensor optionally according to the value of process_cmd. This will be used before or after multihead attention and positionwise feedforward networks.
def pre_post_process_layer(prev_out, out, process_cmd, dropout_rate=0.): for cmd in process_cmd: if cmd == "a": # add residual connection out = out + prev_out if prev_out else out elif cmd == "n": # add layer normalization out = layers.layer_norm( out, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, inp, context, state, no_attention=False):\n # Args Check\n assert isinstance(state, RNNDecoderState)\n # END Args Check\n\n if self.embeddings is not None:\n if self.training and (self.dropword > 0):\n emb = embedded_dropout(\n ...
[ "0.50314844", "0.5027919", "0.5027919", "0.5027919", "0.5027919", "0.5027919", "0.5023997", "0.49301627", "0.49160066", "0.49022043", "0.4867009", "0.48465943", "0.48367587", "0.48260394", "0.48234892", "0.4807901", "0.48033473", "0.47996002", "0.47398525", "0.47173193", "0.4...
0.6888706
0
The encoder layers that can be stacked to form a deep encoder. This module consits of a multihead (self) attention followed by positionwise feedforward networks and both the two components companied with the post_process_layer to add residual connection, layer normalization and dropout.
def encoder_layer(enc_input, attn_bias, n_head, d_key, d_value, d_model, d_inner_hid, pos_enc, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd='n', postprocess_cmd='da'): attn_output = multi_head_attention( pre_process_layer(enc_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encoder(enc_input, attn_bias, n_layer, n_head,\n d_key, d_value, d_model, d_inner_hid, pos_enc,\n preporstprocess_dropout, attention_dropout,\n relu_dropout, preprocess_cmd='n',\n postprocess_cmd='da'):\n for i in range(n_layer):\n enc_output = encoder_layer(enc_input, attn_bias, n_head,\...
[ "0.7050492", "0.6768612", "0.65808505", "0.6488075", "0.6311925", "0.6254386", "0.6211635", "0.6154522", "0.61462504", "0.6140269", "0.6116112", "0.6091246", "0.60645956", "0.6058146", "0.60328686", "0.6032022", "0.5950533", "0.5939682", "0.59264255", "0.5922735", "0.5914922"...
0.68311894
1
return a list physical channels, organized by task type, available on the specified device
def getPhysicalChannels(device): d = {} for taskType in TASK_TYPES.keys(): channels = create_string_buffer(BUF_SIZE) daqmx( getattr( dll, { AI:'DAQmxGetDevAIPhysicalChans', DO:'DAQmxGetDevDOLines', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_physical_output_channels(self):\r\n bufsize = 1024\r\n buf = ctypes.create_string_buffer(bufsize)\r\n NIDAQ_dll.DAQmxGetDevAOPhysicalChans(self.dev_id.encode('ascii'),\r\n ctypes.byref(buf), bufsize)\r\n channel_list = buf_to_list(buf)\r\n channel_list = [chann...
[ "0.6892478", "0.65292484", "0.63059515", "0.616183", "0.61413366", "0.5998109", "0.59924364", "0.59193665", "0.5911354", "0.5905511", "0.588262", "0.5881924", "0.5879943", "0.5866118", "0.58659405", "0.5853805", "0.5838373", "0.58266187", "0.5817893", "0.5772668", "0.576664",...
0.8054605
0
Splits text into words
def split_text(self, text): for match in self.word_pattern.finditer(text): word = match.group(0) yield word.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_words(text : str) -> list:\n command_text = text.strip()\n commands = command_text.split(' ')\n return commands", "def txt_to_word_list(text):\r\n return [w for w in text.split()]", "def tokenize(text):\n return text.split(' ')", "def separate_words(text):\n splitter = re.compile('\\...
[ "0.815397", "0.80101347", "0.79730785", "0.7970261", "0.7873083", "0.77823585", "0.77194995", "0.76753116", "0.7668753", "0.75890994", "0.7572082", "0.7551474", "0.75231594", "0.75201476", "0.75201476", "0.75144386", "0.7513403", "0.7508262", "0.75078595", "0.74926454", "0.74...
0.74916595
20
Splits text into words, including rules for Japanese
def split_japanese_text(self, text): for match in self.word_pattern.finditer(text): word = match.group(0) got_japanese = False for m in self.jword_pattern.finditer(word): w = m.group(0) got_japanese = True yield w.lower() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n # words = re.split(\"[\\s\\-,;:!?.’\\'«»()–...&‘’“”*—]+\", text)\n # words = re.split(\"[^a-zåàâäæçéèêëîïôöœßùûüÿA-ZÅÀÂÄÆÇÉÈÊËÎÏÔÖŒÙÛÜŸ’\\-]+\", text)\n # words = re.split(\"\\W+\", text)\n words = regex.split(\"\\P{L}+\", text)\n words.remove('')\n return words", "def _sp...
[ "0.72248644", "0.7152168", "0.7022537", "0.6961141", "0.69365335", "0.69365335", "0.6836622", "0.6808707", "0.6801311", "0.6772724", "0.67580986", "0.6729034", "0.67285365", "0.671696", "0.6708951", "0.6644046", "0.6601308", "0.6558605", "0.6557736", "0.65184504", "0.6510726"...
0.80143255
0
Generates the lookup table for the given colormap by converting it into an exposure value based colormap with segments of constant color between the exposure values.
def generate_lut(self): colormap = self.get_colormap() if self.block_type == "equidistant": ev_colormap = colors.colormap_to_ev_blocks_equidistant(colormap, self.exposure_values) if self.test: self.print_colormap(self.name, ev_colormap) return self.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_colormap(scale_range=(0.0, 1.0), hue_range=(0.8, 0.0),\n saturation_range=(1.0, 1.0), value_range=(0.8, 0.8),\n nan_color=(0.2, 0.2, 0.2, 1.0)):\n lookup_table = vtk.vtkLookupTable()\n lookup_table.SetRange(scale_range)\n\n lookup_table.SetHueRange(hu...
[ "0.7303778", "0.7040395", "0.6427566", "0.6404606", "0.6360811", "0.6239195", "0.623619", "0.6169921", "0.60696125", "0.60527265", "0.5963544", "0.5958866", "0.5930426", "0.5913639", "0.5880814", "0.5880685", "0.5842646", "0.5836245", "0.5834642", "0.582218", "0.58138597", ...
0.57008207
30
Retrieve the predefined colormap by name.
def get_colormap(self): return colors.colormaps[self.name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cmap(n, name='Paired'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name=\"hsv\"):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name=\"hsv...
[ "0.7409573", "0.73548424", "0.73548424", "0.7300423", "0.7300423", "0.7300423", "0.7278494", "0.7211739", "0.7176548", "0.7176548", "0.71543515", "0.70866925", "0.70656973", "0.65708816", "0.6507084", "0.6461534", "0.6318054", "0.6283044", "0.6280156", "0.62510324", "0.620428...
0.7490427
0
Retrieve the predefined colormap by name.
def get_colormap(self): return colors.colormaps[self.name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cmap(n, name='Paired'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name=\"hsv\"):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name=\"hsv...
[ "0.7409573", "0.73548424", "0.73548424", "0.7300423", "0.7300423", "0.7300423", "0.7278494", "0.7211739", "0.7176548", "0.7176548", "0.71543515", "0.70866925", "0.70656973", "0.65708816", "0.6507084", "0.6461534", "0.6318054", "0.6283044", "0.6280156", "0.62510324", "0.620428...
0.7490427
1
Retrieve the predefined colormap by name.
def get_colormap(self): return colors.ev_colormaps[self.name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colormap(self):\n return colors.colormaps[self.name]", "def get_colormap(self):\n return colors.colormaps[self.name]", "def get_cmap(n, name='Paired'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name='hs...
[ "0.7490427", "0.7490427", "0.7409573", "0.73548424", "0.73548424", "0.7300423", "0.7300423", "0.7300423", "0.7278494", "0.7211739", "0.7176548", "0.7176548", "0.71543515", "0.70656973", "0.65708816", "0.6507084", "0.6461534", "0.6318054", "0.6283044", "0.6280156", "0.62510324...
0.70866925
13
Asks users to specify a city, month, and day to analyze.
def get_filters(city, month, day): print ('Hello! Let\'s explore major US bikeshare data!') print ('') #Get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs t.sleep(1) while True: print ("Which city bikeshare data would you like to exp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid input\n city = input(\"Please enter a city name (either Chicago, New York City, or Washington...
[ "0.6490296", "0.6469192", "0.646629", "0.640517", "0.6277179", "0.6266183", "0.62180245", "0.62039465", "0.61836904", "0.61828834", "0.615647", "0.6150937", "0.6134648", "0.6114013", "0.6112215", "0.6107634", "0.6088318", "0.60835725", "0.60666555", "0.60640734", "0.60595864"...
0.6296596
4
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): df = pd.read_csv(CITY_DATA[city]) # convert the Start Time column to datetime df['Start Time'] = pd.to_datetime(df['Start Time']) # extract month and day of week from Start Time to create new columns df['month'] = df['Start Time'].dt.month df['day_of_week'] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.813227", "0.8108956", "0.8046483", "0.8042587", "0.8009157", "0.80073005", "0.7999508", "0.7998818", "0.79889566", "0.7979226", "0.7973997", "0.7961329", "0.79560906", "0.7947187", "0.794649", "0.7908341", "0.79083204", "0.7904475", "0.79011774", "0.78934294", "0.7889157",...
0.773446
55
Displays statistics on the most frequent times of travel.
def time_stats(df): start_time = t.time() print('\nCalculating The Most Frequent Times of Travel...\n') print('') #display the most common month df['month'] = df['Start Time'].dt.month common_month = df['month'].mode()[0] print('Most Common Month:', common_month) print('') #disp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.72590244
62
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') print('') start_time = t.time() #display most commonly used start station common_start_station = df['Start Station'].mode()[0] print('Most Common Start Station:', common_start_station) print('') #di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7446617", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198...
0.71974987
45
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = t.time() #display total travel time total_travel_time = df['Trip Duration'].sum() print('Total Travel Time:', total_travel_time) print('') #display mean travel time average = df['Trip Duration'].mean(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664047", "0.78637...
0.79312176
5
Returns the current URL. Overrides the get_success_url() method from FormMixin.
def get_success_url(self): return self.request.path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_success_url(self):\n if not self.success_url:\n return self.request.get_full_path()\n return str(self.success_url) # success_url may be lazy", "def get_success_url(self):\n return \"/\"", "def get_success_url(self):\n redirect_to = self.request.POST.get(\n ...
[ "0.8428088", "0.8017619", "0.78931075", "0.78586787", "0.7852564", "0.7831419", "0.7831419", "0.77940875", "0.77872145", "0.7664778", "0.7481129", "0.7481129", "0.7440957", "0.7393924", "0.7393924", "0.73865545", "0.7338085", "0.7335498", "0.72844887", "0.72448987", "0.714269...
0.8559865
0
cast(itkLightObject obj) > itkTranslationTransformD2
def cast(*args): return _itkTranslationTransformPython.itkTranslationTransformD2_cast(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itkTranslationTransformD2_cast(*args):\n return _itkTranslationTransformPython.itkTranslationTransformD2_cast(*args)", "def cast(obj: 'itkLightObject') -> \"itkTransformMeshFilterMF2MF2TD22 *\":\n return _itkTransformMeshFilterPython.itkTransformMeshFilterMF2MF2TD22_cast(obj)", "def itkTransformMes...
[ "0.7556705", "0.7319468", "0.7263547", "0.71866786", "0.71708506", "0.70838493", "0.70073104", "0.6983911", "0.6921514", "0.69192207", "0.69118744", "0.6900197", "0.6827894", "0.6786297", "0.6783528", "0.6767709", "0.6761131", "0.67447156", "0.67356986", "0.67321867", "0.6712...
0.7159851
5
New() > itkTranslationTransformD2 Create a new object of the class itkTranslationTransformD2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first i...
def New(*args, **kargs): obj = itkTranslationTransformD2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def New(*args, **kargs):\n obj = itkTranslationTransformD3.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkFixedCenterOfRotationAffineTransformD2.__New_orig__()\n import itkTemplate\n i...
[ "0.703179", "0.66397816", "0.6597056", "0.65577626", "0.6525702", "0.6423441", "0.6415379", "0.64147806", "0.64062786", "0.6405842", "0.63955605", "0.63809013", "0.6376024", "0.63481075", "0.63425213", "0.6339997", "0.6339519", "0.6327207", "0.6297869", "0.6276098", "0.624051...
0.8122325
0
itkTranslationTransformD2_cast(itkLightObject obj) > itkTranslationTransformD2
def itkTranslationTransformD2_cast(*args): return _itkTranslationTransformPython.itkTranslationTransformD2_cast(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cast(*args):\n return _itkTranslationTransformPython.itkTranslationTransformD2_cast(*args)", "def itkTransformMeshFilterMF2MF2TD22_cast(obj: 'itkLightObject') -> \"itkTransformMeshFilterMF2MF2TD22 *\":\n return _itkTransformMeshFilterPython.itkTransformMeshFilterMF2MF2TD22_cast(obj)", "def cast(o...
[ "0.76338136", "0.7338113", "0.73033637", "0.7201394", "0.70971924", "0.7069835", "0.70591515", "0.69016397", "0.689099", "0.68713164", "0.68585527", "0.6846654", "0.6831436", "0.683131", "0.6809433", "0.679869", "0.6777118", "0.6773623", "0.6771755", "0.67601067", "0.67145216...
0.8131376
0
cast(itkLightObject obj) > itkTranslationTransformD3
def cast(*args): return _itkTranslationTransformPython.itkTranslationTransformD3_cast(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itkTranslationTransformD3_cast(*args):\n return _itkTranslationTransformPython.itkTranslationTransformD3_cast(*args)", "def cast(obj: 'itkLightObject') -> \"itkTransformMeshFilterMF3MF3TD33 *\":\n return _itkTransformMeshFilterPython.itkTransformMeshFilterMF3MF3TD33_cast(obj)", "def cast(obj: 'itkL...
[ "0.766628", "0.75121236", "0.7473594", "0.74368507", "0.7404932", "0.73654026", "0.73623025", "0.7347781", "0.73212856", "0.7307046", "0.7184276", "0.7153282", "0.71521467", "0.71357024", "0.71341586", "0.7117586", "0.7108286", "0.7062224", "0.7048733", "0.70321876", "0.69932...
0.740517
4
New() > itkTranslationTransformD3 Create a new object of the class itkTranslationTransformD3 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parameter in the first i...
def New(*args, **kargs): obj = itkTranslationTransformD3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def New(*args, **kargs):\n obj = itkShapePriorMAPCostFunctionBaseID3D.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkFixedCenterOfRotationAffineTransformD3.__New_orig__()\n import itkTemplate...
[ "0.7106851", "0.7064593", "0.70041627", "0.69303817", "0.68049735", "0.66979486", "0.6641892", "0.6635077", "0.66207814", "0.6612819", "0.6612485", "0.6611237", "0.6590533", "0.65677965", "0.6540002", "0.6531253", "0.6529736", "0.651588", "0.6500529", "0.6499144", "0.64930344...
0.82111233
0
itkTranslationTransformD3_cast(itkLightObject obj) > itkTranslationTransformD3
def itkTranslationTransformD3_cast(*args): return _itkTranslationTransformPython.itkTranslationTransformD3_cast(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cast(*args):\n return _itkTranslationTransformPython.itkTranslationTransformD3_cast(*args)", "def itkTransformMeshFilterMF3MF3TD33_cast(obj: 'itkLightObject') -> \"itkTransformMeshFilterMF3MF3TD33 *\":\n return _itkTransformMeshFilterPython.itkTransformMeshFilterMF3MF3TD33_cast(obj)", "def cast(o...
[ "0.7905629", "0.7560646", "0.755935", "0.75003815", "0.7500346", "0.74629796", "0.74321926", "0.74219507", "0.73994786", "0.73736733", "0.7343118", "0.7311387", "0.73111176", "0.72506064", "0.7198958", "0.71677595", "0.7119363", "0.7118002", "0.71081364", "0.7077587", "0.7061...
0.8307455
0
Tests whether the actor network output is in [1, 1] and if the fully connected hidden layers have the expected shapes.
def test_actor(input_dim, hidden_dim, output_dim): x = np.random.randn(1, input_dim) model = Actor(hidden_dim=hidden_dim, output_dim=output_dim) output = model(x) assert np.all((-1 <= output) & (output <= 1)) w1, b1 = model.layers[0].weights assert w1.shape == (input_dim, hidden_dim) asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shapes_coupling_out(self):\n\n out_single = self.coupling_net_odd(self.x_single_odd, self.y_single)\n out_batch = self.coupling_net_odd(self.x_batch_odd, self.y_batch)\n\n self.assertEqual(out_single.shape[0], 1,\n 'Batch shape mismatch on single instance in Co...
[ "0.6615376", "0.6615376", "0.6514336", "0.63295144", "0.62719893", "0.61876595", "0.61392915", "0.6077531", "0.6067687", "0.60612315", "0.60315317", "0.6025946", "0.6024337", "0.60147583", "0.60091263", "0.5999575", "0.59833384", "0.5983216", "0.5970706", "0.5939327", "0.5929...
0.62132126
5
Tests if the critic fully connected hidden layers have the expected shapes and if the output shape is 1.
def test_critic(input_dim, hidden_dim): x = np.random.randn(1, input_dim) model = Critic(hidden_dim=hidden_dim) output = model(x) assert output.shape[-1] == 1 w1, b1 = model.layers[0].weights assert w1.shape == (input_dim, hidden_dim) assert b1.shape == (hidden_dim, ) w2, b2 = model.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testShapesNotKnown(self, use_bias):\n\n inputs = tf.placeholder(\n tf.float32, shape=[None, None, self.in_channels], name=\"inputs\")\n\n conv1 = snt.SeparableConv1D(\n output_channels=self.out_channels_dw,\n channel_multiplier=1,\n kernel_shape=self.kernel_shape,\n pad...
[ "0.6748005", "0.663752", "0.6573284", "0.65732056", "0.6514872", "0.6449387", "0.6449387", "0.6434012", "0.64133495", "0.639402", "0.6386882", "0.6282206", "0.6195157", "0.6186938", "0.6172603", "0.6169555", "0.6154882", "0.6144745", "0.6111106", "0.6109963", "0.6107308", "...
0.6250362
12
Lists all templeton projects registered with the server.
def cmd_list(self): rc = self.socket_command('list', False) return rc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_list(self):\n try:\n ids = self.request[api.DATA][api.DATA][\"ids\"]\n return self._get_keystone_projects(ids)\n except Exception as e:\n LOG.exception(\"Error occurred: %s\" % e)", "def get_all_projects():\n return jsonify(admin.get_all_projects(curr...
[ "0.7362087", "0.7164307", "0.7081578", "0.7012683", "0.69548386", "0.6953414", "0.69448423", "0.6869585", "0.6846219", "0.6829424", "0.6826819", "0.6821558", "0.68132687", "0.68089724", "0.67415524", "0.6739691", "0.67349297", "0.67178476", "0.6702765", "0.6689901", "0.668423...
0.0
-1
Translates an ABEL concrete model into a Google Sheets spreadsheet.
def WriteAllSheets( self, spreadsheet_range: List[str], spreadsheet_id: str, model_dict: Dict[str, Dict[str, str]], google_sheets_service: Resource, ) -> str: sheet = google_sheets_service.spreadsheets() for named_range in spreadsheet_range: body_value_range = {BODY_VALUE_R...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_sheet(filename, output):\n r2dt.write_converted_sheet(filename, output)", "def render_sheet(self, sheet, **keywords):\n raise NotImplementedError(\"Please render sheet\")", "def to_spreadsheet(self) -> sc.Spreadsheet:\n\n f, wb = self.to_workbook()\n wb.close() # Close the ...
[ "0.56238353", "0.5439971", "0.54117864", "0.5308936", "0.5243993", "0.5241903", "0.5223601", "0.5220915", "0.5194396", "0.5178439", "0.51682335", "0.51645464", "0.508737", "0.507263", "0.50715816", "0.5043166", "0.5035793", "0.5028144", "0.5010262", "0.4990161", "0.4971268", ...
0.0
-1
Create Donor class for data and methods for individual donor.
def __init__(self, name, donations=None): self.name = name.strip() if donations is None: self.donations = [] else: self.donations = list(donations)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, donors=None):\n if donors is None:\n self.donor_info = {}\n else:\n for donor in donors:\n self.donor_info.update({donor.name: donor})", "def __init__(self, donor_name, donation):\n if isinstance(donor_name, str):\n self._ful...
[ "0.70832646", "0.6853864", "0.65485823", "0.6510807", "0.650939", "0.6328459", "0.6275997", "0.6271004", "0.6130031", "0.602168", "0.6004476", "0.59834886", "0.5912264", "0.5768228", "0.5727698", "0.5690377", "0.5577748", "0.5549967", "0.5520104", "0.5485374", "0.5471684", ...
0.58277076
13
Average donation is total donations divided by the number of donations.
def avg_donation(self): return self.tot_donations / self.num_donations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_donation(self):\n return self.total_donations()/self.num_donations() if self.donations else 0", "def avg_donation(self):\n return self._total_donation / self.num_of_donations", "def donation_avg(donor_list, donor):\n return sum(donor_list[donor]) // len(donor_list[donor])", "def ...
[ "0.87501204", "0.871083", "0.83597827", "0.82224464", "0.8117601", "0.6982841", "0.6893254", "0.6586632", "0.6586632", "0.64242506", "0.6386025", "0.6373736", "0.6304188", "0.62922037", "0.6185901", "0.6184886", "0.614711", "0.6145502", "0.61421347", "0.61271805", "0.6100934"...
0.87952405
0
Return the instance of PyTorch distribution.
def dist(self): return self._dist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distribution_torch_class(self):\n raise NotImplementedError()", "def get_distribution(self, name: str) -> Optional[\"BaseDistribution\"]:\n raise NotImplementedError()", "def get_distribution(self):\n return self._delegate.flush_distributions()", "def __init__(self, distribution=None...
[ "0.73724866", "0.6194373", "0.58922094", "0.58143914", "0.5802228", "0.5784864", "0.5761803", "0.576023", "0.57563967", "0.57547724", "0.5725843", "0.565038", "0.56399703", "0.5628168", "0.5627431", "0.558425", "0.5548808", "0.55384797", "0.5524423", "0.55174196", "0.54801357...
0.53394246
33
Voegt item toe aan de lijst, op de gegeven index. Deze index moet aan 1<=index<=count+1 voldoen om het item te kunnen toevoegen.
def insert(self, index, item): if 1 <= index <= self.count + 1: if self.count == 0: #laat item naar zichzelf wijzen, zodat als er een tweede item komt er een circulaire ketting gevormd kan worden self.head.next = item item.next = item if index == 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item(self,index):\n current = self.head\n count = 0\n \n while current != None and count <= index:\n count+=1\n current =current.get_next()\n \n if count!=index:\n print('Index out of bound')", "def delete(self, index):\n if not 1 <= index <= se...
[ "0.63776493", "0.6250557", "0.5967538", "0.5967538", "0.59658706", "0.5900728", "0.5887452", "0.58847046", "0.585766", "0.58567476", "0.58184797", "0.5816815", "0.579609", "0.5701324", "0.56801444", "0.56339586", "0.5619567", "0.56071615", "0.5597143", "0.5595114", "0.5590613...
0.59585243
5
Creates a dataset of records from articles.
def create_article_dataset(record_list, dataset_dir, sess, validation_size=10, eval_every=100, input_feature='text', max_input_sequence_length=Article.max_text+2, target_feature='short_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dataset(arguments):\n connections.create_connection(hosts=ES_HOSTS, timeout=9999, http_auth=ES_LOGIN)\n time_start = time.time()\n\n # cleanup of the invalid dataset duplicate links\n if arguments.clean:\n dataset_source_cleanup()\n\n # reset dataset assignments of posts with given r...
[ "0.6200548", "0.6164453", "0.61159587", "0.6081186", "0.60786146", "0.5958662", "0.5953719", "0.5940181", "0.5883103", "0.58591676", "0.58562887", "0.58445096", "0.58371985", "0.5814134", "0.5790648", "0.5749707", "0.57411146", "0.569952", "0.56949955", "0.5688389", "0.567303...
0.62995464
0
Returns a chessboard image of given size and dimension.
def make_chessboard(screen_res, chess_dim, orig_name='chess.png', inv_name='chess_inv.png', noboarder=False): dim_pxl = min(screen_res[0]/chess_dim[0], screen_res[1]/chess_dim[1]) if noboarder: board = 255*np.ones((chess_dim[1]*dim_pxl, chess_dim[0]*dim_pxl), dtype=np.uint8) else: board = 255*np.ones((screen_res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_chessboard(size=8):\n r1 = (WHITE + BLACK) * int((size / 2)) + \"\\n\"\n r2 = (BLACK + WHITE) * int((size / 2)) + \"\\n\"\n print((r1 + r2) * int((size / 2)))", "def create_chessboard(size=8):\r\n\r\n def _create_even_line(size):\r\n return ''.join([WHITE if i % 2 else BLACK for i in r...
[ "0.69238985", "0.6624589", "0.65290564", "0.64812213", "0.59723836", "0.5835622", "0.57600087", "0.566467", "0.5569089", "0.5508355", "0.55034304", "0.54062676", "0.53410053", "0.5319905", "0.5317852", "0.531204", "0.53048563", "0.52968305", "0.5296394", "0.5286427", "0.52861...
0.5887385
5
Appends '/vsizip/' to the filename path.
def prepare_zip(self, filename, *args, **kwargs): return '/vsizip/' + filename, args, kwargs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputFilepath(self, filename):\n return os.path.expanduser('~') + '/' + filename", "def get_aug_path(file_path: str) -> str:\n return \"/files%s\" % file_path", "def __make_path(self, filename):\n return self.__path() + os.sep + filename", "def makefilename(self):\n fp= (pathlib....
[ "0.5847951", "0.58207726", "0.5620992", "0.55988735", "0.5518194", "0.5496068", "0.54822254", "0.5422709", "0.5406952", "0.5402478", "0.5392045", "0.53632075", "0.53592926", "0.5327587", "0.5326146", "0.52964514", "0.52950275", "0.52624035", "0.52558327", "0.52489614", "0.522...
0.5203739
24
Plotting function I found on Google. Plots the predictions and outputs as two sets of points on a 3D Scatterplot.
def plot_linear(output, input, target): fig = plt.figure() ax = fig.add_subplot(projection = '3d') feature1 = input[:, 1].detach() feature2 = input[:, 2].detach() predictions = output[0].detach() targets = target modelPreds = ax.scatter(feature1, feature2, predictions, c='b', marker='o') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_results_traj_3d(p_x, p_y, p_z, xmin, xmax, ymin, ymax, zmin, zmax):\n fig, ax = plt.subplots(2 , 2, figsize = (10, 10))\n \n for p in np.arange(0, p_x.shape[0], step = 1): \n for t in np.arange(0, p_x.shape[1], step = 1): \n ax[0,0].plot(t, p_x[p, t], 'rx') \n ax[0...
[ "0.6836642", "0.6636913", "0.6620208", "0.6516375", "0.64960784", "0.6484922", "0.64800656", "0.64201003", "0.6391897", "0.63565636", "0.63224256", "0.6300995", "0.6282255", "0.6240175", "0.6240175", "0.6239326", "0.62348354", "0.6231968", "0.6213265", "0.61508834", "0.614017...
0.66523916
1
Define the derivative of x.
def dx(x, t, S): f = S @ x phi = f @ x return x * (f - phi)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _derivative_(self, x, diff_param=None):\n return 2*exp(-x**2)/sqrt(pi)", "def dalf(x):\n return derivative(alf, x, dx=1e-6)", "def calculate_derivative_value(self, x: np.array) -> np.array:\n pass", "def __call__ ( self , x ) :\n return derivative ( self.__func ,\n ...
[ "0.8144563", "0.7888615", "0.7862487", "0.7851155", "0.78112954", "0.7783756", "0.7783756", "0.77379274", "0.76525706", "0.7496501", "0.7333609", "0.72195107", "0.72195107", "0.7145739", "0.7110477", "0.71072733", "0.70933956", "0.7050031", "0.6968151", "0.6933234", "0.692909...
0.0
-1
Onedimensional subpixel upsampling layer Calls a tensorflow function that directly implements this functionality. We assume input has dim (batch, width, r)
def call(self, I): X = tf.transpose(I, [2,1,0]) # (r, w, b) X = tf.batch_to_space_nd(X, [self.r], [[0,0]]) # (1, r*w, b) X = tf.transpose(X, [2,1,0]) return X
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upsample_2d(x, size=(2, 2)):\n h, w, _ = x.get_shape().as_list()[1:]\n size_x, size_y = size\n output_h = h * size_x\n output_w = w * size_y\n return tf.image.resize_bilinear(x, (output_h, output_w), align_corners=None, name='upsampling')", "def model_with_upsample2d():\n inputs = tf.keras....
[ "0.734476", "0.7191246", "0.7027978", "0.69656485", "0.67275125", "0.65831614", "0.6487901", "0.6411993", "0.63775414", "0.63259155", "0.63235253", "0.6268788", "0.6246565", "0.61918426", "0.6159759", "0.6126274", "0.6117427", "0.6115078", "0.6093789", "0.6068889", "0.6054778...
0.0
-1
`_metric_from_name` is supposed to raise ValueError when one gives it a nonexistent metric name.
def test_metric_from_name_nonexistent(self): with pytest.raises(ValueError): _metric_from_name("nonexistent_metric")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_metric(name):\n try:\n return metrics.metric(name)\n except InvalidMetricError:\n return None", "def get_metric(name):\n return metric_name_to_function_mapping[name.lower()]", "def get_metric(self, metric_name):\n return getattr(self, metric_name, None)", "def get_metri...
[ "0.73785883", "0.6815165", "0.66558945", "0.6552036", "0.6542573", "0.64841473", "0.6221928", "0.6182753", "0.6105671", "0.6066005", "0.6066005", "0.6066005", "0.6066005", "0.6066005", "0.6066005", "0.6066005", "0.6066005", "0.6066005", "0.601666", "0.59632194", "0.59584546",...
0.8295462
0
Process a given frame and return all nonzero values
def step(self, frame): result = [] frame = self.process_frame(frame) ycords, xcords = frame.nonzero() for i in xrange(len(ycords)): result.append((ycords[i], xcords[i], frame[ycords[i], xcords[i]])) self.result_values.append(result) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_zeros(X):\n\tnoNonzeros = np.count_nonzero(X, axis=1)\n\tmask = np.where(noNonzeros > 0)\n\treturn X[mask[0], :]", "def check_none_zero_values(self):\n hits = -1\n if (len(self.data.shape) == 3):\n hits = 0\n frames = self.data.shape[0]\n pixels = self.da...
[ "0.5740116", "0.5696752", "0.55388373", "0.5503593", "0.5433344", "0.5431676", "0.53999764", "0.539659", "0.53915876", "0.5329777", "0.5292938", "0.5231935", "0.52252465", "0.5219066", "0.520996", "0.51897395", "0.51893055", "0.5188206", "0.51812667", "0.51812667", "0.51707",...
0.569489
2
Return a list of words that is the best segmentation of text.
def segment(text): if not text: return [] candidates = ([first]+segment(rest) for first,rest in splits(text)) return max(candidates, key=Pwords)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment(text, WORDS) -> List[Word]:\n Pword = Bag(WORDS)\n if not text: \n return []\n else:\n candidates = ([first] + segment(rest, WORDS)\n for (first, rest) in splits(text, 1))\n return max(candidates, key=lambda x: Pwords(x, Pword))", "def segment_words(...
[ "0.73563504", "0.67785096", "0.6682214", "0.6640473", "0.6485087", "0.6416824", "0.637549", "0.632466", "0.6313496", "0.6263238", "0.62103164", "0.6182108", "0.6121708", "0.6108071", "0.6063605", "0.6057375", "0.60429406", "0.597771", "0.59762806", "0.59751993", "0.59739095",...
0.7298593
1
Returns a sigmoidal curve function for smooth scaling of timevariant parameter values
def make_sigmoidal_curve( y_low=0, y_high=1., x_start=0, x_inflect=0.5, multiplier=1.): amplitude = y_high - y_low if amplitude == 0: def curve(x): return y_low return curve x_delta = x_inflect - x_start slope_at_inflection = multipl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(t):\n return np.exp(t)/(1+np.exp(t))", "def sigmoid(t):\n return 1 / (1 + np.exp(-t))", "def sigmoid(t):\n\n return 1.0 / (1.0 + np.exp(-t))", "def sigmoid(t):\n sig=np.exp(t)/(1+np.exp(t))\n return sig", "def sigmoid(t):\n t[t >= 20] = 20\n t[t <= -20] = -20\n return np...
[ "0.72162664", "0.71220726", "0.7050866", "0.69788253", "0.6929286", "0.6879408", "0.6760016", "0.6713643", "0.6713595", "0.67108583", "0.67073333", "0.668611", "0.66853625", "0.66853625", "0.66853625", "0.66853625", "0.66853625", "0.66853625", "0.6682372", "0.6670177", "0.664...
0.6394838
44
Returns the first_name plus the last_name, with a space in between.
def get_full_name(self): full_name = '%s %s' % (self.first_name, self.last_name) return full_name.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name(first_name, last_name):\n return first_name + \" \" + last_name", "def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name", "def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()", "def get_full_name(se...
[ "0.8313066", "0.82006806", "0.8049215", "0.80409706", "0.8017754", "0.7999701", "0.79541886", "0.7942144", "0.7942144", "0.7942144", "0.7937664", "0.79287225", "0.7921711", "0.790314", "0.7892264", "0.7890117", "0.7878668", "0.786143", "0.78528684", "0.7823523", "0.7813124", ...
0.77466476
52
Set up a model either a new untrained instance or a pretrained model. Simplified version of fastai's language_model_learner, where no models are downloaded and where the data location is decoupled from model location.
def lm_learner(data, arch, model_dir, config=None, drop_mult=1., pretrained=True, **learn_kwargs): model = get_language_model(arch, len(data.vocab.itos), config=config, drop_mult=drop_mult) meta = _model_meta[arch] learner = LanguageLearner(data, model, split_func=meta["split_lm"], **learn_kw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n print(\"setup\")\n \n self.modelToUse = 1\n if self.train:\n print(\"train\")\n else:\n print(\"no train\")\n \n device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n self.envSize = 17\n \n #init model\n if self.train or not os...
[ "0.7003267", "0.6977281", "0.69017535", "0.6776737", "0.677315", "0.6741355", "0.6734749", "0.66802645", "0.6557716", "0.65473324", "0.6547169", "0.65326416", "0.65089256", "0.6497541", "0.64902174", "0.64875674", "0.6463274", "0.6460417", "0.64558333", "0.6443157", "0.644292...
0.0
-1