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
Test that the items can be retrieved.
def test_items(self): self.assertEqual([("described_model_type", self.expected_described_model)], list(self.mapped_model.items()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_item_list(self):\n resp = self.app.get('/items')\n self.assertEqual(resp.status_code, status.HTTP_200_OK)\n data = json.loads(resp.data)\n self.assertEqual(len(data), 3)", "def test_get_items_page(self, mock_requests_get):\n result = resources.get_items_page(1, \"a...
[ "0.74696356", "0.7277848", "0.7122716", "0.68902785", "0.68500966", "0.6840849", "0.6809992", "0.6799842", "0.6778106", "0.6757121", "0.67133766", "0.6710793", "0.6653335", "0.6622517", "0.6612151", "0.66074485", "0.66016537", "0.65803057", "0.6577676", "0.6576313", "0.654119...
0.62851614
47
fully connected layers or dense layer
def fclayer(in_features, out_features): fc = nn.Linear(in_features, out_features) nn.init.kaiming_normal_(fc.weight) return fc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_fully_connected_layer(input_layer,\n layer_size,\n activation=tf.nn.relu,\n layer_name='',\n logs=False):\n if not layer_name:\n layer_name = ''.join(str(x) for x in np.random....
[ "0.71426284", "0.6833023", "0.6805999", "0.67833257", "0.67681617", "0.6711874", "0.6682316", "0.6651481", "0.6631076", "0.6611241", "0.65508956", "0.65147924", "0.6511002", "0.64513654", "0.64409477", "0.63658357", "0.63640463", "0.6321559", "0.62621194", "0.6261182", "0.623...
0.58284247
94
Returns Classroom in good representation for user
def __str__(self): return 'Classroom {} has a capacity of {} persons and ' \ 'has the following equipment: {}.'.format( self.number, str(self.capacity), ', '.join(self.equipment))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return \"Classroom('{}', {}, {})\".format(self.number, self.capacity,\n str(self.equipment))", "def __str__(self):\n return self.room_name", "def __str__(self):\n return self.room.name", "def json(self):\n return...
[ "0.6388747", "0.58620846", "0.5832608", "0.55203956", "0.5508624", "0.5427314", "0.54227597", "0.5291813", "0.5283396", "0.52249587", "0.5194744", "0.5179897", "0.51505965", "0.51442033", "0.5131981", "0.5128399", "0.51204616", "0.5106739", "0.5105534", "0.5094171", "0.507423...
0.5878091
1
Classroom, Classroom > bool Returns True if first room have bigger capacity then second room
def is_larger(self, room2): return self.capacity > room2.capacity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gt__(self, other: Card) -> bool:\n return not self.__le__(other)", "def pareto_better(self, other: \"EvalItem\") -> bool:\n return self.size <= other.size and other.result <= self.result", "def __gt__(self, other):\n return self.weight() > other.weight()", "def __gt__(self, other):...
[ "0.61225253", "0.5890521", "0.5887941", "0.58851635", "0.5883985", "0.5871", "0.5871", "0.58323383", "0.57970667", "0.57674", "0.57477105", "0.57477105", "0.5667831", "0.5658871", "0.56532055", "0.5647148", "0.56317246", "0.56295174", "0.5624304", "0.55907315", "0.5584328", ...
0.73677325
0
Takes a datetime object and returns POSIX UTC in nanoseconds
def date_to_nano(ts): return calendar.timegm(ts.utctimetuple()) * int(1e3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unix_time_nanos(dt):\n return timedelta_to_micros(dt - epoch)", "def get_epoch_time(utc_datetime=None):\n if not utc_datetime:\n utc_datetime = datetime.datetime.utcnow()\n return math.ceil((utc_datetime - EPOCH_START).total_seconds())", "def datetime_to_gpstimestamp_nanoseconds(date):\n ...
[ "0.7196696", "0.6794556", "0.67814964", "0.6744819", "0.6744819", "0.67223793", "0.6684839", "0.6624673", "0.65977186", "0.6539144", "0.6514163", "0.65055406", "0.64669174", "0.64562154", "0.63818485", "0.6372414", "0.6349268", "0.62804013", "0.62467533", "0.6239043", "0.6236...
0.6813911
1
Remove previous transaction DB and reinitialize the action objects so we don't have to worry about conflicts from reusing PDS ID's/DOI's between tests.
def setUp(self) -> None: if os.path.isfile(self.db_name): os.remove(self.db_name) self._list_action = DOICoreActionList(db_name=self.db_name) self._reserve_action = DOICoreActionReserve(db_name=self.db_name) self._release_action = DOICoreActionRelease(db_name=self.db_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset():\n teardown_db()\n build()", "def tearDown(self):\n\t\tTransaction.transaction_list = []", "def tearDown(self):\r\n\r\n db.session.rollback()\r\n db.drop_all()", "def tearDown(self):\n db.session.commit()\n db.drop_all()", "def tearDown(self):\n model.DB...
[ "0.69345915", "0.6716611", "0.66229075", "0.6542029", "0.65316594", "0.6505639", "0.64698505", "0.6453844", "0.6446514", "0.6446514", "0.64258087", "0.64258087", "0.63932043", "0.6385942", "0.636722", "0.636722", "0.636722", "0.636722", "0.636722", "0.636722", "0.636722", "...
0.6570783
3
Returns count of open changes per reviewer per project Fetches all open changes from gerrit, and returns a dictionary containing all projects with open changes, and for each project, all reviewers and the count of changes they are reviewing. e.g. {
def get_open_change_reviewers_per_project(): config = GerritFetchConfig() open_changes = fetch.fetch_open_changes( config.hostname(), config.username(), config.port()) open_change_reviewers_per_project = {} for gerrit_change in open_changes: project = gerrit_change.project review...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_current_reviewers_and_counts(project_name):\n reviewer_change_count_per_project = current_load_fetcher.\\\n get_open_change_reviewers_per_project()\n\n if project_name not in reviewer_change_count_per_project and \\\n project_name != PROJECT_ALL:\n logging.warning(\"Project ...
[ "0.6898937", "0.6401227", "0.62829226", "0.61762327", "0.61221975", "0.6012132", "0.58491695", "0.56204873", "0.5591274", "0.5577237", "0.54595", "0.54480326", "0.54340416", "0.53901017", "0.5334617", "0.52910286", "0.52823967", "0.5252443", "0.5237763", "0.5233384", "0.52304...
0.87611914
0
Return an UTCaware datetime in case of USE_TZ=True.
def tz_aware(value: datetime) -> datetime: if settings.USE_TZ: value = value.replace(tzinfo=timezone.utc) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_freeze_with_timezone_aware_datetime_in_utc():\n utc_now = datetime.datetime.utcnow()\n assert utc_now.tzinfo is None", "def test_freeze_with_timezone_aware_datetime_in_non_utc():\n utc_now = datetime.datetime.utcnow()\n assert utc_now.tzinfo is None\n assert utc_now == datetime.datetime(1...
[ "0.7496584", "0.72608817", "0.71937054", "0.71411216", "0.71222836", "0.7066944", "0.7022482", "0.6987124", "0.6978549", "0.696762", "0.6947956", "0.6856145", "0.6847567", "0.68384445", "0.6833825", "0.6821648", "0.6819736", "0.6792303", "0.67815375", "0.6744564", "0.67071795...
0.77953434
0
Return all Resume for job applied id.
def all_resume_by_job_applied_id(job_applied_id): return Note.query.filter(Note.job_applied_id == job_applied_id, Note.note_category == 'Resume' ).all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_recruiter_by_job_applied_id(job_applied_id): \n return Note.query.filter(Note.job_applied_id == job_applied_id, Note.note_category == 'Recruiter Contact' ).all()", "def get_job_applied():\n\n return JobCompletedApplication.query.all()", "def resume(self, job_id):\n job = Job.get_job_by_i...
[ "0.5769213", "0.56241286", "0.55435765", "0.54594284", "0.5418937", "0.53563815", "0.53016", "0.5262021", "0.5253391", "0.5253391", "0.5225734", "0.521197", "0.51903236", "0.5136629", "0.51281595", "0.51190066", "0.5110543", "0.5109377", "0.50861925", "0.5067618", "0.50420934...
0.8092352
0
Initializes the MLP with a number of inputs and outputs. Weights are initialized randomly with the specified seed.
def __init__(self, bias, weights, hidden_activation, output_activation): if bias is None: self.weights = weights self.has_bias = False else: self.weights = [numpy.vstack([bias[k], weights[k]]) for k in range(len(bias))] self.has_bias = True self.hidden_activation = hidden_activatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_weights(self, seed=None):\r\n if seed!=None:\r\n np.random.seed(seed)\r\n self.weights = np.random.randn(self.number_of_nodes,self.input_dimensions)", "def initialize_weights(self, seed=None):\n if seed != None:\n np.random.seed(seed)\n self.weight...
[ "0.7367139", "0.7290737", "0.6733939", "0.66796666", "0.66537523", "0.6579989", "0.64707845", "0.6466867", "0.6453057", "0.64230084", "0.6421071", "0.6394768", "0.6393354", "0.6384965", "0.6360607", "0.6356197", "0.6325219", "0.63211054", "0.63164985", "0.63026685", "0.628809...
0.0
-1
Load an internal yaml node parsing, defaulting to a scalar value.
def _from_yaml(cls, loader: yaml.Loader, node: yaml.Node) -> "YamlModifier": value = loader.construct_scalar(typing.cast(yaml.ScalarNode, node)) return cls(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_(self, node):\n yamal_name = os.path.join(self._root, self.construct_scalar(node))\n\n with open(yamal_name, 'r') as yamal_file:\n return yaml.load(yamal_file, ImportLoader)", "def _from_yaml(cls, loader: yaml.Loader, node: yaml.Node) -> \"InjectString\":\n raw = loader...
[ "0.73322433", "0.63728184", "0.61908674", "0.61466956", "0.6134764", "0.6104053", "0.6015713", "0.59930307", "0.598406", "0.59112525", "0.5903671", "0.5833151", "0.5768858", "0.5761115", "0.57025176", "0.5649191", "0.5563314", "0.55608124", "0.5558609", "0.5475866", "0.542939...
0.7018517
1
Parse yaml node into this class object for Lobotomy processing.
def parse_yaml(cls, loader: yaml.Loader, node: yaml.Node) -> "YamlModifier": return cls._from_yaml(loader, node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, node: yaml.Node) -> None:\n self.yaml_node = node", "def from_yaml(cls, y):\n return cls(yaml.load(y, AttrLoader))", "def FromYAML(cls, source):\n\n # Late import to avoid a circular dependency.\n try:\n import bulletml.bulletyaml\n import ya...
[ "0.7190225", "0.68135875", "0.6604197", "0.6597981", "0.65922415", "0.65773606", "0.6518172", "0.65123314", "0.6395062", "0.6377166", "0.6372749", "0.6344428", "0.6335441", "0.6274441", "0.6237253", "0.60822874", "0.60467535", "0.6043854", "0.6027036", "0.5990031", "0.5938824...
0.73717535
0
Register the comparator with the PyYaml loader.
def register(cls): yaml.add_constructor(cls.label(), cls.parse_yaml) yaml.add_representer(cls, cls.dump_yaml)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setComparator(self, comparator: dict):\n self._comparator = comparator", "def set_result_comparator(self, comparator):\n\n self._comparator = comparator", "def register_loader(key, module):\n register(key, module, loader_dict)", "def _yaml_ordering_support():\n _mapping_tag = yaml.resol...
[ "0.58455926", "0.5207403", "0.51714724", "0.5046912", "0.49322683", "0.48709297", "0.47904545", "0.4760413", "0.46908015", "0.46855125", "0.4660275", "0.4592575", "0.45680568", "0.44943762", "0.44933996", "0.44847608", "0.44837308", "0.4481726", "0.4451131", "0.44410124", "0....
0.5855883
0
Load an internal yaml node parsing.
def _from_yaml(cls, loader: yaml.Loader, node: yaml.Node) -> "ToJson": try: value = loader.construct_mapping(node, deep=True) except yaml.constructor.ConstructorError: value = loader.construct_sequence(node, deep=True) return cls(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_(self, node):\n yamal_name = os.path.join(self._root, self.construct_scalar(node))\n\n with open(yamal_name, 'r') as yamal_file:\n return yaml.load(yamal_file, ImportLoader)", "def parse_yaml(cls, loader: yaml.Loader, node: yaml.Node) -> \"YamlModifier\":\n return cls._...
[ "0.73915166", "0.71310484", "0.673423", "0.66889703", "0.6588866", "0.65676856", "0.6481034", "0.64551365", "0.63675475", "0.6336091", "0.631003", "0.6225353", "0.6186448", "0.61831933", "0.61275", "0.60967654", "0.6024105", "0.6010759", "0.6009358", "0.60079056", "0.59998393...
0.6249713
11
Load an internal yaml node parsing.
def _from_yaml(cls, loader: yaml.Loader, node: yaml.Node) -> "InjectString": raw = loader.construct_scalar(typing.cast(yaml.ScalarNode, node)) value = json.loads(typing.cast(str, raw).strip("\"'")) return cls(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_(self, node):\n yamal_name = os.path.join(self._root, self.construct_scalar(node))\n\n with open(yamal_name, 'r') as yamal_file:\n return yaml.load(yamal_file, ImportLoader)", "def parse_yaml(cls, loader: yaml.Loader, node: yaml.Node) -> \"YamlModifier\":\n return cls._...
[ "0.73915166", "0.71310484", "0.673423", "0.66889703", "0.6588866", "0.65676856", "0.6481034", "0.64551365", "0.63675475", "0.6336091", "0.631003", "0.6249713", "0.6225353", "0.6186448", "0.61831933", "0.61275", "0.60967654", "0.6024105", "0.6010759", "0.6009358", "0.60079056"...
0.55722076
63
Load an internal yaml node parsing.
def _from_yaml(cls, loader: yaml.Loader, node: yaml.Node) -> "BotoError": value = loader.construct_mapping(node, deep=True) return cls(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_(self, node):\n yamal_name = os.path.join(self._root, self.construct_scalar(node))\n\n with open(yamal_name, 'r') as yamal_file:\n return yaml.load(yamal_file, ImportLoader)", "def parse_yaml(cls, loader: yaml.Loader, node: yaml.Node) -> \"YamlModifier\":\n return cls._...
[ "0.73915166", "0.71310484", "0.673423", "0.66889703", "0.6588866", "0.65676856", "0.64551365", "0.63675475", "0.6336091", "0.631003", "0.6249713", "0.6225353", "0.6186448", "0.61831933", "0.61275", "0.60967654", "0.6024105", "0.6010759", "0.6009358", "0.60079056", "0.59998393...
0.6481034
6
Returns the 2 endpoints of an array of points from a line
def endpoints(line_points): neighbors = [] for p in line_points: aux = 0 for q in line_points: if np.linalg.norm(p-q) == 1: aux += 1 neighbors.append(aux) e_points = np.where(np.array(neighbors)==1) return line_points[e_points]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endpoints_from_lines(lines):\n \n all_points = []\n for line in lines:\n for i in [0, -1]: # start and end point\n all_points.append(line.coords[i])\n \n unique_points = set(all_points)\n \n return [Point(p) for p in unique_points]", "def get_line_end_pts(line_segment, ...
[ "0.75531864", "0.7405382", "0.69150645", "0.6756434", "0.6724094", "0.6720841", "0.66821533", "0.6652843", "0.6637193", "0.65996283", "0.65701735", "0.6523543", "0.6521626", "0.65032506", "0.6477672", "0.64699537", "0.64601064", "0.6448242", "0.6385857", "0.63586706", "0.6358...
0.73925066
2
Returns true if the other session or sample has the same hardware specs as this one, false otherwise.
def sameHardware(self, other): return (self.vendorId == other.vendorId and \ self.deviceId == other.deviceId and \ self.physicalMemory == other.physicalMemory and \ self.osInfo == other.osInfo and \ self.cpuSpeed[0] == other.cpuSpeed[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_same_device(self, other: \"PArray\") -> bool:\n this_device = self._current_device_index\n return this_device in other._array", "def match(uspec1, uspec2):\n \n if uspec1.is_power_onoff() and uspec2.is_power_onoff():\n return True\n \n if uspec1.number_windows() != uspec2...
[ "0.6838293", "0.666635", "0.65126216", "0.64928484", "0.63411206", "0.6300568", "0.62982696", "0.61403143", "0.6127172", "0.6109003", "0.6074839", "0.60358554", "0.59964126", "0.59953624", "0.5989709", "0.59614843", "0.59588736", "0.59384286", "0.59161776", "0.5901873", "0.58...
0.7975851
0
Validates that the two password inputs match.
def clean_password2(self): if self.clean_data.get('password1', None) and self.clean_data.get('password2', None) and \ self.clean_data['password1'] == self.clean_data['password2']: return self.clean_data['password2'] raise forms.ValidationError(u'You must type the same password eac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_password(password1: str, password2: str) -> bool:\n if password1 == password2:\n return True\n else:\n raise ValueError('Пароли не совпадают')", "def clean_password(self):\n password1 = self.cleaned_data.get('password1')\n password2 = self.cleaned_data.get('password2')...
[ "0.79399914", "0.7775991", "0.75286", "0.751961", "0.7506222", "0.7504838", "0.745747", "0.745747", "0.74129796", "0.7394356", "0.7387584", "0.7368053", "0.73406", "0.73406", "0.7324741", "0.73213553", "0.73095393", "0.7277372", "0.72607356", "0.72343296", "0.7186055", "0.7...
0.71904254
20
Get a random element from the set.
def getRandom(self) -> int: return self.nums[random.randint(0, len(self.nums) - 1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.7296881", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.67226046", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.64162946", "0.640...
0.0
-1
Returns the qualified name of the identifier given using the namespace prefix.
def qname(self, identifier): uri = identifier if isinstance(identifier, six.string_types) else ( identifier.uri if isinstance(identifier, Identifier) else None ) if uri and uri.startswith(self._uri): return QualifiedName(self, uri[len(self._uri):]) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefix_to_ns(self, prefix):\n defin = self.module.i_ctx.get_module(\n self.module.i_prefixes[prefix][0])\n return defin.search_one(\"namespace\").arg", "def _getPrefix(self, namespaceURI):\r\n prefixDict = self._getPrefixDict()\r\n if prefixDict.has_key(namespaceURI):\r...
[ "0.769194", "0.7337281", "0.7326206", "0.7299526", "0.72524375", "0.7053602", "0.69734764", "0.69541156", "0.6775588", "0.6710584", "0.67020273", "0.66632754", "0.66148424", "0.65285033", "0.6503347", "0.64935726", "0.64636904", "0.64574414", "0.6445418", "0.6430217", "0.6414...
0.6731498
9
Sets the export_host of this ExportResponseMetadata.
def export_host(self, export_host): self._export_host = export_host
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_host(self, response_host):\n\n self._response_host = response_host", "def response_host(self, response_host):\n\n self._response_host = response_host", "def host(self, host):\n\n self._host = host", "def host(self, host):\n\n self._host = host", "def host(self, host...
[ "0.7138213", "0.7138213", "0.644298", "0.644298", "0.644298", "0.644298", "0.6365714", "0.6363546", "0.6119689", "0.5977553", "0.5908788", "0.58681583", "0.5725987", "0.5704862", "0.5632454", "0.5604846", "0.5604846", "0.5506752", "0.5506752", "0.5476766", "0.54253507", "0....
0.8150576
0
Sets the requested_object_list of this ExportResponseMetadata.
def requested_object_list(self, requested_object_list): self._requested_object_list = requested_object_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exported_object_list(self, exported_object_list):\n\n self._exported_object_list = exported_object_list", "def set_response_list(self, r_list):\n self.response_list = r_list", "def set_objects(self, objects: list):\n self._objects = objects", "def set_object_list(self, query, fields,...
[ "0.65758", "0.58558273", "0.5800644", "0.5349972", "0.51523393", "0.5088856", "0.5084719", "0.5048292", "0.50420725", "0.5036184", "0.50234246", "0.50130266", "0.4954567", "0.4948551", "0.49092585", "0.49018076", "0.49018076", "0.48524174", "0.48476678", "0.47991368", "0.4791...
0.843938
0
Sets the exported_object_list of this ExportResponseMetadata.
def exported_object_list(self, exported_object_list): self._exported_object_list = exported_object_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, export_host=None, export_date=None, requested_object_list=None, exported_object_list=None): # noqa: E501 # noqa: E501\n\n self._export_host = None\n self._export_date = None\n self._requested_object_list = None\n self._exported_object_list = None\n self.discr...
[ "0.57387066", "0.572405", "0.5720836", "0.50837755", "0.5052673", "0.4954005", "0.49233595", "0.48638776", "0.48131937", "0.47819278", "0.47225076", "0.47225076", "0.47171348", "0.46870238", "0.46680313", "0.46198332", "0.46057516", "0.45436734", "0.45278898", "0.45272794", "...
0.8515711
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ExportResponseMetadata): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Compute the softmax of each element along an axis of X.
def softmax(X, theta = 1.0, axis = None): # make X at least 2d y = np.atleast_2d(X) # find axis if axis is None: axis = next(j[0] for j in enumerate(y.shape) if j[1] > 1) # multiply y against the theta parameter, y = y * float(theta) # subtract the max for numerical stability ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, x):\n\n out = np.zeros(x.shape)\n for i in range(x.shape[0]):\n max_x = x[i] - np.max(x[i])\n out[i] = np.exp(max_x) / np.sum(np.exp(max_x), axis=0)\n\n return out", "def softmax(x: npt.NDArray) -> npt.NDArray:\n row_wise_max = np.max(x, axis=1).res...
[ "0.86482805", "0.8523447", "0.8501702", "0.8450376", "0.8424998", "0.8401389", "0.83826745", "0.8379566", "0.83725315", "0.8363791", "0.83552516", "0.83450276", "0.8326659", "0.8309501", "0.8274441", "0.82731706", "0.8266031", "0.8248805", "0.8248805", "0.8244989", "0.824277"...
0.0
-1
Return the offset in hours from UTC as a float.
def get_tz(self): for _, element in etree.iterparse(self.source): if element.tag == TIMEZONE: return float(element.text or 0.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tz_offset(self) -> float:\n return self.AD.tz.utcoffset(self.datetime()).total_seconds() / 60", "def get_utc_offset():\n timedelta = datetime.datetime.now() - datetime.datetime.utcnow()\n # XXX: `return -time.timezone`?\n return timedelta.total_seconds()", "def get_tz_offset_seconds() -...
[ "0.70775425", "0.6989547", "0.6908614", "0.67074597", "0.6508781", "0.64082044", "0.6225916", "0.6165682", "0.61237943", "0.6042478", "0.6030816", "0.59795976", "0.58823085", "0.5826774", "0.57685786", "0.5765773", "0.57652164", "0.5705759", "0.5696149", "0.5687313", "0.56625...
0.4868406
78
Localize tznaive TimeSeries to a fixedoffset time zone. Most time zones are offset from UTC by a whole number of hours, but a few are offset by 30 or 45 minutes. An offset of 0 is specialcased to return UTC.
def tz_localize(dataframe, offset_in_hours=0, copy=True): return dataframe.tz_localize(FixedOffset(offset_in_hours * 60), copy=copy)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fixed_timezone(offset):\n\n if isinstance(offset, timedelta):\n offset = offset.total_seconds() // 60\n\n sign = \"-\" if offset < 0 else \"+\"\n hhmm = \"%02d%02d\" % divmod(abs(offset), 60)\n name = sign + hhmm\n\n return timezone(timedelta(minutes=offset), name)", "def get_fixed_...
[ "0.733858", "0.73315036", "0.7123728", "0.6075806", "0.5935274", "0.58467084", "0.5763584", "0.5721623", "0.5694093", "0.56887317", "0.56338304", "0.5555357", "0.555062", "0.55430114", "0.5529573", "0.5487007", "0.54707557", "0.54601884", "0.5453896", "0.5438302", "0.5430976"...
0.64824516
3
Convert sequence of evenly spaced nonnegative ints to equivalent slice. If the returned slice object is `s = slice(start, stop, step)`, the
def _range_to_slice(index): if not len(index): return slice(None, 0, None) if any(i < 0 for i in index): raise ValueError(f'Could not convert {index} to a slice ' '(contains negative elements)') increments_left = set(np.diff(index)) step = increments_left.pop() i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slicer(seq, start=None, stop=None, step=None):\n return seq[start:stop:step]", "def normalize_slice(s):\n start, stop, step = s.start, s.stop, s.step\n if start is None:\n start = 0\n if step is None:\n step = 1\n if start < 0 or step < 0 or stop is not None and stop < 0:\n ...
[ "0.8011135", "0.7739454", "0.74094546", "0.72735506", "0.717713", "0.70792943", "0.7041868", "0.690513", "0.6796296", "0.6779164", "0.6697571", "0.6686825", "0.66782004", "0.66213644", "0.6585468", "0.6580096", "0.647419", "0.6415965", "0.64123", "0.63498336", "0.63340086", ...
0.7165115
5
Short humanfriendly string representation of lazy indexer object.
def __repr__(self): return "<katdal.{} '{}': shape {}, type {} at {:#x}>".format( self.__class__.__name__, self.name, self.shape, self.dtype, id(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return \"{}_human\".format(self.index)", "def __str__(self) -> str:\n return f\"K{self._index_to_unicode(self.index)}\"", "def __repr__(self):\n return str(self.index)", "def __repr__(self):\n return \"%s[%s]\" % (self.index_type, self.query)", "def short_st...
[ "0.6915522", "0.68598956", "0.6718207", "0.6625014", "0.6598968", "0.65907544", "0.6485251", "0.64300734", "0.6380875", "0.62672544", "0.62349004", "0.6124259", "0.609269", "0.60701317", "0.60654444", "0.6030815", "0.60238296", "0.59876156", "0.59537524", "0.5930237", "0.5860...
0.0
-1
Extract a selected array from the underlying dataset. This applies the given secondstage index on top of the firststage index and retrieves the relevant data from the dataset as an array, optionally transforming it afterwards.
def __getitem__(self, keep): ndim = len(self.dataset.shape) # Ensure that keep is a tuple (then turn it into a list to simplify further processing) keep = list(keep) if isinstance(keep, tuple) else [keep] # The original keep tuple will be passed to data transform chain original_k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(arrays, index):\n if arrays is None or any(i is None for i in arrays):\n return arrays\n return tuple(i.ravel()[index] for i in arrays)", "def __getitem__(self, index: int) -> Tuple[Any, Any]:\n datum, target = self.data[index], self.targets[index]\n \n if self.transf...
[ "0.5978752", "0.57524294", "0.5708342", "0.55696416", "0.556528", "0.5534159", "0.55027837", "0.54934233", "0.54812884", "0.54775065", "0.54741627", "0.54486006", "0.5447731", "0.54420215", "0.54378104", "0.5379849", "0.537284", "0.5363644", "0.5344681", "0.5316661", "0.53088...
0.5002727
73
Extract a selected array from the underlying dataset. This applies the given secondstage index on top of the current dataset, which already has a firststage index and optional transforms applied to it. The indexer also finally stops being lazy and triggers dask computation to arrive at the output array. Both indexing s...
def __getitem__(self, keep): return self.get([self], keep)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batched_index_select(input, dim, index):\n views = [input.shape[0]] + [1 if i != dim else -1 for i in range(1, len(input.shape))]\n expanse = list(input.shape)\n expanse[0] = -1\n expanse[dim] = -1\n index = index.view(views).expand(expanse)\n return torch.gather(input, dim, index)", "def c...
[ "0.6476484", "0.61325866", "0.5939623", "0.5834367", "0.5815109", "0.5787023", "0.578326", "0.5776111", "0.56746083", "0.563971", "0.5628474", "0.5548305", "0.5501211", "0.5498332", "0.5483299", "0.54740727", "0.54704463", "0.5469028", "0.54643875", "0.54544646", "0.54269475"...
0.0
-1
Short humanfriendly string representation of indexer object.
def __repr__(self): return "<katdal.{} '{}': shape {}, type {} at {:#x}>".format( self.__class__.__name__, self.name, self.shape, self.dtype, id(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self) -> str:\n return f\"K{self._index_to_unicode(self.index)}\"", "def __str__(self):\n return \"{}_human\".format(self.index)", "def __repr__(self):\n return \"%s[%s]\" % (self.index_type, self.query)", "def __repr__(self):\n return str(self.index)", "def __repr__...
[ "0.7194278", "0.7162457", "0.711871", "0.69272774", "0.6822385", "0.6694754", "0.6636655", "0.6632189", "0.66048366", "0.6591673", "0.65751594", "0.65524185", "0.640755", "0.63549006", "0.62816143", "0.61983436", "0.6137607", "0.6099416", "0.60898465", "0.6058687", "0.6045976...
0.0
-1
Compute x @ y, broadcasting over the first `N 2` ranks.
def _matmul_broadcast(x, y, name): with tf.variable_scope(name) as scope: return tf.reduce_sum( tf.nn.dropout(x[..., tf.newaxis] * y[..., tf.newaxis, :, :],1), axis=-2 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def brute_multiply(x, y):\n \n n = x.shape[0]\n res = np.zeros(x.shape)\n \n for i in range(n):\n for j in range(n):\n for k in range(n):\n res[i, j] += x[i, k] * y[k, j]\n \n return res", "def associate_comp(x, y):\n return torch.cat([x[:1] * y[:1] - x[1:...
[ "0.564049", "0.5376758", "0.5373917", "0.53423446", "0.53102696", "0.5265047", "0.5245262", "0.5209597", "0.5205773", "0.51244324", "0.51001847", "0.5094103", "0.5083796", "0.5059849", "0.5039474", "0.50308985", "0.50294924", "0.49719357", "0.49697846", "0.49624175", "0.49606...
0.50320524
15
Shift input ids one token to the right, and wrap the last non pad token (usually ).
def shift_tokens_right(self, input_ids, pad_token_id): prev_output_tokens = input_ids.clone() index_of_eos = (input_ids.ne(pad_token_id).sum(dim=1) - 1).unsqueeze(-1) prev_output_tokens[:, 0] = input_ids.gather(1, index_of_eos).squeeze() prev_output_tokens[:, 1:] = input_ids[:, :-1] return prev_outp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_tokens_right(input_ids, pad_token_id):\r\n prev_output_tokens = input_ids.clone()\r\n index_of_eos = (input_ids.ne(pad_token_id).sum(dim=1) - 1).unsqueeze(-1)\r\n prev_output_tokens[:, 0] = input_ids.gather(1, index_of_eos).squeeze()\r\n prev_output_tokens[:, 1:] = input_ids[:, :-1]\r\n re...
[ "0.8174382", "0.7355779", "0.730172", "0.62766033", "0.5987434", "0.59027076", "0.5735923", "0.5567176", "0.5503809", "0.54715633", "0.54715633", "0.54715633", "0.5460714", "0.54170334", "0.5338661", "0.53169227", "0.52875674", "0.52819985", "0.5207631", "0.51908386", "0.5179...
0.81405616
1
Use the current date, add ".0", to build a suffix for the Docker tag.
def _build_tag_suffix() -> str: now = datetime.datetime.now(tz=datetime.timezone.utc).astimezone() return now.strftime(".%Y%m%d.0")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_time():\n return time.strftime(\"%Y-%m-%d_%I.%M%p_\")", "def build_image_name(self, tag):\n return self.repository_name + ':' + tag", "def date_tag():\n import pylab\n pylab.figtext(0.04, 0.02, str(datetime.datetime.today())[:16], size=8)", "def docker_image_tag(self, app):\n ...
[ "0.6210457", "0.60344297", "0.60149807", "0.5938053", "0.58830386", "0.58757097", "0.58196324", "0.57140756", "0.56970084", "0.5608625", "0.5577733", "0.55712014", "0.54981995", "0.54633343", "0.54130644", "0.5384314", "0.5372933", "0.536144", "0.53580433", "0.5355393", "0.53...
0.7845467
0
Fill the missing values(NaN) in column with the mean value of the group the row belongs to. The rows are grouped based on the values of another column
def fill_with_group_average(df, group, column): #df=None df[column].fillna(df.groupby(group)[column].transform('mean'), inplace=True) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_mean(df):\n df = df.fillna(df.mean().fillna(0).to_dict())\n return df", "def mean_impute(self, column_val):\n mean = np.mean(column_val)\n column_val = column_val.fillna(mean)\n return column_val", "def filling_nan_values(df: pd.DataFrame) -> pd.DataFrame: \n ratio = df.c...
[ "0.733223", "0.6911329", "0.6804728", "0.6377485", "0.63724154", "0.6184612", "0.6125718", "0.61130387", "0.61074495", "0.60799503", "0.6020397", "0.6011322", "0.6011322", "0.59590447", "0.58487135", "0.5830829", "0.5822329", "0.58109444", "0.57864994", "0.57757205", "0.57416...
0.8269875
0
Build an actor (policy) network that maps states > actions.
def forward(self, state): x = F.relu(self.fc1(state)) x = F.relu(self.fc2(x)) return F.tanh(self.fc3(x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_actor_network(states, num_controls, params, scope_name):\n scope_key = scope_name + '/'\n with tf.variable_scope(scope_name):\n hidden_1 = tf.layers.dense(states,\n units=params.actor_hidden_units[0],\n activation=None,\n ...
[ "0.6934474", "0.6363443", "0.6269951", "0.6208458", "0.6200558", "0.6186873", "0.6146386", "0.61460924", "0.6127505", "0.6019301", "0.60004425", "0.5977054", "0.59594935", "0.5952402", "0.59490156", "0.5928663", "0.59146357", "0.58966", "0.58931005", "0.5890896", "0.5879405",...
0.0
-1
Add a new experience to memory.
def add(self, state, action, reward, next_state, done): e = self.experience(state, action, reward, next_state, done) self.memory.append(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)", "def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st...
[ "0.79568833", "0.79042006", "0.78795445", "0.7577913", "0.7570969", "0.74478436", "0.7361023", "0.72697705", "0.721816", "0.71451885", "0.7106998", "0.7101183", "0.69837016", "0.68905056", "0.68842727", "0.6755663", "0.6712557", "0.6677425", "0.64961654", "0.6488678", "0.6486...
0.71984994
19
Return the current size of internal memory.
def __len__(self): return len(self.memory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSize(self) -> int:\n return len(self.mem)", "def getSize(self):\n return self.bf.memory()", "def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024", "def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ...
[ "0.8573752", "0.82169205", "0.8200361", "0.8087402", "0.8021614", "0.7890747", "0.78219426", "0.78017354", "0.77905464", "0.7758844", "0.77559924", "0.77559924", "0.775519", "0.77544576", "0.7733221", "0.7732168", "0.7720068", "0.77145016", "0.77092093", "0.77077913", "0.7697...
0.75127405
56
Return a string suitable for use in progress messages as a short hint to what we're processing. If we have a PreReceiveTuple with a Git branch/tag name, return that name (minus any refs/heads/ prefix). If not, return None.
def _curr_ref_ui_name(self): if not (self._current_prt and self._current_prt.ref): return None s = self._current_prt.ref prefixes = ["refs/heads/", "refs/tags/"] for p in prefixes: if s.startswith(p): return s[len(p):] return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short_branch_name(branch):\n return branch.replace('refs/heads/', '')", "def GetPrefix():\n m = BRANCH_REGEX.match(RCS_FILE)\n if m:\n return m.group(1)\n return DEFAULT_DEPOT", "def get_current_remote_name(self) -> str:\n match = self.status()\n\n if match.branch_upstream is No...
[ "0.5595505", "0.5560799", "0.5542163", "0.5362832", "0.52647954", "0.5257069", "0.52282697", "0.51733804", "0.516051", "0.5108076", "0.51070267", "0.51055515", "0.50913596", "0.50558054", "0.5049445", "0.5048159", "0.5032945", "0.502492", "0.50247127", "0.49994317", "0.499059...
0.5560326
2
Return loggable string for a single fe_commit['files'] element.
def _log_fe_file(fe_file): mode = ' ' if 'mode' in fe_file: mode = fe_file['mode'] sha1 = ' ' if 'sha1' in fe_file: sha1 = p4gf_util.abbrev(fe_file['sha1']) return NTR('{mode} {action} {sha1} {path}') \ .format( mode = mode , action = fe_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_list_str(self):\n curr_file_index = self.app.current_file_index()\n files = self.app.get_files();\n file_list = files[curr_file_index:] + files[:curr_file_index]\n str_list = []\n for f in file_list:\n fname = f.name + ([\"\", \"*\"][f.is_changed()])\n ...
[ "0.6204323", "0.5932406", "0.5878049", "0.57989603", "0.57780176", "0.57196337", "0.5701259", "0.55389786", "0.5513501", "0.54978555", "0.5449646", "0.54407847", "0.5358694", "0.5305338", "0.5279703", "0.52198076", "0.52079505", "0.52038187", "0.51883763", "0.51697344", "0.51...
0.57862025
4
Helper function to convert string to list. Used to convert shape attribute string to list format.
def convert_string_to_list(string_val): result_list = [] list_string = string_val.split(',') for val in list_string: val = str(val.strip()) val = val.replace("(", "") val = val.replace(")", "") val = val.replace("L", "") val = val.replace("[", "") val = val.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str2list(input):\n if isinstance(input, str):\n return [input]\n\n else:\n return input", "def to_list(value):\n if hasattr(value, '__iter__') and not isinstance(value, str):\n return list(value)\n return [value]", "def _convert_str_to_list(cls, v: Union[List[str], str]) ->...
[ "0.73350626", "0.7006628", "0.69769", "0.6960579", "0.6908072", "0.68899715", "0.68545306", "0.6836377", "0.6827319", "0.67761135", "0.6765714", "0.67551106", "0.6631985", "0.6618425", "0.6563515", "0.6554849", "0.65231544", "0.65141433", "0.6511315", "0.64754456", "0.647153"...
0.65169
17
Map MXNet's convolution operator attributes to onnx's Conv operator and return the created node.
def convert_convolution(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) kernel_dims = list(parse_helper(attrs, "kernel")) stride_dims = list(parse_helper(attrs, "stride", [1, 1])) pad_dims = list(parse_helper(attrs, "pad", [0, 0])) num_group = int(attrs.get("num_group", 1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_conv_pool(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n k = [op.handle.kernel_h, op.handle.kernel_w]\n s = [op.handle.stride_h, op.handle.stride_w]\n oddp = op.odd_padding\n p = [\n op.handle.pad_h + oddp[0],\n op.h...
[ "0.69920486", "0.66528916", "0.6432573", "0.59314674", "0.59063995", "0.5811342", "0.5794324", "0.57784176", "0.57155585", "0.5674647", "0.5611912", "0.5560294", "0.552098", "0.5466808", "0.5450267", "0.54139715", "0.5381454", "0.538118", "0.53697866", "0.5363581", "0.5358975...
0.7379639
0
Map MXNet's deconvolution operator attributes to onnx's ConvTranspose operator and return the created node.
def convert_deconvolution(node, **kwargs): name, inputs, attrs = get_inputs(node, kwargs) kernel_dims = list(parse_helper(attrs, "kernel")) stride_dims = list(parse_helper(attrs, "stride", [1, 1])) pad_dims = list(parse_helper(attrs, "pad", [0, 0])) num_group = int(attrs.get("num_group", 1)) di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_transpose(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('perm', op.perm),\n ])\n return node", "def deconv(inp):\n num_filters = inp.get_shape().as_list()[-1]\n\n x = Conv2DTran...
[ "0.6097374", "0.601943", "0.58937025", "0.58428407", "0.57710683", "0.5762493", "0.56841415", "0.55704516", "0.55147016", "0.55106026", "0.5437586", "0.5421498", "0.53722894", "0.53698725", "0.53527224", "0.5335422", "0.5334541", "0.53216076", "0.5319174", "0.5318343", "0.530...
0.790625
0
Map MXNet's FullyConnected operator attributes to onnx's Gemm operator and return the created node.
def convert_fully_connected(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) initializer = kwargs["initializer"] no_bias = get_boolean_attribute_value(attrs, "no_bias") fcnode = [] op_name = "flatten_" + str(kwargs["idx"]) flatten_node = onnx.helper.make_node( 'Fl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_gemm(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('alpha', float(op.alpha)),\n helper.make_attribute('beta', float(op.beta)),\n helper.make_attribute('transA', op.transA),\n ...
[ "0.6879449", "0.5942417", "0.58318627", "0.5746459", "0.5413726", "0.53791827", "0.5367006", "0.5331266", "0.527826", "0.5257274", "0.52468914", "0.5242588", "0.5240532", "0.51549006", "0.515457", "0.51430964", "0.5114177", "0.5093029", "0.50854313", "0.5052347", "0.50358003"...
0.5959116
1
Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator and return the created node.
def convert_batchnorm(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) momentum = float(attrs.get("momentum", 0.9)) eps = float(attrs.get("eps", 0.001)) bn_node = onnx.helper.make_node( "BatchNormalization", input_nodes, [name], name=name, ep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_batchnorm(cls, op, op_t):\n # first, we init batchnorm node\n epsilon = 1e-5 # the epsilon value used in singa\n bn_node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n bn_node.attribute.extend([\n helper.make_attribute('momentum', op.handle.factor),\n ...
[ "0.6464468", "0.6376962", "0.61264753", "0.5883445", "0.57059985", "0.57012653", "0.56393033", "0.5572092", "0.55718195", "0.551708", "0.54826975", "0.5470176", "0.5425131", "0.5422429", "0.54030514", "0.5381643", "0.5354029", "0.5310859", "0.52805203", "0.5256326", "0.522801...
0.7146321
0
Map MXNet's cos operator attributes to onnx's Cos operator and return the created node.
def convert_cos(node, **kwargs): return create_basic_op_node('Cos', node, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cos(self):\n return type(self)(self.parent(),\n self._simplify(self._express.cos()))", "def convert_acos(node, **kwargs):\n return create_basic_op_node('Acos', node, kwargs)", "def cos(obj):\n\tif isinstance(obj, Variable):\n\t\tval = np.cos(obj.val)\n\t\tder = -np.sin(ob...
[ "0.68186814", "0.64716417", "0.6203887", "0.6197016", "0.6076361", "0.60689795", "0.6031383", "0.5917666", "0.5856112", "0.5803058", "0.5774136", "0.57586396", "0.5689945", "0.56162506", "0.56064403", "0.5498463", "0.5487711", "0.5412239", "0.53912306", "0.53586626", "0.53557...
0.77887577
0
Map MXNet's asin operator attributes to onnx's asin operator and return the created node.
def convert_asin(node, **kwargs): return create_basic_op_node('Asin', node, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onnx_node_to_singa_op(cls,\n onnx_node,\n inputs,\n opset_version=_known_opset_version):\n if onnx_node.op_type in cls._special_operators:\n translator = getattr(cls, cls._special_operators[onnx_node.op...
[ "0.5615745", "0.5525026", "0.5475919", "0.5348382", "0.52133733", "0.512875", "0.5086857", "0.50501585", "0.49973157", "0.49967095", "0.49640378", "0.49598986", "0.49447057", "0.49313256", "0.49242523", "0.4889783", "0.48892346", "0.48825702", "0.4869105", "0.48690882", "0.48...
0.68138564
0
Map MXNet's sigmoid operator attributes to onnx's Sigmoid operator and return the created node.
def convert_sigmoid(node, **kwargs): return create_basic_op_node('Sigmoid', node, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_hardsigmoid(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('alpha', op.alpha),\n helper.make_attribute('beta', op.gamma),\n ])\n return node", "def _create_hardsigmoid(cls, ...
[ "0.7370613", "0.7041682", "0.6546022", "0.648128", "0.6382078", "0.6377375", "0.6302575", "0.6283234", "0.6230437", "0.6167952", "0.6156127", "0.60304093", "0.59833264", "0.5979358", "0.5970586", "0.593866", "0.59101063", "0.5903408", "0.5903408", "0.5856696", "0.58536077", ...
0.7811297
0
Map MXNet's relu operator attributes to onnx's Relu operator and return the created node.
def convert_relu(node, **kwargs): return create_basic_op_node('Relu', node, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_elu(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('alpha', op.alpha),\n ])\n return node", "def relu(input, inplace=False):\n return FunctionLib.apply(\n 'Relu', input.devic...
[ "0.6200267", "0.60108554", "0.57318294", "0.57223237", "0.55151415", "0.5508822", "0.55065703", "0.5483933", "0.5419298", "0.5369124", "0.53125054", "0.52744555", "0.52538085", "0.5234616", "0.5223587", "0.52179486", "0.51698667", "0.51464564", "0.51462084", "0.51363164", "0....
0.7071261
0
Map MXNet's Activation operator attributes to onnx's Tanh/Relu operator and return the created node.
def convert_activation(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) act_type = attrs["act_type"] # Creating a dictionary here, but if this titlecase pattern # mxnet_name.title() act_types = { "tanh": "Tanh", "relu": "Relu", "sigmoid": "Sigmoid", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_elu(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('alpha', op.alpha),\n ])\n return node", "def _create_gemm(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, ...
[ "0.6525348", "0.6170288", "0.6057955", "0.583563", "0.5773526", "0.5732154", "0.55703044", "0.5537313", "0.54962003", "0.5491791", "0.54823685", "0.548114", "0.54719126", "0.54137206", "0.5379066", "0.53318", "0.5318398", "0.53031856", "0.5283017", "0.52783245", "0.5272741", ...
0.6768296
0
Map MXNet's pad operator attributes to onnx's Pad operator and return the created node.
def convert_pad(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) mxnet_pad_width = convert_string_to_list(attrs.get("pad_width")) onnx_pad_width = transform_padding(mxnet_pad_width) pad_mode = attrs.get("mode") if pad_mode == "constant": pad_value = float(attrs.get("co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pads(onnx_node): # type: (NodeWrapper) -> Tuple[int, int, int]\n auto_pad = onnx_node.get_attribute_value('auto_pad')\n pads = onnx_node.get_attribute_value('pads', ()) # Padding along each axis\n kernel_shape = onnx_node.get_attribute_value('kernel_shape')\n\n # Attribute 'auto_pad' is depre...
[ "0.57889557", "0.5579466", "0.54904", "0.5398082", "0.52853227", "0.5275017", "0.5262226", "0.52524114", "0.51949155", "0.51621807", "0.5159108", "0.508906", "0.50823164", "0.5075376", "0.5003475", "0.49345222", "0.49055016", "0.49049303", "0.49036154", "0.4897707", "0.488882...
0.7317738
0
Map MXNet's dot operator attributes to onnx's MatMul and Transpose operators based on the values set for transpose_a, transpose_b attributes.
def convert_dot(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) input_node_a = input_nodes[0] input_node_b = input_nodes[1] trans_a_node = None trans_b_node = None trans_a = get_boolean_attribute_value(attrs, "transpose_a") trans_b = get_boolean_attribute_value(attrs, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transpose_dot(self, other):\n from divisi2 import operators\n return operators.transpose_dot(self, other)", "def _convert_operator(op_name, attrs, identity_list=None, convert_map=None):\n identity_list = identity_list if identity_list else _identity_list\n convert_map = convert_map if con...
[ "0.5712867", "0.56176335", "0.554931", "0.5514312", "0.5504516", "0.54418373", "0.5436186", "0.54350364", "0.54332083", "0.5432765", "0.5416694", "0.53294843", "0.53082806", "0.5298505", "0.52948254", "0.5290505", "0.52547127", "0.52381", "0.5236047", "0.5189316", "0.5149108"...
0.6954135
0
Map MXNet's Pooling operator attributes to onnx's MaxPool/AveragePool/GlobalMaxPool/GlobalAveragePool operators based on the input node's attributes and return the created node.
def convert_pooling(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) kernel = eval(attrs["kernel"]) pool_type = attrs["pool_type"] if attrs.get("pool_type") else "max" stride = eval(attrs["stride"]) if attrs.get("stride") else (1, 1) global_pool = get_boolean_attribute_value(att...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_roipooling(node, **kwargs):\n name, input_nodes, attrs = get_inputs(node, kwargs)\n\n pooled_shape = convert_string_to_list(attrs.get('pooled_size'))\n scale = float(attrs.get(\"spatial_scale\"))\n\n node = onnx.helper.make_node(\n 'MaxRoiPool',\n input_nodes,\n [name],...
[ "0.6422184", "0.6282772", "0.61572933", "0.6030548", "0.59187293", "0.5839444", "0.5670332", "0.55067396", "0.546821", "0.53994155", "0.5370744", "0.5343035", "0.52772164", "0.5261299", "0.5253784", "0.52436227", "0.5200312", "0.51936644", "0.51801187", "0.51740825", "0.51138...
0.7350024
0
Map MXNet's exp operator attributes to onnx's Exp operator and return the created node.
def convert_exp(node, **kwargs): return create_basic_op_node('Exp', node, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exp(self):\n return type(self)(self.parent(), self._simplify(self._express.exp()))", "def exp(self: Float[LinearOperator, \"*batch M N\"]) -> Float[LinearOperator, \"*batch M N\"]:\n return self.__class__(self._diag.exp())", "def expr(self):\n return self._express", "def expon(*args,...
[ "0.63551813", "0.6045158", "0.5848142", "0.58281314", "0.5785661", "0.5784021", "0.5707887", "0.56942314", "0.5616022", "0.5590413", "0.5572627", "0.5540329", "0.5512824", "0.5411621", "0.53919", "0.5374348", "0.535856", "0.5315022", "0.5296157", "0.5277749", "0.52776116", ...
0.7500115
0
Map MXNet's _copy operator attributes to onnx's Identity operator and return the created node.
def convert_copy(node, **kwargs): return create_basic_op_node('Identity', node, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(self):\r\n cp = self.__class__(self.op, self.inputs, [output.clone() for output in self.outputs])\r\n cp.tag = copy(self.tag)\r\n return cp", "def copy_as_new(self) -> \"Individual\":\n return Individual(self.main_node.copy(), to_pipeline=self._to_pipeline)", "def __call__...
[ "0.6040742", "0.59664553", "0.59002656", "0.58588904", "0.5807119", "0.5798085", "0.572463", "0.57207906", "0.56919736", "0.56849563", "0.567741", "0.5644937", "0.55868983", "0.55787975", "0.5568176", "0.55487376", "0.5499865", "0.5467768", "0.5450066", "0.5446349", "0.543404...
0.7632108
0
Map MXNet's LeakyReLU operator attributes to onnx's Elu/LeakyRelu/PRelu operators based on the input node's attributes and return the created node.
def convert_leakyrelu(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) initializer = kwargs["initializer"] act_type = attrs.get("act_type", "leaky") alpha = float(attrs.get("slope", 0.25)) act_name = {"elu": "Elu", "leaky": "LeakyRelu", "prelu": "PRelu", "selu":...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_leakyrelu(cls, onnx_node, inputs, opset_version):\n alpha = onnx_node.getattr(\"alpha\", 0.01)\n _, forward = cls._common_onnx_node_to_singa_op(onnx_node, inputs,\n opset_version)\n return _, forward(alpha)", "def convert_relu...
[ "0.6645275", "0.64907336", "0.64269954", "0.6418857", "0.6116449", "0.59967774", "0.5878855", "0.5858891", "0.5726611", "0.567721", "0.5667963", "0.56440437", "0.55542094", "0.5381494", "0.5375752", "0.5368928", "0.535867", "0.5342397", "0.5317905", "0.5286128", "0.5262697", ...
0.67764103
0
Map MXNet's softmax operator attributes to onnx's Softmax operator and return the created node.
def convert_softmax(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) axis = int(attrs.get("axis", -1)) c_softmax_node = [] axis = -1 transpose_node1 = onnx.helper.make_node( "Transpose", inputs=input_nodes, perm=(0, 2, 3, 1), # NCHW--NHWC--(NHW,C) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_softmax(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('axis', op.axis),\n ])\n return node", "def _create_softmax(cls, onnx_node, inputs, opset_version):\n factor = onnx_node.g...
[ "0.7634255", "0.681238", "0.6320847", "0.6268783", "0.6250723", "0.58051175", "0.57759976", "0.5714223", "0.5651559", "0.5626642", "0.5621024", "0.56144696", "0.5528945", "0.54495025", "0.54494274", "0.54198587", "0.54136854", "0.5412554", "0.54050344", "0.5390913", "0.538304...
0.6541797
2
Map MXNet's RNN operator attributes to onnx's RNN operator and return the created node.
def convert_RNN(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) nodes = [] # ============================== Attributes ============================== mode = attrs['mode'].upper() rnn_kwargs = {} if mode != 'LSTM': raise NotImplementedError( "Only LSTM mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_cast(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n map_dict = {\n tensor.float32: TensorProto.FLOAT, # FLOAT to float32\n tensor.int32: TensorProto.INT32, # INT32 to int32\n }\n node.attribute.extend([\n helpe...
[ "0.573704", "0.5696308", "0.5613529", "0.56037074", "0.55654407", "0.5430018", "0.54215723", "0.5411738", "0.540513", "0.5397167", "0.5390512", "0.5343584", "0.53244823", "0.53124344", "0.5312318", "0.5296085", "0.5295705", "0.52775544", "0.5250277", "0.52421296", "0.52008814...
0.6088374
0
Map MXNet's LRN operator attributes to onnx's LRN operator and return the created node.
def convert_lrn(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) alpha = float(attrs.get("alpha", 0.0001)) beta = float(attrs.get("beta", 0.75)) bias = float(attrs.get("knorm", 1.0)) size = int(attrs.get("nsize")) lrn_node = onnx.helper.make_node( "LRN", inp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcLnLFromNode(self, nd):\n #---+----|----+----|----+----|----+----|----+----|----+----|----+----|\n return TreeLikelihoodBase.calcLnLFromNode(self, nd)", "def convert_attributes(cls, attrs):\n if attrs.get_int(\"axis\") != 1:\n raise RuntimeError(\n f\"Unsuppo...
[ "0.5615053", "0.5551711", "0.5397873", "0.5347614", "0.53341866", "0.5257164", "0.5226096", "0.5202186", "0.5176221", "0.5120736", "0.5096025", "0.5051921", "0.50324756", "0.5027518", "0.50227654", "0.49056938", "0.48989987", "0.48988622", "0.4888863", "0.4885868", "0.4884632...
0.6714993
0
Map MXNet's L2Normalization operator attributes to onnx's LpNormalization operator and return the created node.
def convert_l2normalization(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) mode = attrs.get("mode", "instance") if mode != "channel": raise AttributeError("L2Normalization: ONNX currently supports channel mode only") l2norm_node = onnx.helper.make_node( "LpNormal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_norm(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n axis = op.attr(\"axis\")\n axis_l = [axis]\n epsilon = op.attr(\"epsilon\")\n out = _op.nn.l2_normalize(x, epsilon, axis_l)\n g.add_node(op.output(\"Out\")[0], out)", "def convert_norm(node, **kwargs):\n name, input_nod...
[ "0.59415656", "0.5882721", "0.58236057", "0.5708504", "0.5625045", "0.54728884", "0.54538465", "0.53243077", "0.5301751", "0.52801716", "0.5251732", "0.51723593", "0.5098865", "0.50875914", "0.5062995", "0.5036322", "0.5006597", "0.4991197", "0.49699366", "0.49565876", "0.491...
0.71821564
0
Map MXNet's Dropout operator attributes to onnx's Dropout operator and return the created node.
def convert_dropout(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) probability = float(attrs.get("p", 0.5)) probability = np.array(probability, dtype=np.float32) training_mode = False training_mode = np.array(training_mode, dtype=np.bool) node_ratio = create_helper_tenso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_dropout(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('ratio', op.ratio),\n ])\n return node", "def _create_dropout(cls, onnx_node, inputs, opset_version):\n ratio = onnx_node....
[ "0.7353928", "0.65540075", "0.6395461", "0.6285999", "0.5709964", "0.55830383", "0.55629826", "0.55001", "0.5478698", "0.5474093", "0.546457", "0.53771776", "0.53521633", "0.5260273", "0.5242218", "0.51851434", "0.5174336", "0.5164886", "0.5147427", "0.51048636", "0.5103446",...
0.7049092
1
Map MXNet's argmax operator attributes to onnx's ArgMax operator and return the created node.
def convert_argmax(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) axis = int(attrs.get("axis")) keepdims = get_boolean_attribute_value(attrs, "keepdims") node = onnx.helper.make_node( 'ArgMax', inputs=input_nodes, axis=axis, keepdims=keepdims, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_maximum(node, **kwargs):\n return create_basic_op_node('Max', node, kwargs)", "def convert_max(node, **kwargs):\n name, input_nodes, attrs = get_inputs(node, kwargs)\n\n mx_axis = attrs.get(\"axis\", None)\n axes = convert_string_to_list(str(mx_axis)) if mx_axis is not None else None\n\n ...
[ "0.70940566", "0.6874972", "0.61902833", "0.61549073", "0.61046344", "0.60914123", "0.6080087", "0.5927143", "0.5927143", "0.5880221", "0.58306336", "0.57700604", "0.57442945", "0.57169616", "0.56744826", "0.5666791", "0.56665546", "0.5664926", "0.5634875", "0.5621766", "0.55...
0.7944788
0
Map MXNet's max operator attributes to onnx's ReduceMax operator and return the created node.
def convert_max(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) mx_axis = attrs.get("axis", None) axes = convert_string_to_list(str(mx_axis)) if mx_axis is not None else None keepdims = get_boolean_attribute_value(attrs, "keepdims") if axes is not None: node = onnx.he...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_maximum(node, **kwargs):\n return create_basic_op_node('Max', node, kwargs)", "def max(x, reduce_instance_dims=True, name=None): # pylint: disable=redefined-builtin\n return _numeric_combine(x, np.max, reduce_instance_dims, name)", "def convert_argmax(node, **kwargs):\n name, input_nodes, a...
[ "0.7659286", "0.6377665", "0.6145082", "0.6139816", "0.6064376", "0.6055874", "0.6041896", "0.6037136", "0.5989364", "0.5909807", "0.5900593", "0.5855207", "0.58143365", "0.5796772", "0.57937384", "0.57896626", "0.5788211", "0.578123", "0.5748129", "0.57333666", "0.57123965",...
0.7726849
0
Map MXNet's mean operator attributes to onnx's ReduceMean operator and return the created node.
def convert_mean(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) mx_axis = attrs.get("axis", None) axes = convert_string_to_list(str(mx_axis)) if mx_axis is not None else None keepdims = get_boolean_attribute_value(attrs, "keepdims") if axes is not None: node = onnx.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reduce_mean_02():\n\n class ReduceMeanTester(Base):\n def create_onnx(self) -> onnx.ModelProto:\n node = make_node(\"ReduceMean\", inputs=[\"v0\"], outputs=[\"v1\"], axes=[1, 2])\n inputs = [info(\"v0\", TensorProto.FLOAT, (1, 3, 4, 5))]\n outputs = [info(\"v1\",...
[ "0.6283045", "0.6170426", "0.61373425", "0.58561695", "0.5818263", "0.5725782", "0.5599807", "0.5562414", "0.5543096", "0.5514586", "0.5514586", "0.5514586", "0.5514586", "0.5514586", "0.54903483", "0.5438709", "0.5438554", "0.53819174", "0.53819174", "0.5381861", "0.5380131"...
0.7579308
0
Map MXNet's Cast operator attributes to onnx's Cast operator and return the created node.
def convert_cast(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) dtype = attrs["dtype"] # dtype can be mapped only with types from TensorProto # float32 is mapped to float and float64 to double in onnx # following tensorproto mapping https://github.com/onnx/onnx/blob/master/on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_cast(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n map_dict = {\n tensor.float32: TensorProto.FLOAT, # FLOAT to float32\n tensor.int32: TensorProto.INT32, # INT32 to int32\n }\n node.attribute.extend([\n helpe...
[ "0.72991306", "0.70823056", "0.6469727", "0.6260471", "0.58524877", "0.56869894", "0.5614678", "0.5614463", "0.5590272", "0.5541235", "0.5510816", "0.5470201", "0.54070497", "0.5351177", "0.53237814", "0.5306725", "0.5301981", "0.5294145", "0.528131", "0.5262491", "0.5260314"...
0.67715365
2
Map MXNet's SliceChannel operator attributes to onnx's Squeeze or Split operator based on squeeze_axis attribute and return the created node.
def convert_slice_channel(node, **kwargs): name, input_nodes, input_shapes, attrs = get_inputs(node, kwargs, with_shapes=True) num_outputs = int(attrs.get("num_outputs")) axis = int(attrs.get("axis", 1)) squeeze_axis = int(attrs.get("squeeze_axis", 0)) if squeeze_axis == 1 and num_outputs == 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_squeeze(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('axes', list(op.axis)),\n ])\n return node", "def _create_squeeze(cls, onnx_node, inputs, opset_version):\n axes = onnx_no...
[ "0.6746628", "0.6559421", "0.61696434", "0.61142856", "0.5958457", "0.5643979", "0.5640216", "0.54976195", "0.54508215", "0.54356575", "0.53339934", "0.53273505", "0.51586306", "0.5094175", "0.5021248", "0.50043905", "0.49964705", "0.49707195", "0.4929398", "0.4861826", "0.48...
0.669003
1
Map MXNet's expand_dims operator attributes to onnx's Unsqueeze operator and return the created node.
def convert_expand_dims(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) axis = int(attrs.get("axis")) node = onnx.helper.make_node( "Unsqueeze", input_nodes, [name], axes=[axis], name=name, ) return [node]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_squeeze(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('axes', list(op.axis)),\n ])\n return node", "def _create_squeeze(cls, onnx_node, inputs, opset_version):\n axes = onnx_no...
[ "0.7386183", "0.6739398", "0.6726751", "0.637353", "0.62995607", "0.60692775", "0.60286963", "0.60238683", "0.59741277", "0.59160703", "0.5735533", "0.5717082", "0.5696729", "0.5589094", "0.55591923", "0.5529139", "0.55204725", "0.5500257", "0.54655224", "0.54617375", "0.5455...
0.716333
1
Map MXNet's squeeze operator attributes to onnx's squeeze operator and return the created node.
def convert_squeeze(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) axis = attrs.get("axis", None) if not axis: raise AttributeError("Squeeze: Missing axis attribute: ONNX currently requires axis to " "be specified for squeeze operator") axis = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_squeeze(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('axes', list(op.axis)),\n ])\n return node", "def _create_squeeze(cls, onnx_node, inputs, opset_version):\n axes = onnx_no...
[ "0.7598868", "0.717895", "0.6282262", "0.60528755", "0.5627854", "0.5592299", "0.5459605", "0.53992504", "0.5209412", "0.52017725", "0.5185037", "0.5168814", "0.5109538", "0.50819665", "0.50502604", "0.5031043", "0.500968", "0.49988806", "0.49876928", "0.49575466", "0.4944436...
0.6714586
2
Map MXNet's reciprocal operator attributes to onnx's Reciprocal operator and return the created node.
def convert_reciprocal(node, **kwargs): return create_basic_op_node('Reciprocal', node, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n new_node = Node()\n new_node.op = self\n return new_node", "def __call__(self):\r\n new_node = Op.__call__(self)\r\n return new_node", "def __call__(self):\n new_node = Op.__call__(self)\n return new_node", "def __call__(self):\r\n ...
[ "0.5679397", "0.56778276", "0.56740934", "0.56724566", "0.56111914", "0.5536893", "0.54996645", "0.5413009", "0.5394044", "0.53590983", "0.5352823", "0.53090364", "0.53014636", "0.5288799", "0.525179", "0.52360773", "0.5220722", "0.5163405", "0.5150799", "0.51470494", "0.5146...
0.689847
0
Map MXNet's hard_sigmoid operator attributes to onnx's HardSigmoid operator and return the created node.
def convert_hardsigmoid(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) # Converting to float32 alpha = float(attrs.get("alpha", 0.2)) beta = float(attrs.get("beta", 0.5)) node = onnx.helper.make_node( 'HardSigmoid', input_nodes, [name], alpha=a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_hardsigmoid(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('alpha', op.alpha),\n helper.make_attribute('beta', op.gamma),\n ])\n return node", "def _create_hardsigmoid(cls, ...
[ "0.8193963", "0.7711967", "0.72541773", "0.6859289", "0.67957366", "0.6224166", "0.6205663", "0.62023205", "0.61203086", "0.608539", "0.6069968", "0.6067994", "0.6048303", "0.5977827", "0.59394383", "0.59345216", "0.5905961", "0.584112", "0.57807565", "0.5772983", "0.5710771"...
0.75288194
2
Map MXNet's broadcast logical or operator attributes to onnx's Or operator and return the created node.
def convert_broadcast_logical_or(node, **kwargs): return create_basic_op_node('Or', node, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_broadcast_logical_xor(node, **kwargs):\n return create_basic_op_node('Xor', node, kwargs)", "def convert_broadcast_logical_and(node, **kwargs):\n return create_basic_op_node('And', node, kwargs)", "def create_net(self, shape1, shape2, ir_version):\n\n #\n # Create ONNX model\n...
[ "0.6557331", "0.59182656", "0.58574575", "0.5785354", "0.5779746", "0.5683941", "0.563225", "0.5597137", "0.5566193", "0.5559112", "0.55208814", "0.5506325", "0.5495919", "0.5447485", "0.54401416", "0.54356146", "0.54324657", "0.54322755", "0.5418937", "0.54083866", "0.540492...
0.76808363
0
Map MXNet's broadcast logical xor operator attributes to onnx's Xor operator and return the created node.
def convert_broadcast_logical_xor(node, **kwargs): return create_basic_op_node('Xor', node, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_broadcast_logical_or(node, **kwargs):\n return create_basic_op_node('Or', node, kwargs)", "def xor(self, *args):\n return Xor(self, *args)", "def xor_network():\n # fmt: off\n tpm = np.array([\n [0, 0, 0],\n [0, 1, 1],\n [1, 0, 1],\n [1, 1, 0],\n [...
[ "0.738217", "0.64635605", "0.6400872", "0.62084186", "0.5969626", "0.59505045", "0.59500635", "0.58331794", "0.58050483", "0.57880586", "0.56789726", "0.5678336", "0.5673798", "0.567273", "0.5661514", "0.5651046", "0.5638466", "0.5637232", "0.55427027", "0.5538561", "0.548832...
0.79945916
0
Map MXNet's ROIPooling operator attributes to onnx's MaxRoiPool operator and return the created node.
def convert_roipooling(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) pooled_shape = convert_string_to_list(attrs.get('pooled_size')) scale = float(attrs.get("spatial_scale")) node = onnx.helper.make_node( 'MaxRoiPool', input_nodes, [name], pooled_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_pooling(node, **kwargs):\n name, input_nodes, attrs = get_inputs(node, kwargs)\n\n kernel = eval(attrs[\"kernel\"])\n pool_type = attrs[\"pool_type\"] if attrs.get(\"pool_type\") else \"max\"\n stride = eval(attrs[\"stride\"]) if attrs.get(\"stride\") else (1, 1)\n global_pool = get_bool...
[ "0.641093", "0.58088446", "0.56600386", "0.5579279", "0.55671954", "0.55426383", "0.5540293", "0.54378605", "0.5431979", "0.54058385", "0.5381407", "0.5371967", "0.5365166", "0.53410465", "0.5257729", "0.52336967", "0.5228986", "0.5204838", "0.51902246", "0.5179581", "0.51613...
0.7807513
0
Map MXNet's broadcast_to operator attributes to onnx's Expand operator and return the created node.
def convert_broadcast_to(node, **kwargs): name, input_nodes, attrs = get_inputs(node, kwargs) shape_list = convert_string_to_list(attrs["shape"]) initializer = kwargs["initializer"] output_shape_np = np.array(shape_list, dtype='int64') data_type = onnx.mapping.NP_TYPE_TO_TENSOR_TYPE[output_shape_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_expand_as(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n target_shape = op.attr(\"target_shape\")\n out = _op.broadcast_to(x, target_shape)\n g.add_node(op.output(\"Out\")[0], out)", "def convert_broadcast_power(node, **kwargs):\n return create_basic_op_node('Pow', node, kwarg...
[ "0.6505846", "0.604694", "0.60059506", "0.59943974", "0.5957492", "0.5825268", "0.5748968", "0.57150435", "0.5620855", "0.5597498", "0.55732626", "0.5556347", "0.5554119", "0.5502286", "0.54921335", "0.5468958", "0.5464709", "0.5461847", "0.5448856", "0.54340446", "0.53191674...
0.74339557
0
raise from_none(ValueError('a')) == raise ValueError('a') from None
def from_none(exc): exc.__cause__ = None exc.__suppress_context__ = True return exc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fail(raise_):\n if raise_:\n raise _UnexpectedForm()\n return None", "def test_invalid_argument_type(self):\n t = TruthTable('A or B')\n\n with self.assertRaises(InvalidArgumentTypeError):\n t.equivalent_to(float())\n\n with self.assertRaises(InvalidArgumentTypeE...
[ "0.65491164", "0.6507355", "0.63295954", "0.61693627", "0.6143416", "0.60782343", "0.59815896", "0.5925763", "0.5909486", "0.5908904", "0.5904242", "0.58995235", "0.5848055", "0.5834902", "0.5818783", "0.57958984", "0.5760411", "0.5742847", "0.57380986", "0.5723444", "0.57004...
0.68841505
0
Applies selected activation function to intermediate output.
def apply_activation(intermediate_output, intermediate_activation): if intermediate_activation is None: return intermediate_output if intermediate_activation == 'gelu': intermediate_output = nn.gelu(intermediate_output) elif intermediate_activation == 'relu': intermediate_output = nn.relu(intermediat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_layer_activation(x):\n return x", "def uf_activate(self, output_reg):\n if len(self.inputs) is 2:\n self.two_activation(output_reg)\n elif len(self.inputs) is 3:\n self.three_activation(output_reg)\n else:\n self.large_activation(output_reg)", ...
[ "0.7604806", "0.7194517", "0.6661993", "0.6523873", "0.64537185", "0.6431659", "0.64278513", "0.6370167", "0.63165534", "0.6285312", "0.6285312", "0.6214801", "0.6194766", "0.6191587", "0.6181813", "0.614133", "0.6128814", "0.6084095", "0.607957", "0.6078586", "0.60711646", ...
0.7784417
0
Return tf mlperf model parameters in a dictionary format. Use get_tf_model_variables if using kerasBERT checkpoint. This function works
def get_mlperf_model_variables(config_path, init_checkpoint): # Load saved model configuration bert_config = modeling.BertConfig.from_json_file(config_path) seq_length = bert_config.max_position_embeddings tf_variables = {} max_predictions_per_seq = 76 # Generate BERT TF model and initiate variable update ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_model():\n train_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)\n msg = [\"\"]\n total = 0\n for v in train_vars:\n shape = v.get_shape()\n ele = shape.num_elements()\n total += ele\n msg.append(\"{}: shape={}, dim={}\".format(\n v.name, s...
[ "0.65184647", "0.65112454", "0.638817", "0.63505626", "0.6223993", "0.6148675", "0.6122482", "0.6062248", "0.6055513", "0.6027013", "0.600799", "0.59653383", "0.59652144", "0.5957283", "0.59522676", "0.5892172", "0.58268005", "0.5810189", "0.58081865", "0.57768404", "0.577381...
0.7301645
0
Return tf model parameters in a dictionary format.
def get_tf_model_variables(config_path, init_checkpoint): # Load saved model configuration config = configs.BertConfig.from_json_file(config_path) # Generate BERT TF model and initiate variable update from checkpoint seq_len = 20 _, tf_model = bert_models.squad_model(config, seq_len) checkpoint = tf.train....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_model(self):\n\n parameters = {keys._topology:self.topology,\n keys._size:self.size,\n keys._name:self.name,\n #keys._output_activation:self._outActiv_fun_key,\n #keys._hidden_activation:self._hiddenActiv_fun_key,\n...
[ "0.73577815", "0.7218848", "0.7189309", "0.7117365", "0.71154326", "0.7032748", "0.70010006", "0.6994405", "0.69852734", "0.69549537", "0.6953729", "0.6948936", "0.69394284", "0.6904722", "0.6866829", "0.6861575", "0.6858673", "0.6855758", "0.6850728", "0.68482053", "0.681446...
0.0
-1
Compute the transformation matrix from Magellanic Stream coordinates to spherical Galactic.
def MS_to_galactic(): return matrix_transpose(MS_MATRIX)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galactic_to_MS():\n return MS_MATRIX", "def get_transformation_matrix(theta=45):\n\n theta = theta/360 * 2 * np.pi # in radians\n hx = np.cos(theta)\n sy = np.sin(theta)\n\n S = np.array([[1, hx, 0],\n [0, sy, 0],\n [0, 0, 1]])\n #S_inv = np.linalg.inv(S)\n...
[ "0.6758652", "0.6351473", "0.6289319", "0.6249192", "0.5900926", "0.58043545", "0.5739055", "0.55864763", "0.558487", "0.55819327", "0.55792", "0.55535346", "0.5547185", "0.5533851", "0.55322266", "0.55322266", "0.55189437", "0.551152", "0.5510809", "0.54767853", "0.5444235",...
0.67547804
1
Check on input data for proper shape and dtype
def _convert_to_vector_type(self, vectors): if vectors.shape[-1] == 4 and vectors.ndim == 2: coord_list = self._convert_coords_to_coordinates(vectors) self._data_type = self._data_types[1] elif vectors.shape[-1] == 2 and vectors.ndim == 3: coord_list = self._convert_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape(placeholder_shape, data_shape):\n\n return True", "def check_dims(self, data):\n if np.ndim(data) != 2:\n raise ValueError('Input data must be a two dimensional numpy array. '\n 'Data received has shape (%g, %g).' % data.shape)", "def check_data_shape(self, dat...
[ "0.7713703", "0.76080585", "0.74882436", "0.7184162", "0.71101797", "0.70855606", "0.7055508", "0.7006338", "0.6966901", "0.6945867", "0.6939449", "0.69268495", "0.69028056", "0.68751085", "0.6828708", "0.6807963", "0.67849463", "0.6784447", "0.6716908", "0.67096233", "0.6709...
0.0
-1
Sets the view given the indices to slice with.
def _set_view_slice(self, indices): vertices = self._mesh_vertices faces = self._mesh_triangles if len(faces) == 0: self._node.set_data(vertices=None, faces=None) else: self._node.set_data(vertices=vertices[:, ::-1], faces=faces, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, indices: Tuple[int, ...], slices: Tuple[slice, ...] = (slice(0, 0, 0),)):\n self.indices = indices\n self.slices = slices", "def _set_neighs_slice(self, key):\n ## Condition to use slice type\n self._constant_neighs = True\n self.ks = range(1) if self.ks is N...
[ "0.62833464", "0.61686224", "0.6001683", "0.58963263", "0.5595757", "0.5592054", "0.5561091", "0.55347645", "0.5515838", "0.55009526", "0.5443674", "0.5426867", "0.5424508", "0.53574157", "0.52848315", "0.52843475", "0.5270382", "0.5265261", "0.52636987", "0.5232416", "0.5228...
0.77993363
0
Utility function zed.uchicago.edu Converts list into string separated by dashes or empty string if input list is not list or is empty
def stringify(List): if List is None: return '' if not List: return '' return '-'.join(str(elem) for elem in List)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_to_string(in_list):\n if not in_list:\n return \"[]\"\n else:\n return \"\\n- \" + \"\\n- \".join(in_list)", "def list_to_str( L ):\n if len(L) == 0: return ''\n return L[0] + list_to_str( L[1:] )", "def list_to_str( L ):\n if len(L) == 0: return ''\n return L[0] + list_to_str(...
[ "0.7693768", "0.6974077", "0.6974077", "0.6955682", "0.6715619", "0.6706818", "0.66814554", "0.6577999", "0.6566847", "0.65541935", "0.65537137", "0.65157914", "0.6480404", "0.64604145", "0.6455032", "0.6404342", "0.63729745", "0.63619614", "0.63449293", "0.6314343", "0.62951...
0.7753648
0
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary primary_language = dictionary.get('PrimaryLanguage') secondary_language = dictionary.get('SecondaryLanguage') xml_signatur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83181584", "0.8168118", "0.8168118", "0.8118749", "0.8089047", "0.79787344", "0.7949278", "0.79231393", "0.7898951", "0.78923255", "0.7882321", "0.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407"...
0.788838
10
Gets the stateaction value of the target network. That is, the current estimate of the target network for the next state including the seen reward.
def get_dqg_target(self, next_states, rewards, gamma, dones): # Get predicted Q values qtarget_values = self.qnetwork_target(next_states).detach() # get max of it best_qtarget_value = qtarget_values.max(1) # reduce one dimension best_qtarget_value = best_qtarget_value[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state_action_value(self, state, action):\n state_tensor = torch.from_numpy(state).float().to(self.device)\n output = torch.dot(self.weights[action,:],state_tensor.view(-1))\n return output", "def get_value(self, state):\n epsilon = self.epsilon\n possible_actions = self...
[ "0.74637866", "0.738342", "0.7381812", "0.72057045", "0.7147627", "0.7144865", "0.7104878", "0.7084618", "0.7046648", "0.7013591", "0.69931084", "0.6982195", "0.69723356", "0.69467", "0.6917595", "0.69127136", "0.68956476", "0.68674845", "0.67943704", "0.67933476", "0.6788547...
0.0
-1
Gets shortest angular distance between two positions regardless of direction
def get_abs_dist(self, pos1, pos2): return min(abs(pos1 - pos2), abs(pos1 - pos2 + 360))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_distance(first: Waypoint, second: Waypoint) -> int:\n return int(distance.vincenty(first.coords(), second.coords()).m)", "def get_position_distance(pos1, pos2, ignore_strand=False):\n NaN = float('nan')\n if pos1 in SPECIAL_POSITIONS.all_undefined: return NaN\n elif pos2 in S...
[ "0.7098709", "0.70844555", "0.6993295", "0.69222057", "0.68783516", "0.68510944", "0.6760011", "0.6758225", "0.6641673", "0.66253275", "0.66251695", "0.66108775", "0.6573693", "0.65723246", "0.65262455", "0.6504858", "0.6500021", "0.6487806", "0.644004", "0.64247996", "0.6398...
0.68771785
5
Change the password used to protect OATH accounts. Allows you to set or change a password that will be required to access the OATH accounts stored on the YubiKey.
def change(ctx, password, clear, new_password, remember): if clear and new_password: ctx.fail("--clear cannot be combined with --new-password.") _init_session(ctx, password, False, prompt="Enter the current password") session = ctx.obj["session"] keys = ctx.obj["oath_keys"] device_id = ses...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_password(change_account):\n change_data(change_account, changed_data='password')", "def setpassword(self, pwd):\n pass", "def change_password(self, new_password):\n dev = self.nearest_pandevice()\n self.password_hash = dev.request_password_hash(new_password)\n self.upd...
[ "0.7618517", "0.746997", "0.7434945", "0.7257479", "0.7143954", "0.70882785", "0.70502394", "0.7047161", "0.6986982", "0.6944256", "0.6928588", "0.69195575", "0.68995327", "0.68914664", "0.6882281", "0.68337", "0.6824367", "0.6823735", "0.6792913", "0.67883617", "0.67817914",...
0.73968214
3
Store the YubiKeys password on this computer to avoid having to enter it on each use.
def remember(ctx, password): session = ctx.obj["session"] device_id = session.device_id keys = ctx.obj["oath_keys"] if not session.locked: if device_id in keys: del keys[session.device_id] keys.write() logger.info("Deleted remembered access key") clic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_password(self):\n Credential.passwords.append(self)", "def save_password(self, new_password):\n # 55 iterations takes about 100 ms on a Netgear WNDR3800 or about 8ms on a\n # Core2 Duo at 1200 MHz.\n hashed = pbkdf2.crypt(new_password, iterations=55)\n self.write(self....
[ "0.6675744", "0.65866464", "0.65817255", "0.63898677", "0.6381752", "0.63418746", "0.6293246", "0.6226015", "0.62100047", "0.6160657", "0.61586887", "0.6145468", "0.6143356", "0.6109165", "0.59605056", "0.59529567", "0.5867149", "0.582038", "0.580043", "0.5765957", "0.5743831...
0.6156244
11
Home page for app (and project)
def index(request): username = request.session.get('username', False) profile = request.session.get('profile', False) baseurl = '' workpath = os.path.dirname(os.path.abspath(__file__)) # Returns the Path your .py file is in with open((os.path.join(workpath,'../baseurl.txt')),'r',encoding='utf-8') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)", "def home():\r\n return render_template(\r\n 'index.html',\r\n title='Home Page',\r\n year=datetime.now().year,\r\n )", "def homepage():\n return render_template('h...
[ "0.8311739", "0.81331044", "0.81042373", "0.80418706", "0.80418706", "0.80418706", "0.80418706", "0.80418706", "0.80418706", "0.80418706", "0.80418706", "0.80418706", "0.80418706", "0.8040029", "0.799967", "0.79859835", "0.7929723", "0.79114187", "0.7904756", "0.7903732", "0....
0.0
-1
Tutorial page for app
def tutorial(request): username = request.session.get('username', False) profile = request.session.get('profile', False) if(username): context = {'username': username,'profile':profile} return render(request, 'MedTAG_sket_dock_App/index.html', context) else: return redirect('Med...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tutorials(request):\n # Test Comment\n assert isinstance(request, HttpRequest)\n return render(\n request,\n 'tutorials.html',\n context_instance=RequestContext(request, {})\n )", "def callForTutorials(request):\n # Test Comment\n assert isinstance(request, HttpRequest)...
[ "0.7307964", "0.67953116", "0.6754259", "0.66745186", "0.66534", "0.6528225", "0.64401436", "0.64039856", "0.63926584", "0.63527006", "0.6335105", "0.62391394", "0.6103462", "0.60975313", "0.6084304", "0.6075097", "0.6068865", "0.603304", "0.6026463", "0.59866536", "0.5966442...
0.5979742
20
This view checks if a user has an associated gt for a report
def check_gt_existence(request): action = request.GET.get('action',None) id_report = request.GET.get('id_report',None) language = request.GET.get('language',None) username = request.session['username'] mode = request.session['mode'] cursor = connection.cursor() cursor.execute("SELECT COUNT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reported_by(self, user):\n return Report.objects.filter(recipe=self, chef=user).exists()", "def has_ta(self, user, allow_superusers=True):\n return (user.is_superuser and allow_superusers) or len(self.tas.filter(id=user.id)) > 0", "def _can_download_report(user):\r\n try:\r\n access...
[ "0.6260666", "0.6116303", "0.5899749", "0.5702829", "0.5593343", "0.5565848", "0.5547417", "0.5547417", "0.5541943", "0.5512871", "0.55068207", "0.5493356", "0.54900455", "0.5473812", "0.5417657", "0.53915375", "0.5383512", "0.53717935", "0.5370812", "0.53642553", "0.5324591"...
0.5986029
2
Returns True if |benchmark| has a valid type.
def validate_type(benchmark): benchmark_type = get_type(benchmark) if benchmark_type not in BENCHMARK_TYPE_STRS: logs.error('%s has an invalid benchmark type %s, must be one of %s', benchmark, benchmark_type, BENCHMARK_TYPE_STRS) return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(benchmark):\n if not validate_name(benchmark):\n return False\n\n if benchmark not in get_all_benchmarks():\n logs.error('%s must have a benchmark.yaml.', benchmark)\n return False\n\n # Validate config file can be parsed.\n try:\n get_fuzz_target(benchmark)\n ...
[ "0.6986698", "0.6440675", "0.6303851", "0.62154716", "0.6090882", "0.608178", "0.6064316", "0.6046675", "0.5970051", "0.5952641", "0.58843154", "0.58391774", "0.5755268", "0.57513607", "0.5732901", "0.57144207", "0.56996477", "0.56742626", "0.55769104", "0.5570763", "0.556722...
0.837678
0
Initializes this object's schema, input_files and output_path.
def __init__(self, schema, input_files, output_path): self.schema = schema self.input_files = input_files self.output_path = output_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n self.read_input_file()\n self.read_simulation_files()", "def __init__(self):\n\t\tself.parsed = False\n\t\tdir_path = os.path.dirname(os.path.realpath(__file__))\n\t\tself.xsdfilename = os.path.join(dir_path, 'xml', 'schema.xsd')\n\t\tself.schema = 'schema.xsd'\n\t\tself.pr...
[ "0.69186145", "0.6781864", "0.6756163", "0.6735031", "0.6637486", "0.6575436", "0.6545899", "0.65405905", "0.6535554", "0.65054566", "0.6497379", "0.6446711", "0.6439875", "0.64162254", "0.6388665", "0.63697845", "0.63621044", "0.63425386", "0.6337463", "0.6333185", "0.633097...
0.8291974
0
Delete all the processed files.
def clean(): clean_flatbuffer_binaries() clean_webp_textures()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_files(self):\n\n self.backup_files()\n self.delete_files()", "def teardown():\n for filename in files_to_delete:\n delete_file(filename)", "def deleteAllFiles(self, flush=True): \n \n if flush: \n self.flush(False) \n \n for filePath i...
[ "0.8073947", "0.79849833", "0.77544034", "0.76999974", "0.7654225", "0.7631646", "0.75604534", "0.753863", "0.753267", "0.74747413", "0.74153626", "0.7402632", "0.74007124", "0.737596", "0.73452044", "0.7335899", "0.72531056", "0.72057813", "0.7180837", "0.71535826", "0.71242...
0.0
-1
Plots an image and the projections (sums) of it on the x, y axes.
def plot_image_and_proj(image, title="", **kwargs): fig = plt.figure() gs = gridspec.GridSpec(3, 2, width_ratios=[3, 1], height_ratios=[0.2, 3, 1]) ax0 = plt.subplot(gs[1,0]) plt.title(title) ims = plt.imshow(image, aspect="auto", **kwargs) ax2 = plt.subplot(gs[2,0], sharex=ax0, ) plt....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(image):\n fig = pyplot.figure()\n ax = fig.add_subplot(1,1,1)\n imgplot = ax.imshow(image, cmap=mpl.cm.Greys)\n imgplot.set_interpolation('nearest')\n ax.xaxis.set_ticks_position('top')\n ax.yaxis.set_ticks_position('left')\n pyplot.show()", "def show(image):\n fig = pyplot.figur...
[ "0.6885412", "0.6744014", "0.6729617", "0.6729617", "0.6729617", "0.66539717", "0.6561349", "0.6445221", "0.64222753", "0.6366756", "0.62954986", "0.62783086", "0.6277011", "0.6251577", "0.623828", "0.62100685", "0.62035716", "0.6173411", "0.6167177", "0.61653167", "0.6155882...
0.7413701
0
rebins a numpy array.
def rebin(a, *args): shape = a.shape lenShape = len(shape) factor = np.asarray(shape) / np.asarray(args) #print factor evList = ['a.reshape('] + ['args[%d],factor[%d],' % (i, i) for i in range(lenShape)] + [')'] + ['.mean(%d)' % (i + 1) for i in range(lenShape)] return eval(''.join(evList))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebin(array, dimensions=None, scale=None):\n if dimensions is not None:\n if isinstance(dimensions, float):\n dimensions = [int(dimensions)] * len(array.shape)\n elif isinstance(dimensions, int):\n dimensions = [dimensions] * len(array.shape)\n elif len(dimensions)...
[ "0.7262481", "0.65253717", "0.65092903", "0.64562315", "0.63404644", "0.633843", "0.6212981", "0.62020236", "0.6028213", "0.5951686", "0.5910494", "0.5862693", "0.57666206", "0.57557595", "0.57353413", "0.5715855", "0.5715112", "0.5693231", "0.5686959", "0.56741536", "0.56739...
0.5666983
22
Class to create sqlalchemy engine that creates a connection to the postgresql database
def __init__(self): with open('config.json') as config: data = json.load(config) password = self.decode_password(data['db']['password']) db_conn_string = 'postgresql://' + data['db']['username'] + ':' + password + '@' + \ data['db']['hostname'] + ':' + data['db'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_engine(self):\n connection_string = f'postgresql://{self.user}:{self.password}@{self.host}/{self.database_name}'\n return create_engine(connection_string)", "def postgres_engine():\n return create_engine(\n \"postgresql+psycopg2://postgres:postgres@localhost:5432/postgres\"\n ...
[ "0.85938287", "0.81512064", "0.7748867", "0.7690821", "0.76155734", "0.75913906", "0.75913906", "0.75913906", "0.75913906", "0.7512063", "0.75113755", "0.75113755", "0.75113755", "0.75113755", "0.75113755", "0.74599236", "0.74490184", "0.7440237", "0.7433673", "0.7428703", "0...
0.7128721
37
Fetch table rows as DataFrame from DB
def fetch_db_dataframe(self, table_name): try: df = pd.read_sql("SELECT * from " + table_name, self.engine) print("-I- Completed read of DataFrame from " + table_name) return df except Exception as e: print("-W- " + str(e))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_df_from_db(self, query):\n cursor = self.conn.cursor()\n cursor.execute(query)\n data = cursor.fetchall()\n col_des = cursor.description\n col_des = [tuple([x[0].split('.')[1] if '.' in x[0] else x[0]] + list(x[1:])) for x in col_des]\n col_name = [col_des[i][0] fo...
[ "0.77204275", "0.7645398", "0.7582545", "0.75139314", "0.7212028", "0.71883446", "0.7178315", "0.71595347", "0.7121151", "0.71134925", "0.7097488", "0.7083992", "0.70649976", "0.70540386", "0.70290405", "0.7011723", "0.6963181", "0.6963087", "0.6963087", "0.6942861", "0.69389...
0.7459254
4