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 |
|---|---|---|---|---|---|---|
Gets the resource policy for a station | def get_station_resource_policy(self, station_id):
return self._stations_service.get_station_resource_policy(station_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_station_lz_resource_policy(self, station_id, lz_id):\n return self._stations_service.get_station_lz_resource_policy(\n station_id, lz_id\n )",
"def get_station_user_resource_policy(self, station_id, userid):\n return self._stations_service.get_station_user_resource_policy(... | [
"0.7137783",
"0.68996143",
"0.65437603",
"0.64618856",
"0.6394285",
"0.62970984",
"0.62638164",
"0.6257891",
"0.6249871",
"0.6249871",
"0.6163805",
"0.6138999",
"0.6137637",
"0.601811",
"0.601811",
"0.5977792",
"0.59732735",
"0.59732735",
"0.59732735",
"0.59601575",
"0.595981... | 0.8375346 | 0 |
Returns the user's calculated (or effective) resource policy in the station. | def get_self_station_resource_limits(self, station_id):
return self._stations_service.get_self_resource_limits(station_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_station_user_resource_policy(self, station_id, userid):\n return self._stations_service.get_station_user_resource_policy(\n station_id, userid\n )",
"def policy(self) -> pulumi.Output['outputs.ServicePolicy']:\n return pulumi.get(self, \"policy\")",
"def policy(self) -> ... | [
"0.69573486",
"0.6920247",
"0.6906621",
"0.6906621",
"0.6906621",
"0.6848408",
"0.6824488",
"0.67560124",
"0.66650236",
"0.66650236",
"0.66650236",
"0.66113013",
"0.66027576",
"0.66027576",
"0.65952986",
"0.65764415",
"0.65764415",
"0.6349191",
"0.6294199",
"0.6294199",
"0.62... | 0.0 | -1 |
Gets the resource policy for a station user. | def get_station_user_resource_policy(self, station_id, userid):
return self._stations_service.get_station_user_resource_policy(
station_id, userid
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_station_resource_policy(self, station_id):\n return self._stations_service.get_station_resource_policy(station_id)",
"def get_sp_policy(self, context, id):\n # handling policy method in RPC\n response = self.dns_manager.get_sp_policy(context, id)\n return response",
"def get... | [
"0.75928956",
"0.6324284",
"0.63131595",
"0.6269006",
"0.6251828",
"0.62097424",
"0.6201756",
"0.6140907",
"0.6137804",
"0.61294985",
"0.60993993",
"0.60781956",
"0.60781956",
"0.6061294",
"0.60529894",
"0.5937276",
"0.5937276",
"0.59300405",
"0.59284604",
"0.5907746",
"0.589... | 0.83362406 | 0 |
Gets the resource policy for a station role. | def get_station_role_resource_policy(self, station_id, role_id):
return self._stations_service.get_station_role_resource_policy(
station_id, role_id
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_station_resource_policy(self, station_id):\n return self._stations_service.get_station_resource_policy(station_id)",
"def get_station_lz_resource_policy(self, station_id, lz_id):\n return self._stations_service.get_station_lz_resource_policy(\n station_id, lz_id\n )",
"d... | [
"0.7808498",
"0.6741654",
"0.67381155",
"0.6363718",
"0.61435103",
"0.6060915",
"0.60048324",
"0.59662515",
"0.5936198",
"0.5916579",
"0.5856011",
"0.5811339",
"0.5811339",
"0.5806208",
"0.5722528",
"0.56213796",
"0.56213796",
"0.56213796",
"0.56205785",
"0.56205785",
"0.5620... | 0.8424791 | 0 |
Gets the resource policy for a station lz. | def get_station_lz_resource_policy(self, station_id, lz_id):
return self._stations_service.get_station_lz_resource_policy(
station_id, lz_id
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_station_resource_policy(self, station_id):\n return self._stations_service.get_station_resource_policy(station_id)",
"def get_station_user_resource_policy(self, station_id, userid):\n return self._stations_service.get_station_user_resource_policy(\n station_id, userid\n )"... | [
"0.79656065",
"0.6517987",
"0.64155436",
"0.63686657",
"0.62979114",
"0.6194501",
"0.6194501",
"0.6139178",
"0.61108494",
"0.6098003",
"0.6068526",
"0.6058087",
"0.6056583",
"0.5989978",
"0.59861773",
"0.5925483",
"0.5833428",
"0.58309436",
"0.58218074",
"0.58218074",
"0.5804... | 0.83841497 | 0 |
Returns the user's calculated (or effective) resource policy for this particular lz in a station | def get_station_lz_resource_limits(self, station_id, lz_id):
return self._stations_service.get_station_lz_resource_limits(
station_id, lz_id
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_station_lz_resource_policy(self, station_id, lz_id):\n return self._stations_service.get_station_lz_resource_policy(\n station_id, lz_id\n )",
"def get_station_user_resource_policy(self, station_id, userid):\n return self._stations_service.get_station_user_resource_policy(... | [
"0.7087221",
"0.64218205",
"0.6379272",
"0.6182093",
"0.6135923",
"0.6116134",
"0.61025643",
"0.61025643",
"0.61025643",
"0.6001296",
"0.6000483",
"0.5991274",
"0.59892267",
"0.58904797",
"0.58904797",
"0.58297974",
"0.58109313",
"0.58109313",
"0.58109313",
"0.578706",
"0.578... | 0.50424963 | 76 |
Returns the number of rows. | def rowCount(self, parent: QtModelIndex = qtc.QModelIndex()) -> int:
# so index points to an article
if parent.isValid():
return 0
# must be the root index
return len(self.articles) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumRows(self) -> int:\n ...",
"def row_count(self) -> int:\n return len(self.rows)",
"def row_count(self) -> int:\n return len(self.rows)",
"def num_rows(self):\n return (len(self.rows))",
"def get_num_rows(self):\n return self._num_rows",
"def num_rows(self):\n ... | [
"0.9179639",
"0.8805268",
"0.8805268",
"0.88044053",
"0.87689143",
"0.87461436",
"0.87428755",
"0.865783",
"0.85970724",
"0.8554916",
"0.84820026",
"0.8481867",
"0.8478176",
"0.8426226",
"0.8415246",
"0.83838",
"0.82410043",
"0.8194653",
"0.81584185",
"0.8157642",
"0.8137413"... | 0.0 | -1 |
Returns data about an index. | def data(self, index: QtModelIndex, role: int = 0):
if not index.isValid():
return None
article: Article = index.internalPointer()
if role in (qtc.Qt.DisplayRole, qtc.Qt.ToolTipRole):
if index.column() == 0:
return article.title
if index.colum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(self):\n return dict(data='index')",
"def index(self):\n return self._data.get('index')",
"def get_index(self):\n with open(self.index_path, \"r\") as f:\n return json.load(f)",
"def index_stats(self):\r\n request = http.Request('GET', '/metadata/index_stats')... | [
"0.76539904",
"0.7606017",
"0.7443384",
"0.7309301",
"0.7210231",
"0.7181145",
"0.71791136",
"0.71590286",
"0.7089561",
"0.7078052",
"0.70224214",
"0.70119",
"0.7006514",
"0.6936691",
"0.6928603",
"0.68539524",
"0.68040735",
"0.68040735",
"0.68040735",
"0.68040735",
"0.680407... | 0.0 | -1 |
Update a Review object. Raise 404 error if review_id is not linked to a Review, 400 if the request body is not valid JSON data. Return Review dictionary with status code 200 otherwise. | def update_review(review_id):
user_input = request.get_json()
if user_input is None:
abort(400, {'message': 'Not a JSON'})
obj = storage.get(Review, review_id)
if obj is None:
abort(404)
for k, v in user_input.items():
if k not in ['id', 'user_id', 'place_id',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_review(review_id):\n review_obj = storage.get(Review, review_id)\n if review_obj:\n body_dic = request.get_json()\n if not body_dic:\n return jsonify({'error': 'Not a JSON'}), 400\n for key, value in body_dic.items():\n setattr(review_obj, key, value)\n ... | [
"0.82450074",
"0.82270336",
"0.8185605",
"0.7904952",
"0.7187071",
"0.6835401",
"0.6708264",
"0.6448361",
"0.6329704",
"0.6321135",
"0.6019502",
"0.6008733",
"0.59540486",
"0.59440637",
"0.58708715",
"0.58403367",
"0.57342505",
"0.57078063",
"0.5680967",
"0.56521666",
"0.5621... | 0.78249574 | 4 |
Create a block with the given ID and return it. | def CreateBlock(self, props):
# Set some default properties
# blk / cfg | name | name+inst
# -----------------------------
# name | n==n | False
# name+inst | n==n | n==n&&i==i
if 'ordinal' not in props and 'name' in props:
for ordinal, ni in self.config... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_block(world: World, block_id: str, x: int, y: int, *args):\n block_id = BLOCKS[block_id]\n if block_id == \"mystery_empty\":\n block = MysteryBlock()\n elif block_id == \"mystery_coin\":\n block = MysteryBlock(drop=\"coin\", drop_range=(3, 6))\n elif block_id == \"bounce_block\... | [
"0.70892054",
"0.6922745",
"0.6734681",
"0.67146844",
"0.6691439",
"0.66598445",
"0.6569314",
"0.6507948",
"0.6451737",
"0.6438023",
"0.64173955",
"0.631916",
"0.6271522",
"0.6259364",
"0.6188753",
"0.61676276",
"0.6142407",
"0.61034083",
"0.60966974",
"0.60704386",
"0.606842... | 0.6633076 | 6 |
Performs a bulk update of properties. Issues only one changed event for the entire update. | def Update(self, values):
# XXX: Rewrite to validate without fragile locks
with self._change_lock:
for prop, value in values.items():
if prop in self.__properties__:
setattr(self, prop, value)
else:
self._props[prop] = v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_multiple_objects_properties(self, object_list):\n\n #if self.settings.LOG_VERBOSE and self.settings.ENABLE_OBJECT_LOGGING: logger.debug(\"Processing multiple object properties updates: %s\" % (len(object_list)))\n\n for object_properties in object_list:\n\n self.update_object_pr... | [
"0.66578263",
"0.6543413",
"0.6513449",
"0.64142585",
"0.64012647",
"0.6382263",
"0.6328527",
"0.6231375",
"0.6205191",
"0.6145095",
"0.6109039",
"0.6012963",
"0.5999936",
"0.5995834",
"0.59565485",
"0.5932615",
"0.58797646",
"0.5834851",
"0.5812164",
"0.57771397",
"0.5743388... | 0.58494425 | 17 |
Opens a new database connection if there is none yet for the current application context. | def get_db():
if not hasattr(g, 'mongo_db'):
g.db = get_mongo_db()
return g.db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db",
"def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)",
"def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec... | [
"0.77379817",
"0.75827783",
"0.731633",
"0.716833",
"0.702289",
"0.6965276",
"0.6953964",
"0.6948672",
"0.68981296",
"0.68425506",
"0.6828195",
"0.6819551",
"0.68043447",
"0.67949706",
"0.67684644",
"0.6760031",
"0.675094",
"0.6747081",
"0.67314476",
"0.66986555",
"0.668763",... | 0.0 | -1 |
List available deep learning sentiment analysis models. | def available_deep_model():
return [
'fast-text',
'hierarchical',
'bahdanau',
'luong',
'bidirectional',
'bert',
'entity-network',
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_available_models(cls) -> List[PretrainedModelInfo]:\n list_of_models = []\n\n # en-US, ARPABET-based\n model = PretrainedModelInfo(\n pretrained_model_name=\"tts_en_radtts_aligner\",\n location=\"https://api.ngc.nvidia.com/v2/models/nvidia/nemo/tts_en_radtts_alig... | [
"0.68529797",
"0.6511286",
"0.6198815",
"0.6003524",
"0.58048916",
"0.5759036",
"0.57087564",
"0.5695869",
"0.56604546",
"0.5656096",
"0.5618853",
"0.55990726",
"0.5555275",
"0.5535813",
"0.5522266",
"0.5472041",
"0.54421264",
"0.54421264",
"0.54421264",
"0.54421264",
"0.5425... | 0.659194 | 1 |
This function performs our backward pass and updates our gradients | def backward_pass(total_loss):
# Get the tensor that keeps track of step in this graph or create one if not there
global_step = tf.train.get_or_create_global_step()
# Print summary of total loss
tf.summary.scalar('Total_Loss', total_loss)
# Decay the learning rate
dk_steps = int((FLAGS.epoch_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backward(self, gradient):\n #TODO\n pass",
"def backward(self, gradient):\n #TODO\n pass",
"def backward(self, gradient):\n raise NotImplementedError()",
"def backward_gradient(\n self, input: np.ndarray, head_gradients: Dict[str, np.ndarray]\n ) -> np.ndarray... | [
"0.8300835",
"0.8300835",
"0.813848",
"0.78645897",
"0.78537637",
"0.78537637",
"0.7841489",
"0.7801662",
"0.77778167",
"0.7776895",
"0.7717503",
"0.76866966",
"0.768577",
"0.7681438",
"0.7671628",
"0.76125723",
"0.76096076",
"0.7601533",
"0.7591049",
"0.75710464",
"0.7567065... | 0.0 | -1 |
allows the editing of a post as long as the active user is the post creator or admin | def edit_post(bid, pid):
# pylint: disable=unused-argument
pst = Post.query.get(pid)
form = PostForm(request.form)
if request.method == 'POST' and current_user.uid == pst.uid:
if form.validate():
if pst.name != form.name.data or pst.text != form.desc.data:
og_name = p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_permissions(request, post):\n user = request.user\n is_editable = has_ownership = False\n\n if user.is_authenticated():\n\n if user == post.author :\n has_ownership = is_editable = True\n elif user.is_moderator or user.is_staff:\n is_editable = True\n\n post... | [
"0.80510914",
"0.72609615",
"0.7226267",
"0.71686494",
"0.71497864",
"0.71302485",
"0.70795995",
"0.7057716",
"0.7032421",
"0.6998917",
"0.69817406",
"0.69667983",
"0.69324255",
"0.689023",
"0.6886989",
"0.68172026",
"0.67966056",
"0.6777565",
"0.6759076",
"0.67485136",
"0.67... | 0.6869949 | 15 |
allows the editing of a post as long as the active user is the post creator or admin | def edit_comment(bid, pid, cid):
# pylint: disable=unused-argument
comment = Comment.query.get(cid)
form = CommentForm(request.form)
if request.method == 'POST' and current_user.uid == comment.uid:
if form.validate():
if comment.text != form.text.data:
comment.text = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_permissions(request, post):\n user = request.user\n is_editable = has_ownership = False\n\n if user.is_authenticated():\n\n if user == post.author :\n has_ownership = is_editable = True\n elif user.is_moderator or user.is_staff:\n is_editable = True\n\n post... | [
"0.8052066",
"0.72612363",
"0.72258705",
"0.71685565",
"0.7149761",
"0.71297675",
"0.7078617",
"0.70570725",
"0.7032085",
"0.6998435",
"0.69808286",
"0.69673204",
"0.69330925",
"0.68888074",
"0.6885943",
"0.6869112",
"0.68170947",
"0.6795856",
"0.6777252",
"0.67587143",
"0.67... | 0.0 | -1 |
Create new product, from provided dict. | def create_product(new_product, owner_name):
if not isinstance(new_product, dict):
raise ValueError(f"New product {new_product} is not a dict")
new_instance = Products(
serial_number=new_product['serial_number'],
type_name=new_product['type_name'],
owner_name=owner_name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(cls, dictionary):\n return cls(**dictionary)",
"def create(cls, dictionary):\n return cls(**dictionary)",
"def from_dict(cls, dct):\n return cls(**dct)",
"def create(cls, **kwargs):\n response = cls.get_client().create_product(**kwargs)\n object_details = cls._fl... | [
"0.71715415",
"0.71715415",
"0.65444577",
"0.65245855",
"0.6505505",
"0.643091",
"0.64308983",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",
"0.6385321",... | 0.6412352 | 7 |
Set a minimum relative uncertainty for the HirexSr signals. | def set_min_uncertainty(signal, threshold=0.05):
# Increase Hirex-Sr uncertainties to be a rel error of 5% minimum (JUST FOR TESTING)
corrected_unc=signal.std_y/signal.y<=0.05
signal.std_y[corrected_unc]=0.05*signal.y[corrected_unc]
# correction for normalized uncertainties
if signal.s/signal.m<=0.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_min_confidence(self, new_min):\n self.__min_confidence = new_min",
"def set_Ec_min(self, x):\n x = float(x)\n if self.Ec_min != x:\n self.Ec_min = x\n self.Ec[0] = x",
"def setUncertainty(self, uncertainty):\n self.uncertainty = uncertainty",
"def... | [
"0.6703387",
"0.63027465",
"0.6177287",
"0.5665198",
"0.56195945",
"0.56136763",
"0.55630547",
"0.55627656",
"0.555593",
"0.555593",
"0.54854083",
"0.54678583",
"0.54263455",
"0.5422868",
"0.54227537",
"0.5412941",
"0.5385455",
"0.5342574",
"0.53386",
"0.53296685",
"0.5296957... | 0.69471943 | 0 |
Returns a filtered list of transactions. You must provide at least one of the available filter criteria to filter transactions. Filters are additive (similar to SQL AND), for example if you provide both account_ids and payment_order_ids then transactions will be returned that match both criteria. Within each filter fie... | def list_transactions(
self,
account_ids: List[str] = None,
payment_order_ids: List[str] = None,
payee_ids: List[str] = None,
direction: TransactionDirection = None,
statuses: List[TransactionStatus] = None,
value_timestamp_range: Dict[str, datetime] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_transactions(\n self,\n since: Optional[date] = None,\n count: int = 1000,\n offset: int = 0,\n include_pending: bool = False,\n ) -> List[Transaction]:\n return self.session.get_transactions(\n self.account_id,\n options={\n ... | [
"0.65789837",
"0.6551348",
"0.6524975",
"0.643697",
"0.63870436",
"0.63828325",
"0.6184074",
"0.6104861",
"0.60844904",
"0.6030461",
"0.6005945",
"0.59506714",
"0.58950776",
"0.5889965",
"0.5830454",
"0.58221173",
"0.5817953",
"0.5797632",
"0.57867986",
"0.5762698",
"0.576108... | 0.6810662 | 0 |
Returns path relative to dir. | def relpath(path, dir = '.'):
apath = os.path.abspath(os.path.normpath(path))
adir = os.path.abspath(os.path.normpath(dir))
if apath == adir:
return(os.curdir)
commonpath = os.path.commonprefix((apath, adir))
uniqpath = adir[len(commonpath):]
if len(uniqpath) == 0:
return(path)
if uniqpath.startswith(os.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_relative_path(dir, full_path):\n if dir[-1] == '/' or dir[-1] == ':':\n return full_path[ len(dir) : ]\n else:\n return full_path[ len(dir)+1 : ]",
"def dir(self) -> str:\n return f'{os.path.dirname(self.path)}/'.lstrip('/')",
"def get_relative_path(path):\r\n components =... | [
"0.73512733",
"0.7256607",
"0.70581496",
"0.7025892",
"0.7023596",
"0.6984552",
"0.69707996",
"0.6943182",
"0.69392395",
"0.68329155",
"0.6819966",
"0.6805251",
"0.6773979",
"0.6750591",
"0.6749946",
"0.6705201",
"0.6704479",
"0.6677323",
"0.6668318",
"0.66661364",
"0.6627059... | 0.7438515 | 0 |
Round num to sf sig figs and format compactly; arbitrary precision if sf = 0 | def fnum(num, sf = 0):
s = []
nf = 0
ppos = -1
for x in str(num):
# print((x, s))
if x == '.':
ppos = len(s)
continue
if nf == 0 and ppos < 0 and x == '0':
continue
s.append(x)
if x != '-' and (x != '0' or nf > 0):
nf += 1
if ppos >= 0 and sf > 0 and nf > sf:
if int(s[-1]) >= 5:
s[-2]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roundSigfigs(num, sigfigs):\n if num != 0:\n return str(round(num, -int(math.floor(math.log10(abs(num))) - (sigfigs - 1))))\n else:\n return str(0.0) # Can't take the log of 0",
"def roundSigfigs(num, sigfigs):\n if num != 0:\n return str(round(num, -int(math.floor(math.log10(a... | [
"0.73041683",
"0.73041683",
"0.71902955",
"0.6843492",
"0.65107745",
"0.6475131",
"0.6462869",
"0.62252724",
"0.60651004",
"0.59419686",
"0.5824121",
"0.5783638",
"0.5775254",
"0.57725984",
"0.57562655",
"0.57537854",
"0.5735119",
"0.5697799",
"0.5692649",
"0.56849295",
"0.56... | 0.6751082 | 4 |
Fills the accumulator with zero values, based on the shape of the given weights. | def fill_zero(self, weights):
if self.value is None:
# if we have a list of weights, allocate a list of zeros for the accumulator
if isinstance(weights, list):
self.value = list()
# for each weight in the list, allocate zeros with the same shape as the wei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initializeWeightsToZero(self):\n\t\t## YOUR CODE BELOW\n\t\t\n\t\tutil.raiseNotDefined()\n\t\treturn",
"def init_weight(w):\n shape = w.shape\n if len(shape) == 4:\n i, o, u, v = shape\n k = np.sqrt(6 / (i * u * v + o * u * v))\n w.data.uniform_(-k, k)\n elif len(shape) == 2:\n k = np.sqrt(6 /... | [
"0.6747005",
"0.65881675",
"0.656351",
"0.6509806",
"0.6401679",
"0.61936784",
"0.61487097",
"0.61451656",
"0.61346465",
"0.6079333",
"0.6079333",
"0.60078335",
"0.60078335",
"0.60078335",
"0.59733015",
"0.59696776",
"0.595237",
"0.5928644",
"0.5926054",
"0.5923076",
"0.58934... | 0.8440121 | 0 |
Fetches the injectable parameter names of parameters to the given method, along with a set of parameters which have default values and should be considered optional dependencies. This method will throw InjectionError if the method provided has arguments that are not POSITIONAL_OR_KEYWORD or KEYWORD_ONLY. If the method ... | def get_injection_params(f, unbound_ctor=False):
injection_param_names = []
default_param_set = set()
params: List = []
if not inspect.ismethod(f) and unbound_ctor and not inspect.isfunction(f):
# We do not want to try to inject a slot wrapper
# version of __init__, as its params are (*... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_params(cls, *args, **kwargs):\n sig = inspect.signature(cls.__init__)\n # The 'self' parameter needs to be removed or the first *args will be\n # assigned to it\n self_param = sig.parameters.get(\"self\")\n new_params = list(sig.parameters.values())\n new_params.r... | [
"0.5747912",
"0.55833083",
"0.5566967",
"0.5376236",
"0.5150334",
"0.5149961",
"0.5107904",
"0.5066509",
"0.50581443",
"0.5034733",
"0.49593595",
"0.49587607",
"0.492701",
"0.49034765",
"0.4865419",
"0.4864978",
"0.48638812",
"0.48015445",
"0.4793075",
"0.47842905",
"0.478277... | 0.73655486 | 0 |
Returns the number of measurements stored (which is equivalent to the number of timesteps that the system has been measuring). Returns | def get_timesteps(self):
return len(self.measurement_history) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_number_of_measurement(self):\n num_of_meas = 0\n for time in self.mdvtc.keys():\n num_of_meas = num_of_meas + self.mdvtc[time].get_number_of_measurement()\n #\n return num_of_meas",
"def count_measurements(database: Database) -> int:\n return int(database.measure... | [
"0.821365",
"0.74117464",
"0.69374704",
"0.6843931",
"0.6796748",
"0.6728694",
"0.6709693",
"0.6680076",
"0.6670823",
"0.66535914",
"0.6627371",
"0.6603178",
"0.6597402",
"0.65882856",
"0.6581612",
"0.6554371",
"0.65309995",
"0.65291715",
"0.65120083",
"0.64996237",
"0.649962... | 0.7084683 | 2 |
Convert Numpy matrix of vertices into a Python list (xy list of a shape) | def matrix2list(vertex_matrix):
flat_array = vertex_matrix.tolist()
xy_list = []
for i in range(0, len(flat_array)):
xy_list.append( flat_array[i][0] )
xy_list.append( flat_array[i][1] )
return xy_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _vertex_arrays_to_list(x_coords_metres, y_coords_metres):\n\n _check_polyline(\n x_coords_metres=x_coords_metres, y_coords_metres=y_coords_metres)\n\n num_vertices = len(x_coords_metres)\n vertex_list_xy_metres = []\n for i in range(num_vertices):\n vertex_list_xy_metres.append((x_coo... | [
"0.7413975",
"0.7025411",
"0.68816763",
"0.6750809",
"0.6745582",
"0.66855454",
"0.65625846",
"0.6517452",
"0.64930856",
"0.6437436",
"0.64248884",
"0.6411927",
"0.6367023",
"0.63419783",
"0.6332802",
"0.6315702",
"0.63048035",
"0.62930965",
"0.6277304",
"0.62731403",
"0.6272... | 0.8255958 | 0 |
to learn the attention of one channel and the rest channels | def channelAttention(self,x):
b, c, h, w = x.shape
pre_x = x.contiguous().view(b, c, h * w)
att_x, relations = self.forward_unified(pre_x, pre_x, pre_x)
att_x = att_x.contiguous().view(b, c, h, w)
return att_x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _attention(self, inputs):\n attn_weights = K.batch_dot(x=inputs,\n y=K.permute_dimensions(inputs,\n pattern=(0, 2, 1)))\n return K.permute_dimensions(attn_weights, (0, 2, 1))",
"def attention(self, decode... | [
"0.6191988",
"0.6182749",
"0.61674166",
"0.6110955",
"0.60878927",
"0.6033937",
"0.60321414",
"0.6014058",
"0.60054046",
"0.5966352",
"0.5961111",
"0.59551805",
"0.5920994",
"0.59022796",
"0.5893938",
"0.58766156",
"0.5868471",
"0.5847925",
"0.58348364",
"0.5827881",
"0.58140... | 0.62221354 | 0 |
Construct a layernorm module in the TF style (epsilon inside the square root). | def __init__(self, hidden_size, eps=1e-12):
super(BertLayerNorm, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsilon = eps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verhulst(nb_init, t0, tf, eps, methode, gamma, K) :\n f=lambda y,t : gamma*y*(1-y/K)\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n return Y",
"def malthusiens(nb_init, t0, tf, eps, methode, gamma ) :\n\n f=lambda y, t : gamma*y\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n ... | [
"0.62758327",
"0.60142326",
"0.5795031",
"0.5740771",
"0.55372477",
"0.5517929",
"0.54223156",
"0.54113936",
"0.5386929",
"0.5368306",
"0.53505456",
"0.52857476",
"0.52559835",
"0.52327746",
"0.5227854",
"0.5224699",
"0.5219319",
"0.5218825",
"0.51930606",
"0.51930606",
"0.51... | 0.0 | -1 |
Splits up the URL given and returns the slug of the clip. | def get_slug(clip: str) -> str:
slug = clip.split("/")
return slug[len(slug) - 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slug_from_url(url):\n\n find_replaces = [\n ('http(s)?://', ''),\n ('\\.', '-'),\n ('/', '-'),\n ]\n\n for find, replace in find_replaces:\n url = re.sub(find, replace, url)\n\n return url",
"def _split_url(url):\n return url[1:].split('/')",
"def get_slug(sel... | [
"0.6573873",
"0.6397004",
"0.6325671",
"0.62193835",
"0.61308074",
"0.60969",
"0.60584766",
"0.6047683",
"0.60388464",
"0.5998331",
"0.5956057",
"0.5953348",
"0.5937267",
"0.5903982",
"0.58827615",
"0.5872457",
"0.58718574",
"0.5865004",
"0.5849255",
"0.57959837",
"0.57903177... | 0.78426516 | 0 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def adjust_learning_rate(initial_lr, optimizer, epoch, every_epoch):
lr = initial_lr * (0.1 ** (epoch // every_epoch))
for param_group in optimizer.param_groups:
param_group['lr'] = lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.79122996",
"0.79058665",
"0.77745456",
"0.77334857",
"0.7730185",
"0.7722212",
"0.7721426",
"0.771838",
"0.7708323",
"0.76928985",
"0.767362",
"0.7665062",
"0.7665062",
"0.7665062",
"0.76536506",
"0.7641248",
"0.7638249",
"0.7637116",
"0.7625168",
"0.7623629",
"0.7620543",... | 0.7848773 | 2 |
Load mydataset. This is a template for adding a function to load a dataset from MoleculeNet. Adjust the global variable URL strings, default parameters, default featurizers, transformers, and splitters, and variable names as needed. All available featurizers, transformers, and splitters are in the `DEFAULTS_X` global v... | def load_mydataset(
featurizer: Featurizer = DEFAULT_FEATURIZERS['CircularFingerprint'],
transformers: List[Transformer] = [
DEFAULT_TRANSFORMERS['NormalizationTransformer']
],
splitter: Splitter = DEFAULT_SPLITTERS['RandomSplitter'],
reload: bool = True,
data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_dataset(self, split, epoch=1, combine=False, **kwargs):\n paths = utils.split_paths(self.cfg.data)\n assert len(paths) > 0\n data_path = paths[(epoch - 1) % len(paths)]\n\n # infer langcode\n src, tgt = self.cfg.source_lang, self.cfg.target_lang\n\n self.datasets[... | [
"0.6464995",
"0.6344406",
"0.63009864",
"0.62198555",
"0.6104486",
"0.6049461",
"0.57530385",
"0.57283473",
"0.5718382",
"0.5714284",
"0.56947726",
"0.56910175",
"0.56653357",
"0.5658124",
"0.56215054",
"0.55981797",
"0.55725634",
"0.5554376",
"0.5487216",
"0.5476791",
"0.545... | 0.75441635 | 0 |
Set the validator dictionary. | def validator(self, value: Optional[Dict[str, Any]]):
self._validator = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validator_info(self, validator_info):\n\n self._validator_info = validator_info",
"def validator(self) -> Optional[Dict[str, Any]]:\n return self._validator",
"def validations(self, validations):\n\n self.container['validations'] = validations",
"def __init__(self,validator):\n ... | [
"0.63722885",
"0.59797984",
"0.59709877",
"0.5968238",
"0.59022975",
"0.58239925",
"0.5774157",
"0.56801814",
"0.5592095",
"0.5553507",
"0.55335283",
"0.55131084",
"0.5410613",
"0.5351317",
"0.53378487",
"0.53378487",
"0.5327392",
"0.5327392",
"0.5301388",
"0.52763367",
"0.52... | 0.7382766 | 0 |
Gets the changed_by of this AuditEntry. | def changed_by(self):
return self._changed_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_by(self):\n return self._updated_by",
"def last_modified_by(self):\n return self._last_modified_by",
"def updated_by(self) -> \"str\":\n return self._attrs.get(\"updatedBy\")",
"def updated_by(self) -> \"str\":\n return self._attrs.get(\"updatedBy\")",
"def updated_b... | [
"0.7249279",
"0.69695014",
"0.67318934",
"0.67318934",
"0.67318934",
"0.66954154",
"0.6461869",
"0.6311164",
"0.6311164",
"0.6311164",
"0.6311164",
"0.6311164",
"0.6311164",
"0.62398523",
"0.6199881",
"0.6086686",
"0.6080386",
"0.60497826",
"0.60042036",
"0.5695446",
"0.56655... | 0.830074 | 1 |
Sets the changed_by of this AuditEntry. | def changed_by(self, changed_by):
self._changed_by = changed_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changed_by(self):\n return self._changed_by",
"def changed_by(self):\n return self._changed_by",
"def updated_by(self, updated_by):\n\n self._updated_by = updated_by",
"def updated_by(self, updated_by: \"str\"):\n self._attrs[\"updatedBy\"] = updated_by",
"def updated_by(sel... | [
"0.70531774",
"0.70531774",
"0.6982425",
"0.67455775",
"0.67455775",
"0.67455775",
"0.65675133",
"0.65675133",
"0.60424423",
"0.5959088",
"0.58513176",
"0.58513176",
"0.58513176",
"0.58513176",
"0.58513176",
"0.58513176",
"0.5797555",
"0.5767141",
"0.5724656",
"0.55524004",
"... | 0.8309313 | 0 |
Gets the id of this AuditEntry. | def id(self):
return self._id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def id(self):\n retu... | [
"0.7254302",
"0.7254302",
"0.7254302",
"0.7254302",
"0.7254302",
"0.7254302",
"0.72303677",
"0.71647584",
"0.71460176",
"0.7144614",
"0.7144614",
"0.7108297",
"0.7108297",
"0.7108297",
"0.7108297",
"0.7108297",
"0.7108297",
"0.7108297",
"0.7108297",
"0.7108297",
"0.7108297",
... | 0.0 | -1 |
Sets the id of this AuditEntry. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id):\n\n\t\tif id is not None and not isinstance(id, int):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)\n\t\t\n\t\tself.__id = id\n\t\tself.__ke... | [
"0.7630219",
"0.7612315",
"0.7529485",
"0.75225174",
"0.7452073",
"0.7249684",
"0.7249684",
"0.7249684",
"0.7179838",
"0.7179838",
"0.7179838",
"0.7179838",
"0.7179838",
"0.7179838",
"0.7179838",
"0.7179838",
"0.7179838",
"0.7179838",
"0.7179838",
"0.7179838",
"0.7179838",
... | 0.0 | -1 |
Gets the organization_id of this AuditEntry. | def organization_id(self):
return self._organization_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization_id(self) -> str:\n return pulumi.get(self, \"organization_id\")",
"def organization_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"organization_id\")",
"def organization_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"organizatio... | [
"0.80762357",
"0.78826576",
"0.77492076",
"0.77492076",
"0.7006984",
"0.69951683",
"0.6884503",
"0.6850317",
"0.6845058",
"0.6613094",
"0.63587046",
"0.63540274",
"0.6339878",
"0.62920094",
"0.62616473",
"0.62345904",
"0.62345904",
"0.6231323",
"0.61555445",
"0.61486125",
"0.... | 0.84393626 | 0 |
Sets the organization_id of this AuditEntry. | def organization_id(self, organization_id):
self._organization_id = organization_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization_id(self, organization_id):\n if organization_id is None:\n raise ValueError(\"Invalid value for `organization_id`, must not be `None`\") # noqa: E501\n\n self._organization_id = organization_id",
"def org_id(self, org_id):\n\n self._org_id = org_id",
"def organ... | [
"0.75153923",
"0.730572",
"0.71776944",
"0.71776944",
"0.71776944",
"0.6829373",
"0.6627145",
"0.65207165",
"0.64345294",
"0.6204442",
"0.60855114",
"0.6005726",
"0.6005726",
"0.6001661",
"0.6001661",
"0.583284",
"0.5821725",
"0.582044",
"0.56470793",
"0.5548742",
"0.55099416... | 0.832213 | 1 |
Gets the entity_id of this AuditEntry. | def entity_id(self):
return self._entity_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_id(self) -> str:\n return self._entity_id",
"def tracked_entity_id(self):\n return self._tracked_entity_id",
"def get_key_by_entity(cls, entity):\n db_key = \"entity:\" + str(entity.entity_id)\n result = cls.db.keys(db_key)\n return (entity.entity_id if result else... | [
"0.7693048",
"0.72340983",
"0.62899536",
"0.61061704",
"0.6085583",
"0.60490215",
"0.60490215",
"0.60326046",
"0.60326046",
"0.60326046",
"0.60326046",
"0.60326046",
"0.60326046",
"0.60319936",
"0.60069406",
"0.5994444",
"0.59905154",
"0.59829485",
"0.5975086",
"0.5975086",
"... | 0.8037113 | 4 |
Sets the entity_id of this AuditEntry. | def entity_id(self, entity_id):
self._entity_id = entity_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_id(self, entity_id: str):\n\n self._entity_id = entity_id",
"def entity_id(self, entity_id):\n if entity_id is None:\n raise ValueError(\"Invalid value for `entity_id`, must not be `None`\")\n\n self._entity_id = entity_id",
"def entities_id(self, entities_id):\n\n ... | [
"0.79976314",
"0.79222083",
"0.66796696",
"0.65123117",
"0.64531934",
"0.6290769",
"0.5910044",
"0.5910044",
"0.5910044",
"0.5910044",
"0.5910044",
"0.5899952",
"0.5899952",
"0.5899952",
"0.57038164",
"0.5661641",
"0.545111",
"0.54498637",
"0.5395395",
"0.5363157",
"0.5341813... | 0.8073803 | 0 |
Gets the audit_action of this AuditEntry. | def audit_action(self):
return self._audit_action | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_action(self):\n return self.__action",
"def action(self):\n return self._get_field(\"action\")",
"def get_action(self):\n return self.current_action",
"def action(self):\n return self._action",
"def action(self):\n return self._action",
"def action(self):\n ... | [
"0.71937025",
"0.6969079",
"0.69373006",
"0.68369156",
"0.68369156",
"0.68369156",
"0.68369156",
"0.68369156",
"0.68369156",
"0.66419053",
"0.6547587",
"0.6547587",
"0.6547587",
"0.65027106",
"0.64371264",
"0.63478076",
"0.63173217",
"0.6236077",
"0.62267995",
"0.62238157",
"... | 0.8121201 | 0 |
Sets the new_entity of this AuditEntry. | def new_entity(self, new_entity):
self._new_entity = new_entity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_entity(self):\n return self._new_entity",
"def new(self, new):\n\n self._new = new",
"def entity(self, entity):\n\n self._entity = entity",
"def set_entity(cls, entity):\n # Preparing auto increment\n entity_count = cls.get_entity_count()\n new_key = \"entity... | [
"0.68103546",
"0.5976102",
"0.596852",
"0.5584641",
"0.547989",
"0.5396724",
"0.5247832",
"0.51539177",
"0.49853706",
"0.49630386",
"0.48778757",
"0.48662427",
"0.48621497",
"0.48537818",
"0.4843221",
"0.48238978",
"0.48095122",
"0.47993878",
"0.4794472",
"0.4772747",
"0.4751... | 0.8411291 | 0 |
Gets the state of this AuditEntry. | def state(self):
return self._state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\n return self.get_state()",
"def getState(self):\n return self._state",
"def getState(self):\n return self._state",
"def getState(self):\n return self.state",
"def getState(self):\n return self.state",
"def getState(self):\n return self.state",
... | [
"0.6980242",
"0.68909866",
"0.68909866",
"0.6888418",
"0.6888418",
"0.6888418",
"0.6842564",
"0.6842564",
"0.6842564",
"0.6842564",
"0.6842564",
"0.6829437",
"0.6829437",
"0.6807538",
"0.6770623",
"0.6770623",
"0.67589486",
"0.67364025",
"0.67311466",
"0.6722468",
"0.6722468"... | 0.6820712 | 88 |
Sets the created of this AuditEntry. | def created(self, created):
self._created = created | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created(self, created):\n if created is None:\n raise ValueError(\"Invalid value for `created`, must not be `None`\")\n\n self._created = created",
"def set_created(self, dt):\n self.created = dt_to_iso(dt)",
"def set_Created(self, value):\n super(MoneyReceivedInputSe... | [
"0.7562887",
"0.7332002",
"0.69526184",
"0.6912635",
"0.6912635",
"0.6849902",
"0.68028855",
"0.6782158",
"0.6782158",
"0.6782158",
"0.6782158",
"0.6782158",
"0.6782158",
"0.6782158",
"0.6760964",
"0.6750482",
"0.67365575",
"0.67365575",
"0.67365575",
"0.6716858",
"0.6693137"... | 0.74819726 | 12 |
Returns true if both objects are equal | def __eq__(self, other):
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.80885184",
"0.80885184",
"0.805514",
"0.7983044",
"0.79614645",
"0.79614645",
"0.7942978",
"0.79307914",
"0.79270965",
"0.78980374",
"0.78832436",
"0.78832436",
"0.78809714",
"0.7873277",
"0.7868898",
"0.78659886",
"0.78258073",
"0.7820066",
"0.7816123",
"0.7807926",
"0.78... | 0.7966715 | 46 |
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.8456063",
"0.83918154",
"0.8144437",
"0.8140196",
"0.8132038",
"0.8093834",
"0.80918837",
"0.80918837",
"0.80918837",
"0.80852824",
"0.80852824",
"0.807626",
"0.807626",
"0.80657643"
] | 0.0 | -1 |
get the vtk point object for the location (x,y,z) | def __get_points_object__(xyz):
# TODO: Need to fix this to handle all points, not just the first
source = vtk.vtkPointSource()
source.SetCenter(xyz[0])
source.SetRadius(0)
source.SetNumberOfPoints(1)
source.Update()
return source | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point(self):\n return self.x, self.y, self.z",
"def point(x, y, z):\n return point_or_vector(x,y,z,1.0)",
"def getPoint(self):\n return Point(*self.position)",
"def __getitem__(self, *args):\n return _itkSurfaceSpatialObjectPointPython.vectoritkSurfaceSpatialObjectPoint3___getitem... | [
"0.7138827",
"0.6928828",
"0.6814521",
"0.6653981",
"0.6626665",
"0.6483561",
"0.6447883",
"0.6434501",
"0.63675106",
"0.6335543",
"0.632635",
"0.62961286",
"0.6287827",
"0.6256243",
"0.6240352",
"0.62284607",
"0.62024504",
"0.6198469",
"0.61825156",
"0.6178122",
"0.6170829",... | 0.71322364 | 1 |
Bottleneck block for ResNeXt. If style is "pytorch", the stridetwo layer is the 3x3 conv layer, if it is "caffe", the stridetwo layer is the first 1x1 conv layer. | def __init__(self,
inplanes,
planes,
groups=1,
base_width=4,
base_channels=64,
**kwargs):
super(Bottleneck, self).__init__(inplanes, planes, **kwargs)
if groups == 1:
width = self.planes
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _bottleneck(x: tf.Tensor, depth: int, depth_bottleneck: int, stride: int, rate: int = 1) -> tf.Tensor:\n with tf.variable_scope(None, 'bottleneck_v2', [x]):\n depth_in = slim.utils.last_dimension(x.get_shape(), min_rank=4)\n preact = slim.batch_norm(x, activation_fn=tf.nn.relu, sco... | [
"0.6889076",
"0.6795593",
"0.67665195",
"0.6523262",
"0.6499701",
"0.6218676",
"0.6191233",
"0.6187817",
"0.61875874",
"0.61188823",
"0.60808504",
"0.5914599",
"0.5914326",
"0.5914326",
"0.59128946",
"0.58922887",
"0.5889086",
"0.5873635",
"0.5873635",
"0.58704764",
"0.585307... | 0.0 | -1 |
Build message specific to the recipient. | def build_message(self, recipient_email):
message = self.queue_doc.message
if not message:
return ""
message = message.replace(
self.message_placeholder("tracker"), self.get_tracker_str(recipient_email)
)
message = message.replace(
self.message_placeholder("unsubscribe_url"), self.get_unsubscribe_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_message(self):\n msg_type = self.msg_type\n if msg_type == \"PUBMSG\":\n msg_type = \"PRIVMSG\"\n ret = \"{} {}\".format(msg_type, self.target)\n if self.content:\n ret += \" :{}\".format(self.content)\n return ret + \"\\r\\n\"",
"def build_m... | [
"0.6769794",
"0.6737969",
"0.62899005",
"0.6173471",
"0.61571157",
"0.6078235",
"0.6017565",
"0.60136795",
"0.59706426",
"0.5963227",
"0.5956112",
"0.5827875",
"0.5805116",
"0.57555825",
"0.57555825",
"0.57119703",
"0.57029104",
"0.569709",
"0.5649452",
"0.5649261",
"0.563867... | 0.72548765 | 0 |
Check for the existance of enums in the parameter list. If an enum exists, we need to build a tuple of the emum names as well as the code that will validate the the enum. We create two lists one that contains the enums as tuples and another that contains the valdiate code. The method returns a list that consistes of th... | def check_for_enums(parameters):
enum_line = ''
enum_lines = []
validate_enums = []
for param in parameters:
if 'enum' in param:
param_name = check_param(flatten_param(param['name']))
param_enum = param['enum']
enum_line = param_name + '_types = ('
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_available_enum(enum_type: Type[Enum]) -> List[str]:\n return [f\"{i}: {v}\" for (i, v) in enumerate(enum_type)] # type: ignore[var-annotated]",
"def handle_enum(enum_annotations: Any) -> list:\n result = []\n for attribute in list(enum_annotations):\n result.append(attribute... | [
"0.6401213",
"0.63181007",
"0.63141215",
"0.61072165",
"0.60310066",
"0.56923455",
"0.56852007",
"0.55856186",
"0.55427897",
"0.5502843",
"0.548926",
"0.5463231",
"0.542895",
"0.5422927",
"0.5402525",
"0.5377337",
"0.5361586",
"0.5300357",
"0.5296258",
"0.5267555",
"0.5186078... | 0.7524469 | 0 |
convert camelCase to camel_case | def convert(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_camel_case(name):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', name)\n return re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()",
"def _to_camel_case(text: str) -> str:\n return \"\".join(word.title() for word in text.split(\"_\"))",
"def camel_case(value: str, **kwargs: Any) -> str:\n ... | [
"0.8216925",
"0.8098905",
"0.7977879",
"0.78845215",
"0.7877296",
"0.7851086",
"0.78430486",
"0.7833407",
"0.77893585",
"0.7788128",
"0.77770317",
"0.77436364",
"0.77385837",
"0.7737896",
"0.771665",
"0.771665",
"0.7715725",
"0.77044356",
"0.7662114",
"0.7646547",
"0.7639699"... | 0.6941522 | 76 |
Compute and return the value of addition operation. | def compute_output(self):
x, y = self.input_nodes
self.output_value = backend.add(x.output_value, y.output_value)
return self.output_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self):\n return self._do_calc(self.adder)",
"def add(self):\n return self._do_calc(self.adder)",
"def add(self):\n return self._do_calc(self.adder)",
"def addition(self, first_value, second_value):\n return first_value + second_value",
"def addition(a, b):\r\n\r\n resu... | [
"0.8168641",
"0.8168641",
"0.8168641",
"0.7837437",
"0.7704095",
"0.7474225",
"0.73802626",
"0.736307",
"0.730536",
"0.728264",
"0.72668445",
"0.7235886",
"0.7205479",
"0.71878326",
"0.7183775",
"0.7182901",
"0.7154208",
"0.710332",
"0.7075838",
"0.7075838",
"0.7075838",
"0... | 0.0 | -1 |
Instantiate a CSRFaware test client and verify that the CSRF Middleware rotates the CSRF token per request by logging in getting token1, getting token2, then assert that token1 does not equal token2. | def test_csrf_token_request_rotation(self):
csrf_client = Client(enforce_csrf_checks=True)
csrf_client.login(username='archen', password='mytestpassword')
# todo: add settings for test URL
response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1}))
token1 = "{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_csrf_token_session_rotation(self):\n\n csrf_client = Client(enforce_csrf_checks=True)\n csrf_client.login(username='archen', password='mytestpassword')\n\n # todo: add settings for test URL\n response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1}))\n ... | [
"0.75068396",
"0.67863727",
"0.6705328",
"0.66953987",
"0.65281594",
"0.64516985",
"0.6424007",
"0.6370507",
"0.636057",
"0.6342661",
"0.63172245",
"0.6177671",
"0.6174722",
"0.613412",
"0.6096326",
"0.6073039",
"0.6046885",
"0.60453147",
"0.601192",
"0.60011077",
"0.5999106"... | 0.798472 | 0 |
Checks if a preservation sheet has been identified by set_amiSheetNames() | def check_presSheetExists(self):
if not self.pres_sheetname:
self.raise_excelerror("Required sheet for preservation files" +
"could not be found in workbook.")
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_amiSheetNames(self):\n\n self.pres_sheetname = None\n self.edit_sheetname = None\n self.notransfer_sheetname = None\n\n for sheet in self.wb.sheet_names():\n sheet_lower = sheet.lower()\n #Check if two sheets get identfied by regex below?\n if re.match(\"(original|preservation|fi... | [
"0.66302073",
"0.65046644",
"0.5886013",
"0.5579476",
"0.5479899",
"0.54747397",
"0.53408045",
"0.52864134",
"0.5272514",
"0.52497303",
"0.5119719",
"0.5086039",
"0.5080697",
"0.5060596",
"0.49829373",
"0.49792847",
"0.4975354",
"0.49734163",
"0.4972198",
"0.49180233",
"0.491... | 0.68520504 | 0 |
Configure the platform and add the sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
name = config.get(CONF_NAME)
token = config.get(CONF_API_KEY)
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
longitude = config.get(CONF_LONGITUDE, hass.config.longitude)
_LOGGER.debug("Using latitude and longitude: %s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_sensors(self, configs):\n self.__sensors = self.setup_components(configs, 'scale_client.sensors')",
"def setup_platform(hass, config, add_sensors_callback, discovery_info=None):\n\n flo = hass.data[FLO_SERVICE]\n if flo is None or not flo.is_connected:\n LOG.warning(\"No connection ... | [
"0.74864894",
"0.7239367",
"0.7238194",
"0.72378623",
"0.7099067",
"0.69818896",
"0.69631433",
"0.69562775",
"0.6948777",
"0.69465494",
"0.6945056",
"0.69391507",
"0.6869754",
"0.6851387",
"0.6831462",
"0.68086",
"0.6788309",
"0.6771401",
"0.6759165",
"0.67398715",
"0.6727710... | 0.67472076 | 19 |
Return the device state attributes. | def device_state_attributes(self):
if self._type == ATTR_CAQI:
self._attrs[ATTR_CAQI_LEVEL] = self.data[ATTR_CAQI_LEVEL]
if self._type == ATTR_PM25:
self._attrs[ATTR_LIMIT] = self.data[ATTR_PM25_LIMIT]
self._attrs[ATTR_PERCENT] = round(self.data[ATTR_PM25_PERCENT])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self._attrs",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self... | [
"0.9317156",
"0.92453825",
"0.92205626",
"0.9214834",
"0.9214834",
"0.9210406",
"0.9210406",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9190629",
"0.9143603",
... | 0.8124515 | 63 |
Return a unique_id for this entity. | def unique_id(self):
return '{}-{}-{}'.format(self._latitude, self._longitude, self._type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_id(self):\n return self._id",
"def unique_id(self):\n return self._id",
"def unique_id(self):\n return self._uuid",
"def unique_id(self):\n return self._uuid",
"def unique_id(self) -> str:\n return self._unique_id",
"def unique_id(self) -> str:\n retur... | [
"0.8327206",
"0.8327206",
"0.8272821",
"0.8272821",
"0.82371587",
"0.82371587",
"0.82371587",
"0.82371587",
"0.82371587",
"0.82371587",
"0.82371587",
"0.82371587",
"0.82110804",
"0.82110804",
"0.82110804",
"0.82110804",
"0.82110804",
"0.82110804",
"0.82110804",
"0.82110804",
... | 0.7599431 | 54 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7797633",
"0.77625954",
"0.77602196",
"0.7757519",
"0.76584935",
"0.76584935",
"0.76584935",
"0.76584935",
"0.7589092",
"0.7433975",
"0.7410552",
"0.7397003",
"0.7360935",
"0.73204947",
"0.7271785",
"0.72655344",
"0.7264959",
"0.7259807",
"0.72332364",
"0.72179425",
"0.720... | 0.7093289 | 58 |
Test for search_by_ISBN method | def test_search_by_ISBN(self):
s1 = System()
b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
self.assertEqual(s1.search_by_ISBN("0123456789123"), 0)
s1.add_resource(b1)
self.assertEqual(s1.search_by_ISBN("0123456789123"), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_client_by_isbn(self, mock_get):\n\n response = isbn_utils.search_by(self.filter_isbn, self.ISBN)\n self.assertEqual(response.data, json.loads(open(UNIT_TEST_RESOURCES_FOLDER +\n FILE_NAME_ISBN_SEARCH_RESPONSE).read())[\"data\"])",
"d... | [
"0.77695554",
"0.72875947",
"0.714704",
"0.6777699",
"0.67719877",
"0.675688",
"0.67482865",
"0.6720576",
"0.6668579",
"0.6662156",
"0.6598414",
"0.657023",
"0.6536934",
"0.64985555",
"0.6488425",
"0.6473168",
"0.6417611",
"0.64053017",
"0.6354876",
"0.6300086",
"0.62986517",... | 0.8734922 | 0 |
return API time corrected for local timezone | def localize_time(self, apitime):
return self.feedzone.localize(apitime).astimezone(self.localzone) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timezone():\n \n pass",
"def local_time():\n return datetime.datetime.now().isoformat()[:len('2017-01-24T10:44:00')]",
"def _get_tz():\n return 'UTC'",
"def _get_datetime():\n pst_now = datetime.datetime.utcnow().astimezone(pytz.timezone(\"America/Los_Angeles\"))\n return pst_now.strftime(\"... | [
"0.7212565",
"0.7133227",
"0.69550765",
"0.67883587",
"0.67642075",
"0.66765994",
"0.6640911",
"0.6601219",
"0.6600101",
"0.6597976",
"0.6597636",
"0.6594265",
"0.6589398",
"0.6536743",
"0.64989436",
"0.6493774",
"0.64692587",
"0.6456862",
"0.644002",
"0.64021087",
"0.6392668... | 0.6696543 | 5 |
reverse localize_time to convert local timezone to API time | def unlocalize_time(self, apitime):
return self.localzone.localize(apitime).astimezone(self.feedzone) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def localize_time(self, apitime):\n return self.feedzone.localize(apitime).astimezone(self.localzone)",
"def localize_time_utc(non_utc_time):\n return pytz.utc.localize(non_utc_time)",
"def localize_time_utc(non_utc_time):\n return pytz.utc.localize(non_utc_time)",
"def localize(dt):\n if dt.... | [
"0.70825297",
"0.701795",
"0.701795",
"0.6822421",
"0.652934",
"0.652934",
"0.652934",
"0.64643",
"0.642147",
"0.64163226",
"0.6324556",
"0.626879",
"0.6254991",
"0.62439936",
"0.6230229",
"0.6203875",
"0.62010545",
"0.6193468",
"0.6165171",
"0.6119015",
"0.60487807",
"0.60... | 0.6317597 | 11 |
the bellman operator for the behavioral policy as a python function which takes the value function s^T P s + b represented as a numpy squared array P T(P,b) = R + theta_p^T Q theta_p + gamma (A + B theta_p)^T P (A + B theta_p), gamma (b + tr(P Sigma)) | def bellman_operator(self, P, b, policy="behavior"):
Q = np.matrix(self.mdp.Q)
R = np.matrix(self.mdp.R)
A = np.matrix(self.mdp.A)
B = np.matrix(self.mdp.B)
Sigma = np.matrix(np.diag(self.mdp.Sigma))
if policy == "behavior":
theta = np.matrix(self.behavior_po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RobustBellmanOp(P, Sigma, state, action, gamma):\n BV = 0\n # Here there is a strong assumption that\n # sum(p(s'|(s,a)) * R(s,a,s')) = R(s,a,s') = R(s,a)\n for t in P[state][action]:\n probability = t[0]\n nextstate = t[1]\n cost = t[2]\n done = t[3]\n # BV += ... | [
"0.71001726",
"0.68565446",
"0.6523547",
"0.6306089",
"0.6291289",
"0.6230942",
"0.61771154",
"0.6148315",
"0.60413855",
"0.5933376",
"0.5930906",
"0.5928049",
"0.5900982",
"0.5886188",
"0.5881746",
"0.58785963",
"0.58734393",
"0.5857429",
"0.58492917",
"0.5840334",
"0.581764... | 0.7670253 | 0 |
test a non existing sale_record cannot be retrieved | def test_get_non_existing_sale_record(self):
self.register_user()
result = self.login_user()
access_token = json.loads(result.data.decode())['token']
response = self.client.get('/api/v1/sale/100',
headers=dict(Authorization="Bearer " + access_token))
self.assertEqual(response.status_code, 404)
result =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cannot_get_empty_sales(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n\n resp = self.client.get(\n '/api/v1/sales/1',\n headers={'Authorization': 'Bearer {}'.f... | [
"0.67065454",
"0.65563065",
"0.6445439",
"0.6376305",
"0.6364539",
"0.63549346",
"0.6344477",
"0.63023585",
"0.6260622",
"0.62462413",
"0.6177097",
"0.61122227",
"0.6104429",
"0.6096169",
"0.60852754",
"0.6059171",
"0.6040166",
"0.6034094",
"0.6025876",
"0.60226256",
"0.60205... | 0.83915794 | 0 |
Wraps the core BERT model as a keras.Model. | def get_bert_model(input_word_ids,
input_mask,
input_type_ids,
config=None,
name=None,
float_type=tf.float32,
share_parameter_across_layers=False):
bert_model_layer = BertModel(
config=config, float_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_model(self):\n\n\t\t# Input layers\n\t\tinput_bert_ids = Input(shape=(self.batch_max_sentences, self.bert_wrapper.max_seq_len), name='bert_input_ids', dtype='int32')\n\t\tinput_bert_att = Input(shape=(self.batch_max_sentences, self.bert_wrapper.max_seq_len), name='bert_attention_ids', dtype='int32')\n\t... | [
"0.72094166",
"0.71153945",
"0.6757933",
"0.6557551",
"0.6524431",
"0.65141064",
"0.6411738",
"0.6394894",
"0.6390862",
"0.6388574",
"0.63608235",
"0.6341187",
"0.63348085",
"0.63262266",
"0.6325279",
"0.6321138",
"0.6299965",
"0.6294272",
"0.62942296",
"0.6273413",
"0.627213... | 0.65128464 | 6 |
Return registered group with the given group id | def get(self):
self._group = self._client.get(
url=self._client.get_full_url(
self.get_path(
'single', realm=self._realm_name, group_id=self._group_id
)
)
)
self._group_id = self._group["id"]
return self._group | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group(self, group_id):\n return self.root.get(group_id)",
"def getGroupById(self, id):\n for group in self.groups:\n if group.id == id:\n return group\n\n return None",
"def get_group(self, group_id: str) -> dict:\n group = self.ms_client.http_reque... | [
"0.8029542",
"0.79949456",
"0.7972709",
"0.7740636",
"0.7728499",
"0.7666988",
"0.76289696",
"0.75440896",
"0.75185275",
"0.74773175",
"0.73800594",
"0.7367363",
"0.7357759",
"0.7311793",
"0.73070186",
"0.7265864",
"0.7263907",
"0.7083139",
"0.70819503",
"0.7020503",
"0.69858... | 0.67001593 | 40 |
Return NPSH in ft given suction and vapor pressure in Pa and density in kg/m^3. | def calc_NPSH(P_suction, P_vapor, rho_liq):
# Note: NPSH = (P_suction - P_vapor)/(rho_liq*gravity)
# Taking into account units, NPSH will be equal to return value
return 0.334438*(P_suction - P_vapor)/rho_liq | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phosfracs(h,ks):\n k1p,k2p,k3p = ks\n h3po4 = h*h*h\n h2po4 = k1p*h*h\n hpo4 = k1p*k2p*h\n po4 = k1p*k2p*k3p\n denom = h3po4 + h2po4 + hpo4 + po4\n h3po4 /= denom\n h2po4 /= denom\n hpo4 /= denom\n po4 /= denom\n return h3po4,h2po4,hpo4,po4",
"def get_f_s_gas(p: float, ... | [
"0.6685551",
"0.639336",
"0.6244425",
"0.6082317",
"0.60762024",
"0.6053931",
"0.60533136",
"0.6028373",
"0.6004268",
"0.59924716",
"0.5931524",
"0.5906271",
"0.5870304",
"0.5837564",
"0.58216316",
"0.5757926",
"0.5748486",
"0.5741466",
"0.57287925",
"0.57140833",
"0.56934816... | 0.72387576 | 0 |
generate a random string | def random_string(n, alphabet=string.ascii_lowercase):
return "".join(random.choice(alphabet) for _ in range(n)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))",
"def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec",
"def __generate_random_string():\n return uuid4().hex[:6].upper()",
"def r... | [
"0.850504",
"0.84503955",
"0.8107285",
"0.8030303",
"0.79917127",
"0.7966936",
"0.7955794",
"0.783599",
"0.7833559",
"0.7833183",
"0.7817233",
"0.7802888",
"0.7779429",
"0.7768785",
"0.7746513",
"0.77311516",
"0.7703917",
"0.77027106",
"0.7688608",
"0.7673507",
"0.7664003",
... | 0.0 | -1 |
Given a specific environment, creates an SARSA agent specific for this environment. Can only handle discrete environments. | def create_agent(self, env):
if isinstance(env.action_space, gym.spaces.Discrete):
return SarsaAgent(
obs_dim=env.observation_space.shape[0],
act_dim=env.action_space.n,
hidden_sizes=[64],
)
raise ValueError("SARSA can only be use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_agent(self, env):\n\n if isinstance(env.action_space, gym.spaces.Box):\n return ContinuousReinforceAgent(\n obs_dim=env.observation_space.shape[0],\n act_dim=env.action_space.shape[0],\n hidden_sizes=[64],\n )\n\n if isinst... | [
"0.66630644",
"0.6631694",
"0.65505534",
"0.5953285",
"0.59230745",
"0.59207326",
"0.5811515",
"0.56780297",
"0.5674116",
"0.5648996",
"0.56102073",
"0.5546342",
"0.5455327",
"0.5420759",
"0.5400671",
"0.5400206",
"0.5390566",
"0.53870106",
"0.5293561",
"0.52203923",
"0.52186... | 0.76628625 | 0 |
Read dataset file and assigns dataframe object to _df | def read_csv(self) -> None:
self._df = pd.read_csv(self._dataset_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_from_file(filename):\r\n df = pd.read_csv(filename)\r\n return df",
"def load_file(self):\n\n self.df = self.sqlContext.read.csv(self.source, sep=self.sep, header=True, inferSchema=True)",
"def __init__(self, file_path: str):\n self._data: pd.DataFrame = self.read_input_and_s... | [
"0.73519945",
"0.71827435",
"0.7137628",
"0.71346796",
"0.7073277",
"0.7056249",
"0.7042096",
"0.7015911",
"0.6976835",
"0.69308776",
"0.6821296",
"0.6812685",
"0.6812685",
"0.6812685",
"0.67467344",
"0.6741589",
"0.67386633",
"0.6737851",
"0.6723442",
"0.669246",
"0.6677787"... | 0.7191624 | 1 |
Splits the dataset in to training set and testing set | def train_test_split(self) -> None:
X = self._df[['Avg. Area Income', 'Avg. Area House Age', 'Avg. Area Number of Rooms',
'Avg. Area Number of Bedrooms', 'Area Population']]
y = self._df['Price']
self._X_train, self._X_test, self._y_train, self._y_test = train_test_split(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_split(raw_training_data, test_size=0.2, random_state=42)\n return train_set, test_set",
"def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n ... | [
"0.86097497",
"0.8584347",
"0.82286584",
"0.82185394",
"0.8021438",
"0.794746",
"0.79276013",
"0.7921467",
"0.791578",
"0.7897465",
"0.78501225",
"0.7830136",
"0.7821321",
"0.78176755",
"0.7755438",
"0.7750092",
"0.7728479",
"0.77197564",
"0.77020323",
"0.7688907",
"0.7685516... | 0.0 | -1 |
Generates an IPP Message. Returns the message as a string of text. | def dump(self) :
mybuffer = []
if None not in (self.version, self.operation_id) :
mybuffer.append(chr(self.version[0]) + chr(self.version[1]))
mybuffer.append(pack(">H", self.operation_id))
mybuffer.append(pack(">I", self.request_id or 1))
for attrtype... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_message(self):\n msg_type = self.msg_type\n if msg_type == \"PUBMSG\":\n msg_type = \"PRIVMSG\"\n ret = \"{} {}\".format(msg_type, self.target)\n if self.content:\n ret += \" :{}\".format(self.content)\n return ret + \"\\r\\n\"",
"def genMsg(... | [
"0.660275",
"0.6068894",
"0.6058",
"0.6035902",
"0.6021112",
"0.5987677",
"0.59774643",
"0.59565526",
"0.5929928",
"0.591374",
"0.58054256",
"0.58035034",
"0.5764994",
"0.57645506",
"0.573444",
"0.5671204",
"0.5671204",
"0.5671204",
"0.5671204",
"0.5671204",
"0.56234944",
"... | 0.0 | -1 |
The identity block is the block that has no ConvGRU layer at shortcut. Arguments | def identity_block(input_tensor, kernel_size, filters, stage, block):
filters1, filters2, filters3 = filters
if K.image_data_format() == 'channels_last':
bn_axis = 3
else:
bn_axis = 1
conv_name_base = 'res' + str(stage) + block + '_branch'
bn_name_base = 'bn' + str(stage) + block + '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_block(self,X,stage,block):\n conv_name_base='res'+str(stage)+block+'_branch'\n bn_name_base='bn'+str(stage)+block+'_branch'\n \n #retrieve the filters\n #F1,F2,F3=filters\n \n X_shortcut=X\n \n #first component of main path\n X=Conv... | [
"0.7053969",
"0.6951196",
"0.69148076",
"0.69123244",
"0.69026166",
"0.6895569",
"0.68718547",
"0.68239397",
"0.67982614",
"0.6778847",
"0.6770707",
"0.6738197",
"0.67351675",
"0.67298466",
"0.67144144",
"0.67034507",
"0.67034507",
"0.66972566",
"0.6693836",
"0.66613907",
"0.... | 0.7369076 | 0 |
A block that has a conv layer at shortcut. Arguments | def conv_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2)):
filters1, filters2, filters3 = filters
if K.image_data_format() == 'channels_last':
bn_axis = 3
else:
bn_axis = 1
conv_name_base = 'res' + str(stage) + block + '_branch'
bn_name_base = 'bn' + str(stage)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_block(self, output_channel, filter_, activate):\n return self.add_layer(conv_block, output_channel, filter_, activate)",
"def _convolution_block(self, X, filters, f, s, stage, block):\n\n\t\tconv_layer_name = 'res' + str(stage) + block + '_branch'\n\t\tbn_layer_name = 'bn' + str(stage) + block + ... | [
"0.72210574",
"0.6797653",
"0.67508686",
"0.673468",
"0.6702727",
"0.66709983",
"0.66706705",
"0.6638113",
"0.6602907",
"0.6602907",
"0.65983295",
"0.65591985",
"0.6556552",
"0.6553555",
"0.6531844",
"0.65101147",
"0.650745",
"0.6479069",
"0.6421294",
"0.64118993",
"0.6391051... | 0.6319449 | 30 |
Get the Women's Bathroom status. | def get_bathroom_buddy_womens_status(message):
status = subscribe.simple(
"Home/womens/state", hostname="m16.cloudmqtt.com",
auth={'username': os.environ['USERNAME'],
'password': os.environ['SLACK_PASS']},
port=21775, tls={'ca_certs': certifi.where()})
return(status.payloa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n return STATUSES.get(self._mower_status, {}).get('message', self._mower_status)",
"def get_power_status(self):\n response = self.parent.power_manager.get_status()\n if response is not None:\n response = response[0]\n\n batteries = []\n for ... | [
"0.6468318",
"0.6393942",
"0.6363238",
"0.63195926",
"0.60368097",
"0.6002562",
"0.59756094",
"0.59639066",
"0.59639066",
"0.59282535",
"0.590928",
"0.590928",
"0.590928",
"0.5900921",
"0.5868397",
"0.58677864",
"0.58677864",
"0.58677864",
"0.58677864",
"0.58677864",
"0.58677... | 0.63199383 | 3 |
Creates a new room. The rooms is a list of lists, where every list represents a column. Tiles | def create_room(w, h):
# map[0] gives a list which represents the row, or the x. Then map[x][y]
# gives the yth place in the column x.
room = [[' ' for j in range(h)] for i in range(w)]
for x in range(w):
for y in range(h):
if y == 0 or y == (h-1):
room[x][y] = '-'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_rooms(width=10, height=10):\n # create blank rooms\n rooms = [Room(id) for id in range(1, (width * height + 1))]\n\n # make some rooms inaccessible\n for _ in range(0, height*width//10):\n rand_num = randint(0, height*width-1)\n while rooms[rand_num].is_accessible == False:\n ... | [
"0.7591706",
"0.71845305",
"0.71760666",
"0.7051529",
"0.69662994",
"0.66109204",
"0.6405384",
"0.6376221",
"0.63713443",
"0.630056",
"0.6272139",
"0.62588125",
"0.62555104",
"0.6243304",
"0.6191843",
"0.6115295",
"0.6084862",
"0.60528034",
"0.6038224",
"0.6000447",
"0.596918... | 0.7119422 | 3 |
Draw black hashed vertical gridlines showing major time divisions. | def _draw_major_divisions(self, painter, stamps, start_stamp, division):
label_y = self._history_top - self._current_pos_pointer_size[1] - 5
for stamp in stamps:
x = self.map_stamp_to_x(stamp, False)
label = self._get_label(division, stamp - start_stamp)
label_x = x + self._major_divisions_label_indent
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_gray_grid(self):\n gray = \"#D3D3D3\"\n # Draw the vertical lines\n for x in range(0, self.width, self.scale):\n self.canvas.create_line(x, 0, x, self.height, fill=gray)\n\n # Draw the horizontal lines\n for y in range(0, self.height, self.scale):\n ... | [
"0.69875175",
"0.68149954",
"0.6810751",
"0.6640372",
"0.6640368",
"0.6514969",
"0.64459324",
"0.6404875",
"0.63303",
"0.6300145",
"0.62667954",
"0.6247951",
"0.6237642",
"0.6236573",
"0.6233812",
"0.62030315",
"0.61506754",
"0.6144414",
"0.61432195",
"0.61411273",
"0.6073863... | 0.5688038 | 50 |
Return JSONserializable representation of the object. | def to_dict(self):
out = super().to_dict()
out["connections"] = self.connections
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self, obj):\n return json.dumps(obj)",
"def toJSON(self):\n return json.dumps(self, default=lambda o: o.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def toJSON(cls, obj):\n return json.dumps(obj)",
"def serialize(self) -> str:\n r... | [
"0.8475618",
"0.84085596",
"0.83957154",
"0.838217",
"0.83239555",
"0.8288305",
"0.8275888",
"0.8227394",
"0.81710005",
"0.81556803",
"0.8117269",
"0.8117269",
"0.81065536",
"0.81065536",
"0.81065536",
"0.80988455",
"0.80659264",
"0.8029448",
"0.7999212",
"0.799741",
"0.79870... | 0.0 | -1 |
Returns the type of piece in a position on the board | def piece_type(self, pos, board):
piece = board[self.ind(pos)[0]][self.ind(pos)[1]]
return piece | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_piece_type(self, pos):\n piece = self.get_board()[self.ind(pos)[0]][self.ind(pos)[1]]\n return piece",
"def piece_type(self):\n return self._piece_type",
"def piece_type(self):\n return self._piece_type",
"def piece_type(self):\n return self._piece_type",
"def pie... | [
"0.86817193",
"0.7477756",
"0.7477756",
"0.7477756",
"0.7477756",
"0.7477756",
"0.7477756",
"0.74554956",
"0.7289101",
"0.72572297",
"0.69393",
"0.6906759",
"0.66416234",
"0.6636054",
"0.6636054",
"0.66352475",
"0.66080254",
"0.66080254",
"0.66034764",
"0.6596245",
"0.6439447... | 0.8838244 | 0 |
Returns the color of the piece | def get_color(self):
return self._color | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color(piece):\n return Color.BLACK if piece in {Piece.BP, Piece.BN, Piece.BB, Piece.BR, Piece.BQ, Piece.BK} else Color.WHITE",
"def piece_color(self, piece):\n if piece == None:\n return None\n if ord(ChessPiece.W_KING) <= ord(piece) <= ord(ChessPiece.W_PAWN):\n ret... | [
"0.7939147",
"0.7717077",
"0.7684216",
"0.76383805",
"0.7632601",
"0.7610868",
"0.7576671",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7528468",
"0.75168306",
"0.7486091",
"0.74580204",
"0.7429947",
"0.7415221",
"0.7405115",
"0.73971117",
"0.7374749",
"0.7362447",... | 0.7503997 | 14 |
Returns a list of all the input queues of the NetworkDevice instance. | def input_queues(self):
return [port.in_queue for port in self.ports] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queue_list(self):\n return self.manager.get_queue_list()",
"def queues(self):\r\n return queues.Queues(self)",
"def queues(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"queues\")",
"def _get_queues(self):\n return self.__queues",
"... | [
"0.7292679",
"0.6934699",
"0.69167936",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66446567",
"0.66436195",
"0.6511804",
"0.6432993",
"0.63185084",
"0.604206",
"0.6019034",
"0.5928827",
"0.5894514",
"0.58... | 0.8002415 | 0 |
Integer that uniquely identifies the Message instance. | def identifier(self):
return self._identifier | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def msg_id(self):\n return struct.unpack('<H', self.pkt.payload[0:2])[0]",
"def message_id(self) -> int:\n enforce(self.is_set(\"message_id\"), \"message_id is not set.\")\n return cast(int, self.get(\"message_id\"))",
"def getMessageID(self):\n return self._payload[1]",
"def _gen... | [
"0.76075435",
"0.7545699",
"0.73668766",
"0.7294178",
"0.7286209",
"0.70943856",
"0.68959796",
"0.6863287",
"0.6861981",
"0.6852783",
"0.6852783",
"0.6852783",
"0.6852783",
"0.6852783",
"0.6852783",
"0.6852783",
"0.6852783",
"0.6852783",
"0.6852783",
"0.6852783",
"0.6852783",... | 0.0 | -1 |
Returns true if self and message are identical except for the message identifier. | def __eq__(self, message):
return (self.source == message.source and
self.destination == message.destination and
self.size_bytes == message.size_bytes and
self.message_type == message.message_type and
self.data == message.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n result = NotImplemented\n if isinstance(other, Message):\n result = False\n if self is other:\n result = True\n else:\n # does not compare _id\n if (self._message_length == other._message_length a... | [
"0.75409573",
"0.6845765",
"0.6833236",
"0.67646956",
"0.676177",
"0.67007315",
"0.6687098",
"0.6542909",
"0.6538792",
"0.6526526",
"0.6486344",
"0.64815634",
"0.6458272",
"0.6454662",
"0.6447595",
"0.6419478",
"0.63492614",
"0.6322484",
"0.6286339",
"0.6276497",
"0.6268068",... | 0.735989 | 1 |
Computes cross entropy between predicted and true discrete distrubtions. | def cross_entropy(true, pred, axis=-1, epsilon=1e-7):
pred = ivy.clip(pred, epsilon, 1 - epsilon)
log_pred = ivy.log(pred)
# noinspection PyUnresolvedReferences
return -ivy.reduce_sum(log_pred * true, axis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_entropy(y_observed, p):\n\n pass",
"def cross_entropy(self, true_values, predicted_values):\n\n testing_set_size = len(true_values)\n running_sum = 0\n for i in range(len(true_values)):\n true_set = true_values[i]\n predicted_set = predicted_values[i]\n ... | [
"0.7500701",
"0.73290604",
"0.7280353",
"0.72169656",
"0.71859753",
"0.7156666",
"0.7091561",
"0.70152426",
"0.6998785",
"0.6982236",
"0.6946835",
"0.68625927",
"0.6841047",
"0.68150157",
"0.67943674",
"0.67832506",
"0.6776295",
"0.67718947",
"0.6770149",
"0.67530984",
"0.674... | 0.7321498 | 2 |
Computes sparse cross entropy between logits and labels. | def sparse_cross_entropy(true, pred, axis=-1, epsilon=1e-7):
true = ivy.one_hot(true, pred.shape[axis])
return cross_entropy(true, pred, axis, epsilon) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparse_softmax_cross_entropy_with_logits(\n labels=None,\n logits=None,\n name=None):\n _ensure_xent_args(\"sparse_softmax_cross_entropy_with_logits\", labels, logits)\n\n # TODO(pcmurray) Raise an error when the label is not an index in\n # [0, num_classes). Note: This could break users who call t... | [
"0.7383931",
"0.731593",
"0.7313389",
"0.7231131",
"0.71668744",
"0.7103112",
"0.70853496",
"0.70765847",
"0.7019666",
"0.69701236",
"0.6949585",
"0.69058555",
"0.68960786",
"0.68960786",
"0.6874639",
"0.68409586",
"0.68385947",
"0.67765355",
"0.67698383",
"0.67664945",
"0.67... | 0.75039977 | 0 |
(Computed) The etag of the IAM policy. | def etag(self) -> str:
return pulumi.get(self, "etag") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def etag(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> pulumi.Output[str]:\n return pul... | [
"0.70715654",
"0.70715654",
"0.70715654",
"0.70715654",
"0.70715654",
"0.70715654",
"0.70715654",
"0.6971113",
"0.6930204",
"0.6930204",
"0.6930204",
"0.6930204",
"0.6930204",
"0.6930204",
"0.6930204",
"0.6930204",
"0.6930204",
"0.6930204",
"0.6930204",
"0.6930204",
"0.693020... | 0.71049285 | 6 |
Get all instances of this class in the registry. | def get_instances(cls, recursive=False):
instances = list(cls._instances)
if recursive:
for Child in cls.__subclasses__():
instances += Child.get_instances(recursive=recursive)
# Remove duplicates from multiple inheritance.
return list(set(instances)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_instances(cls):\n raise NotImplementedError",
"def get_all_cached_instances(cls):\n return list(cls.__dbclass__.__instance_cache__.values())",
"def getinstances(cls):\n\t\t\tdead = set()\n\t\t\tfor ref in cls._instances:\n\t\t\t\tobj = ref()\n\t\t\t\tif obj is not None:\n\t\t\t\t\tyield o... | [
"0.7619687",
"0.72287494",
"0.70653266",
"0.7045179",
"0.6888304",
"0.68455154",
"0.68399835",
"0.6827565",
"0.6720347",
"0.6706184",
"0.66594434",
"0.6623655",
"0.6620567",
"0.65878433",
"0.65827703",
"0.6566919",
"0.6550206",
"0.65336657",
"0.6468475",
"0.64582914",
"0.6431... | 0.732727 | 1 |
Gets all the models which share the MetaModel origin. | def get_models(cls, recursive=False):
models = list(cls._models)
if recursive:
for child in cls.__subclasses__():
models += child.get_models(recursive=recursive)
return list(models) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def models(self):\r\n return self.get_field('model')",
"def models(self):\r\n return self.get_field('model')",
"def peak_all_models(self) -> List:\n models = list(self.meta.name)\n print(models)\n return models",
"def get_related_models(self):\n\t\tmodels = []\n\t\tif not s... | [
"0.67832965",
"0.67832965",
"0.6562437",
"0.6512124",
"0.6445747",
"0.63675845",
"0.63225657",
"0.62866795",
"0.6277958",
"0.62186563",
"0.61224395",
"0.6100776",
"0.6088184",
"0.6084223",
"0.6077946",
"0.6038946",
"0.6030036",
"0.6029571",
"0.5980312",
"0.5946005",
"0.594548... | 0.5592448 | 28 |
Insert a new Node at the end of linked list | def insert(self, data):
if self.head == None:
self.head = Node(data)
else:
curr = self.head
while curr.link != None:
curr = curr.link
curr.link = Node(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_end(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n while temp.next is not None:\n temp = temp.next\n temp.next = ListNode(data)",
"def insert_after(self,node,new_node):\n n... | [
"0.8148187",
"0.7815384",
"0.7763275",
"0.7622498",
"0.7496598",
"0.74464536",
"0.74432915",
"0.7405461",
"0.73680526",
"0.7358912",
"0.72806185",
"0.72622913",
"0.72363603",
"0.7232796",
"0.71699554",
"0.7160366",
"0.7143708",
"0.7132515",
"0.7132515",
"0.71115035",
"0.70284... | 0.70837075 | 20 |
Get the event type | def __unicode__(self):
return "%d" % (self.type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_event_type(event):\n return event.type()",
"def _get_event_type(event):\n return event.type()",
"def get_type(self):\n return self.event_type",
"def event_type(self) -> int:\n return self.data[\"args\"][\"eventType\"]",
"def type(self) -> str:\n return self._even... | [
"0.9124082",
"0.9124082",
"0.90069985",
"0.8711404",
"0.83575463",
"0.82805854",
"0.80476016",
"0.80090797",
"0.77455413",
"0.76935184",
"0.76803297",
"0.76801234",
"0.7523564",
"0.73957133",
"0.71513206",
"0.7093203",
"0.7033223",
"0.69131833",
"0.6899823",
"0.6825652",
"0.6... | 0.0 | -1 |
The servo that was active when the error occurred. | def servo(self) -> Optional[servo.Servo]:
return self._servo | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def servo_active(self, *args, **kwargs) -> Any:\n pass",
"def status(self):\n return self._bp.get_motor_status(self._port)",
"def servo_on(self):\n self.logger.info('Setting servo ON')\n self.electronics.move_servo(1)\n self.config['servo']['status'] = 1",
"def controller_s... | [
"0.6637851",
"0.59305996",
"0.57332313",
"0.5726711",
"0.5699285",
"0.56845474",
"0.5684502",
"0.56725603",
"0.56126374",
"0.55574274",
"0.55151606",
"0.54930377",
"0.5473341",
"0.54207635",
"0.5410516",
"0.53283364",
"0.5266262",
"0.5254195",
"0.52259874",
"0.52212095",
"0.5... | 0.6539491 | 1 |
Initialises a new ReadingLoader instance to read and process data from files generated by the RED reading task. Arguments data_dir String. Path to the directory that contains data files that need to be loaded. Keyword Arguments output_path String. Path to the file in which processed data needs to be stored, or None to ... | def __init__(self, data_dir, output_path=None, task_name="ReadingTest", \
answer_file=None):
# Define the default answer_file.
if answer_file is None:
answer_file = os.path.join( \
os.path.dirname(os.path.abspath(__file__)), \
"reading_ans... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, data_dir, output_path=None, task_name=\"Q1_Questions\"):\n \n # Remember the task name.\n self._task_name = task_name\n # Load all data.\n self.load_from_directory(data_dir, task_name)\n self.process_raw_data()\n if not (output_path is None):\n ... | [
"0.68810457",
"0.6347282",
"0.63151276",
"0.60448104",
"0.59106815",
"0.5840321",
"0.57810795",
"0.5776484",
"0.5745916",
"0.5745365",
"0.569666",
"0.5693174",
"0.56790227",
"0.5678662",
"0.5673701",
"0.56613",
"0.5648839",
"0.5613989",
"0.5597921",
"0.55950487",
"0.5570015",... | 0.6832593 | 1 |
Load the pretrained model weights | def load_model_weights(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self):\n if isinstance(self.pretrained, str):\n logger = get_root_logger()\n logger.info(f'load model from: {self.pretrained}')\n load_checkpoint(self, self.pretrained, strict=False, logger=logger)\n elif self.pretrained is None:\n pass\n ... | [
"0.81840134",
"0.80532205",
"0.7929311",
"0.7929236",
"0.78598017",
"0.7832963",
"0.78319764",
"0.777211",
"0.7706451",
"0.76879597",
"0.7657897",
"0.76478493",
"0.76099664",
"0.760729",
"0.7571413",
"0.7569362",
"0.7523776",
"0.75005925",
"0.75003874",
"0.7451586",
"0.741773... | 0.8207032 | 0 |
Initializes the model, creates the required layers. | def __init__(self, name, config):
super(RelationalNetwork, self).__init__(name, RelationalNetwork, config)
# Get key mappings.
self.key_feature_maps = self.stream_keys["feature_maps"]
self.key_question_encodings = self.stream_keys["question_encodings"]
self.key_outputs = self.st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_layers(self):\n self._init_predictor()\n if self.use_edge_fusion:\n self._init_edge_module()",
"def initialisation(self):\n self.create_variables()\n self.create_placeholders()\n self.build_model()\n self.reset_lr(None, True)\n self.build_loss... | [
"0.75353396",
"0.7385353",
"0.7351519",
"0.7341105",
"0.73163855",
"0.72941434",
"0.7234489",
"0.72314245",
"0.7228721",
"0.7154608",
"0.7117338",
"0.69305784",
"0.6902656",
"0.68918926",
"0.68781185",
"0.68505406",
"0.684789",
"0.68447316",
"0.68215775",
"0.67649424",
"0.673... | 0.0 | -1 |
Function returns a dictionary with definitions of output data produced the component. | def output_data_definitions(self):
return {
self.key_outputs: DataDefinition([-1, self.output_size], [torch.Tensor], "Batch of outputs [BATCH_SIZE x OUTPUT_SIZE]")
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_data_definitions(self):\n return {}",
"def _get_output_dictionary(self):\n\n return_dictionary = {}\n\n for output_path in self.provided_outputs:\n return_dictionary[output_path.full_path] = self.get_value(output_path)\n\n return return_dictionary",
"def output... | [
"0.79142004",
"0.7396703",
"0.72935414",
"0.714347",
"0.68933153",
"0.67715305",
"0.6712582",
"0.6655782",
"0.6595801",
"0.6583784",
"0.6554832",
"0.65446115",
"0.6532827",
"0.6519101",
"0.65083754",
"0.64225125",
"0.6382813",
"0.6379986",
"0.63664275",
"0.6361891",
"0.635461... | 0.7505002 | 1 |
x a tensor of shape (batch, input_seq_len, dm)containing the input to the encoder training a boolean to determine if the model is training mask the mask to be applied for multi head attention | def call(self, x, training, mask):
seq_len = tf.shape(x)[1]
# adding embedding and position encoding.
embedding = self.embedding(x) # (batch_size, input_seq_len, d_model)
embedding *= tf.math.sqrt(tf.cast(self.dm, tf.float32))
embedding += self.positional_encoding[:, :seq_len, :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x, mask):\n x = self.sublayer[0](x, lambda x: self.self_attn(x, x, x, mask))\n #print('encoder')\n #print(x.shape)\n return self.sublayer[1](x, self.feed_forward)",
"def forward(self, x: Tensor) -> Tensor:\n x1 = x[:, 0]\n x2 = x[:, 1]\n features... | [
"0.68944144",
"0.6433218",
"0.6370818",
"0.6343878",
"0.6306005",
"0.6193689",
"0.6187625",
"0.61835486",
"0.6144924",
"0.6137682",
"0.61019653",
"0.60944766",
"0.603872",
"0.60364276",
"0.6025595",
"0.59151536",
"0.5872006",
"0.5864127",
"0.5857473",
"0.5822816",
"0.5774186"... | 0.629951 | 5 |
x a tensor of shape (batch, target_seq_len, dm)containing the input to the decoder encoder_output a tensor of shape (batch, input_seq_len, dm) containing the output of the encoder training a boolean to determine if the model is training look_ahead_mask the mask to be applied to the first multi head attention layer padd... | def call(self, x, encoder_output, training,
look_ahead_mask, padding_mask):
seq_len = tf.shape(x)[1]
attention_weights = {}
x = self.embedding(x)
x *= tf.math.sqrt(tf.cast(self.dm, tf.float32))
x += self.positional_encoding[:, :seq_len, :]
x = self.dropout(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, state, encoder_padding_mask):\n residual = state.clone()\n\n '''\n ___QUESTION-6-DESCRIBE-D-START___\n What is the purpose of encoder_padding_mask? What will the output shape of `state' Tensor \n be after multi-head attention? HINT: formulate your answer in ter... | [
"0.68980443",
"0.6785151",
"0.672374",
"0.666072",
"0.6574727",
"0.649962",
"0.64837235",
"0.6482765",
"0.6397254",
"0.63569766",
"0.634568",
"0.6323986",
"0.63232094",
"0.62556964",
"0.62244546",
"0.6217759",
"0.6191466",
"0.6188659",
"0.61652607",
"0.6162906",
"0.6146513",
... | 0.72239923 | 0 |
N the number of blocks in the encoder and decoder dm the dimensionality of the model h the number of heads hidden the number of hidden units in the fully connected layers input_vocab the size of the input vocabulary target_vocab the size of the target vocabulary max_seq_input the maximum sequence length possible for th... | def __init__(self, N, dm, h, hidden, input_vocab, target_vocab,
max_seq_input, max_seq_target, drop_rate=0.1):
super().__init__()
self.encoder = Encoder(N, dm, h, hidden, input_vocab,
max_seq_input, drop_rate)
self.decoder = Decoder(N, dm, h, hidde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super(Decoder_1m, self).__init__()\n self.lconvtwos = nn.ModuleList(\n [\n nn.Sequential(\n nn.Dropout(p=0.1),\n nn.Conv2d(128, 32, kernel_size=(3, 3), padding=1),\n nn.BatchNorm2d(32),\n ... | [
"0.6649107",
"0.6574562",
"0.6515605",
"0.64855504",
"0.6468661",
"0.64408153",
"0.64387065",
"0.64374036",
"0.6415218",
"0.63973427",
"0.6371662",
"0.6340037",
"0.62952334",
"0.6289063",
"0.62647885",
"0.62570995",
"0.6251119",
"0.6237663",
"0.6213453",
"0.61888",
"0.6172886... | 0.7143646 | 0 |
Return the state attributes of the sensor. | def extra_state_attributes(self) -> dict[str, Any]:
ret = {
ATTR_SOURCE: self._source_entity_id,
ATTR_COEFFICIENTS: self._coefficients,
}
if self._source_attribute:
ret[ATTR_SOURCE_ATTRIBUTE] = self._source_attribute
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self) ... | [
"0.8418945",
"0.82497084",
"0.8243777",
"0.8243777",
"0.8200083",
"0.8169021",
"0.8169021",
"0.8159991",
"0.8159991",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
... | 0.0 | -1 |
Gets the color_depth of this GIFOutput. Amount of colors in palette | def color_depth(self):
return self._color_depth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_explored(self):\n return self.__num_explored",
"def queryNumberOfColors(self):\n self._numColorsInUse = \\\n self._readInt('How many colors are available', 2, len(self._palette))\n return self._numColorsInUse",
"def num_depth(self):\n return len(self._sizes) + len(self._ra... | [
"0.68169844",
"0.65945107",
"0.65047747",
"0.64739394",
"0.6416106",
"0.6415538",
"0.6361293",
"0.63216704",
"0.6281688",
"0.62379676",
"0.622544",
"0.61876786",
"0.6183844",
"0.6128096",
"0.60531795",
"0.60531795",
"0.60180753",
"0.592283",
"0.5902543",
"0.5848112",
"0.58416... | 0.8169639 | 0 |
Sets the color_depth of this GIFOutput. Amount of colors in palette | def color_depth(self, color_depth):
self._color_depth = color_depth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetDepth(*args, **kwargs):\n return _gdi_.Bitmap_SetDepth(*args, **kwargs)",
"def set_depth(self, depth):\n self._depth = depth\n if self._scaled_image_coordinates is None:\n self._initialise()\n else:\n self._update_depth()",
"def color_depth(self):\n ... | [
"0.6401659",
"0.6380821",
"0.6300926",
"0.62612724",
"0.5997467",
"0.5974511",
"0.5967667",
"0.5931414",
"0.5931148",
"0.59209645",
"0.58476746",
"0.58119255",
"0.57820714",
"0.57815474",
"0.5667481",
"0.5611237",
"0.5600413",
"0.5562935",
"0.5406338",
"0.53640157",
"0.535976... | 0.756508 | 0 |
Gets the height of this GIFOutput. Height of the media to be rendered, in pixels. Should be the height of your scenes unless a smaller resolution is needed. Resolution higher than the scene resolution reduces quality. The width is automatically calculated to keep the aspect ratio. | def height(self):
return self._height | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_height(self) -> int:\n return self.rsimulator.get_frame_height()",
"def get_height(self):\n if self.height:\n return self.height\n \n if not self._oembed:\n return ''\n \n return self._oembed.get('height', None)",
"def height(self):\n return self... | [
"0.7565148",
"0.73991317",
"0.7380456",
"0.736369",
"0.7310083",
"0.7279103",
"0.72679317",
"0.7228617",
"0.72236824",
"0.71272886",
"0.71267223",
"0.70312136",
"0.70312136",
"0.7028361",
"0.70189685",
"0.7004611",
"0.6970833",
"0.6970833",
"0.6967758",
"0.69549733",
"0.69441... | 0.66156316 | 56 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.