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 |
|---|---|---|---|---|---|---|
Given a NumPy / OpenCV 2 image, crops it to the given width and height, around it's centre point | def crop_around_center(image, width, height):
image_size = (image.shape[1], image.shape[0])
image_center = (int(image_size[0] * 0.5), int(image_size[1] * 0.5))
if(width > image_size[0]):
width = image_size[0]
if(height > image_size[1]):
height = image_size[1]
x1 = int(image_cente... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crop(img: 'np.ndarray', x: int, y: int, width: int, height: int) -> 'np.ndarray':\n return img[y:y+height, x:x+width]",
"def crop_around_center(image, width, height):\r\n\r\n image_size = (image.shape[1], image.shape[0])\r\n image_center = (int(image_size[0] * 0.5), int(image_size[1] * 0.5))... | [
"0.76377535",
"0.74180055",
"0.7380922",
"0.7369841",
"0.7331407",
"0.728423",
"0.727816",
"0.7252315",
"0.72463363",
"0.72463363",
"0.7190007",
"0.7180537",
"0.7168692",
"0.7141646",
"0.71074295",
"0.70952344",
"0.70926756",
"0.7081143",
"0.7067312",
"0.7041019",
"0.7040211"... | 0.738121 | 4 |
Build API header using authorization token | def _make_header(self, token: str) -> dict:
header = HEADER.copy()
# modify to represent how to build the header
header['Authorization'] = f"Bearer {token}"
return header | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_auth_header(api_token):\n return {'Authorization': f'token {api_token}'}",
"def build_header(token: str = None):\n return {\n \"Content-Type\": \"application/json\",\n \"X-Auth-Token\": token or get_project_token(),\n }",
"def _make_header(self, token):\n header = HEADE... | [
"0.86079544",
"0.8266987",
"0.8259833",
"0.82146436",
"0.80822676",
"0.78398496",
"0.7626047",
"0.74493533",
"0.74467784",
"0.74467784",
"0.73052657",
"0.72448987",
"0.72024",
"0.7191292",
"0.7182246",
"0.7153723",
"0.7095803",
"0.70847106",
"0.70625544",
"0.70559555",
"0.703... | 0.80481756 | 5 |
Creates a conditional Normal distribution. | def __init__(self, size, hidden_layer_sizes, sigma_min=0.0,
raw_sigma_bias=0.25, hidden_activation_fn=tf.nn.relu,
initializers=None, name="conditional_normal_distribution"):
self.sigma_min = sigma_min
self.raw_sigma_bias = raw_sigma_bias
self.name = name
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, *args, **kwargs):\n mu, sigma = self.condition(args, **kwargs)\n return tf.contrib.distributions.Normal(loc=mu, scale=sigma)",
"def random_normal():\r\n return inverse_normal_cdf(random.random())",
"def random_normal():\n return inverse_normal_cdf(random.random())",
"de... | [
"0.713719",
"0.7050329",
"0.70172936",
"0.68370706",
"0.67517245",
"0.67022425",
"0.6654298",
"0.6631554",
"0.66306645",
"0.6614433",
"0.66123754",
"0.66123754",
"0.66123754",
"0.66123754",
"0.65456814",
"0.65394753",
"0.6531439",
"0.6509048",
"0.6492514",
"0.6492514",
"0.649... | 0.0 | -1 |
Determine whether a URI is a validate for one of the namespaces registered with Identifiers.org | def validate_identifiers_org_uri(uri):
match = re.match(r'^https?://identifiers\.org/((([^/:]+)/([^/:]+)|[^/:]+)([/:])(.+))$', uri)
try:
namespace = get_identifiers_org_namespace(match.group(2).lower())
except InvalidIdentifiersOrgUri:
if match.group(3):
namespace = get_identifie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasURI(self, *args):\n return _libsbml.XMLNamespaces_hasURI(self, *args)",
"def is_valid(BaseURL):\n parsed = urlparse(BaseURL)\n return bool(parsed.netloc) and bool(parsed.scheme)",
"def containsUri(self, *args):\n return _libsbml.XMLNamespaces_containsUri(self, *args)",
"def is_urn(... | [
"0.670965",
"0.667822",
"0.66165257",
"0.6595207",
"0.6498957",
"0.6455187",
"0.6331057",
"0.62750375",
"0.60879886",
"0.6053262",
"0.6042288",
"0.60388076",
"0.59925216",
"0.59925216",
"0.5972868",
"0.5916745",
"0.5874985",
"0.58692425",
"0.5814867",
"0.5754969",
"0.5753672"... | 0.6832338 | 0 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(GetPlanningSceneRequest, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.planning_scene_diff is None:
self.planning_scene_diff = arm_navigation_msgs.msg.PlanningScene()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.7793788",
"0.7720338",
"0.7720338",
"0.7686591",
"0.76257044",
"0.7563645",
"0.7439646",
"0.7417169",
"0.73514634",
"0.73075664",
"0.7279945",
"0.72372043",
"0.7227262",
"0.7224145",
"0.7224145",
"0.7218594",
"0.7211639",
"0.7211639",
"0.7211639",
"0.7211639",
"0.7211639",... | 0.6655072 | 81 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(GetPlanningSceneResponse, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.planning_scene is None:
self.planning_scene = arm_navigation_msgs.msg.PlanningScene()
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.77939296",
"0.7720264",
"0.7720264",
"0.76866186",
"0.7626193",
"0.756387",
"0.74395823",
"0.7416946",
"0.73519075",
"0.7308225",
"0.72806025",
"0.72379386",
"0.72272825",
"0.7224187",
"0.7224187",
"0.7218873",
"0.7211484",
"0.7211484",
"0.7211484",
"0.7211484",
"0.7211484... | 0.6496085 | 96 |
Constructor for the Automatic LGCLVO filter. | def __init__(self, mu = 99.0, LGC_iter = 10000, loss="xent"):
self.LGC_iter = LGC_iter
self.mu = mu
self.loss = loss | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n kernel=numpy.array([[-1, -1, -1],\n [-1, 9, -1],\n [-1, -1, -1]])\n VConvolutionFilter.__init__(self,kernel)",
"def __init__(self):\n kernel=numpy.array([[-1, -1, -1],\n [-1, 8, -1],\n ... | [
"0.684153",
"0.6822762",
"0.6768444",
"0.65728235",
"0.6482528",
"0.6418998",
"0.6218817",
"0.61606306",
"0.6114177",
"0.60896397",
"0.6044181",
"0.60398275",
"0.60277164",
"0.60212094",
"0.5996329",
"0.5957431",
"0.59321326",
"0.58675385",
"0.58473384",
"0.58357286",
"0.5828... | 0.5439086 | 85 |
Get the current user. | def _get_user_name():
return pwd.getpwuid(os.getuid())[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_user(self):\n return self.current_user",
"def get_current_user(self):\n return self.get_secure_cookie(\"user\")",
"def current_user(self):\n user_dict = self.auth.get_user_by_session()\n return self.auth.store.user_model.get_by_id(user_dict['user_id'])",
"def current_user(... | [
"0.8836685",
"0.87018216",
"0.86910814",
"0.8619504",
"0.85802186",
"0.8505428",
"0.8505428",
"0.8505428",
"0.8500047",
"0.8500047",
"0.84839404",
"0.8483425",
"0.84567",
"0.838958",
"0.8296931",
"0.8281396",
"0.82328916",
"0.815139",
"0.8126627",
"0.8124535",
"0.81106335",
... | 0.0 | -1 |
Load the YAML document from the specified file | def load_file(filename, default_namespace=None, verbose=False):
if not filename or filename == '-':
f = sys.stdin
if verbose:
print("reading parameters from stdin")
return load_str(f.read(), filename, default_namespace=default_namespace, verbose=verbose)
else:
if not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(file: Text):\n with open(file) as fp:\n return yaml.load(fp, yaml.FullLoader)",
"def load_yaml(file_path):\n with open(file_path) as fin:\n content = yaml.load(fin, Loader=yaml.FullLoader)\n return content",
"def load_yaml(file):\n with open(file, 'r') as file:\n... | [
"0.82032746",
"0.799028",
"0.7902689",
"0.77733713",
"0.77251863",
"0.7718737",
"0.7689882",
"0.7680805",
"0.76478076",
"0.761992",
"0.7570488",
"0.75476533",
"0.7541913",
"0.75214046",
"0.74628925",
"0.74222505",
"0.7397133",
"0.735951",
"0.73147076",
"0.7254368",
"0.7233035... | 0.0 | -1 |
Load the YAML document as a string | def load_str(str, filename, default_namespace=None, verbose=False):
paramlist = []
default_namespace = default_namespace or get_ros_namespace()
for doc in yaml.load_all(str):
if NS in doc:
ns = ns_join(default_namespace, doc.get(NS, None))
if verbose:
print("r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read(self, text):\n return yaml.safe_load(text)",
"def load_yaml(content):\n from yaml import load, FullLoader\n return load(content, Loader=FullLoader)",
"def load_yaml(path):\n fsock = open(path)\n \n try:\n yaml_string = fsock.read()\n yaml_obj = yaml.load(yaml_strin... | [
"0.6863694",
"0.6804904",
"0.66811365",
"0.6677459",
"0.65846384",
"0.6474035",
"0.6442895",
"0.6401044",
"0.63880545",
"0.63652253",
"0.63532954",
"0.6350741",
"0.63268185",
"0.6326625",
"0.62723863",
"0.62661546",
"0.62479424",
"0.6244294",
"0.62355375",
"0.62345165",
"0.62... | 0.0 | -1 |
Create a new empty TypedDict with key_type and value_type as the types for the keys and values of the dictionary respectively. | def empty(cls, key_type, value_type):
return cls(dcttype=DictType(key_type, value_type)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_dict(typingctx, keyty, valty, ptr):\n dict_ty = types.DictType(keyty.instance_type, valty.instance_type)\n\n def codegen(context, builder, signature, args):\n [_, _, ptr] = args\n ctor = cgutils.create_struct_proxy(dict_ty)\n dstruct = ctor(context, builder)\n dstruct.da... | [
"0.65021694",
"0.64598584",
"0.6137077",
"0.57969946",
"0.5718489",
"0.57113713",
"0.5672381",
"0.5653581",
"0.5650383",
"0.56327116",
"0.56033117",
"0.55712324",
"0.5465431",
"0.5454871",
"0.5421098",
"0.54094374",
"0.5404606",
"0.539811",
"0.5365514",
"0.5332857",
"0.532901... | 0.7523846 | 0 |
Returns the index of the correlation between an individual on the given index and the previous individual in the chain of individuals. | def _get_prev_correlation_index(self, index: int) -> int:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_next_correlation_index(self, index: int) -> int:\n pass",
"def correlations(self, index: int) -> Tuple[int, int]:\n prev_index = self._get_prev_correlation_index(index)\n next_index = self._get_next_correlation_index(index)\n return self._correlation[prev_index], self._correl... | [
"0.72343004",
"0.67907906",
"0.5708425",
"0.5613088",
"0.56076455",
"0.5580767",
"0.55760086",
"0.5514937",
"0.5512073",
"0.5502395",
"0.54905945",
"0.5446895",
"0.53913903",
"0.53371644",
"0.5299722",
"0.5287811",
"0.5280381",
"0.5261069",
"0.52596474",
"0.5218803",
"0.52167... | 0.7917535 | 0 |
Creates heatmap by stitching patch_right on to patch_left Overlap region heatmap is the weighted sum of two patches | def stitch_to_right(self, patch_left, patch_right):
overlap_cols = int(
(self.patch_w - self.strides_cols) / self.out_stride)
left, left_overlap = tf.split(
patch_left, [-1, overlap_cols], axis=1)
right_overlap, right = tf.split(
patch_right, [overlap_cols, -1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangle_warping(img1, img2, t1, t2, method):\n # Find bounding rectangle for each triangle\n x1, y1, w1, h1 = cv2.boundingRect(np.float32([t1]))\n x2, y2, w2, h2 = cv2.boundingRect(np.float32([t2]))\n\n # Offset points by left top corner of the respective rectangles\n t1Rect = []\n t2Rect = ... | [
"0.5839399",
"0.56645966",
"0.5576645",
"0.55055076",
"0.54985756",
"0.5352495",
"0.5347219",
"0.5321907",
"0.53168464",
"0.52837247",
"0.5255244",
"0.52419865",
"0.5184701",
"0.51840943",
"0.5146829",
"0.5138015",
"0.51220703",
"0.5109756",
"0.51003075",
"0.50811404",
"0.507... | 0.7099316 | 0 |
The output panel name, beginning with ``output.``. Generally, API methods specific to output panels will use `name`, while methods that work with any panels will use `full_name`. | def full_name(self):
return "output.%s" % self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._output_name",
"def _get_name(self):\n return '%s (%d)' % (\n self.panel_template.panel_name,\n self.implementation)",
"def output_name(self) -> str:\n return jsii.get(self, \"outputName\")",
"def outputname(self, identifier):\n ... | [
"0.75580347",
"0.75517553",
"0.74340254",
"0.6840934",
"0.67454123",
"0.6626438",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
"0.65341705",
... | 0.7944014 | 0 |
Hides the output panel. | def hide(self):
self.window.run_command("hide_panel", {"panel": self.full_name}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide(self):\n self.visible = False",
"def hide(self):\n self.set_visible(False)",
"def hideDisplay(self):\n if self._displayPjt:\n self._displayPjt.hide()\n if self._displayUsr:\n self._displayUsr.hide()\n if self._displayVtk:\n self._disp... | [
"0.77253985",
"0.7568135",
"0.75639385",
"0.7437855",
"0.7415186",
"0.73480654",
"0.7337557",
"0.730565",
"0.72141254",
"0.7149685",
"0.7100635",
"0.7100635",
"0.70720184",
"0.7071647",
"0.7006422",
"0.7006422",
"0.69301534",
"0.68798286",
"0.6822775",
"0.6804328",
"0.6803036... | 0.8176615 | 0 |
Resnet v250 Assumes input is [batch, height_in, width_in, channels]!! | def Encoder_resnet(x, depth = None, is_training=True, weight_decay=0.001, reuse=False):
from tensorflow.contrib.slim.python.slim.nets import resnet_v2
with tf.name_scope("Encoder_resnet", [x, depth]):
with slim.arg_scope(
resnet_v2.resnet_arg_scope(weight_decay=weight_decay)):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet_v1(input_shape, depth, num_classes=10,input_tensor=None):\n if (depth - 2) % 6 != 0:\n raise ValueError('depth should be 6n+2 (eg 20, 32, 44 in [a])')\n # Start model definition.\n num_filters = 16\n num_res_blocks = int((depth - 2) / 6)\n\n if (input_tensor == None):\n inpu... | [
"0.65341675",
"0.6463447",
"0.6455948",
"0.6385356",
"0.6378919",
"0.6370182",
"0.6361361",
"0.6321603",
"0.6311166",
"0.62564576",
"0.625597",
"0.6239913",
"0.62225187",
"0.6207582",
"0.61995345",
"0.6185751",
"0.6184242",
"0.61777693",
"0.6152648",
"0.61354476",
"0.6125433"... | 0.5758886 | 79 |
Resnet v250 Assumes input is [batch, height_in, width_in, channels]!! | def Encoder_resnet_v2(x, depth = None, is_training=True, weight_decay=0.001, reuse=False, name = 'Encoder_resnet_v2'):
from tensorflow.contrib.slim.python.slim.nets import resnet_v2
with tf.variable_scope(name, reuse=reuse) as scope:
#with tf.name_scope("Encoder_resnet", [x, depth]):
# Defines the d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet_v1(input_shape, depth, num_classes=10,input_tensor=None):\n if (depth - 2) % 6 != 0:\n raise ValueError('depth should be 6n+2 (eg 20, 32, 44 in [a])')\n # Start model definition.\n num_filters = 16\n num_res_blocks = int((depth - 2) / 6)\n\n if (input_tensor == None):\n inpu... | [
"0.6533067",
"0.64626646",
"0.6454749",
"0.63841057",
"0.6377438",
"0.6369209",
"0.6360234",
"0.63208926",
"0.63096803",
"0.6255967",
"0.6254889",
"0.6238891",
"0.62211806",
"0.620663",
"0.61974627",
"0.6185853",
"0.61820984",
"0.61763537",
"0.61514175",
"0.61342186",
"0.6123... | 0.5739538 | 88 |
Get 1st derivative of shape function (Bmatrix) in global coordinates | def get_Bmatrix(
self, etype: str, *, elm: int, nds: list = None
) -> Tuple[np.ndarray, np.ndarray]:
if etype == "area":
cod = self._coords[:, np.array(self._connectivity[elm])[nds]][: self._n_dof]
else:
cod = self._coords[:, self._connectivity[elm]][: self._n_dof]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(self, *args):\n if self.i_dim == 0:\n return np.ones_like(*args[0])\n else:\n return np.zeros_like(*args[0])",
"def dgdy(self, X):\n \n return 3*X[1]**2",
"def eval_Dxy(self):\n\n return self.Xf - self.Yf",
"def derivatives(x_p, y_p):\r\... | [
"0.63705623",
"0.63577485",
"0.6329693",
"0.6323323",
"0.6255258",
"0.6253042",
"0.6217805",
"0.61191964",
"0.6070338",
"0.6056527",
"0.6049655",
"0.5947408",
"0.59276766",
"0.59020436",
"0.5892184",
"0.58756745",
"0.58727753",
"0.5870947",
"0.5848037",
"0.58409506",
"0.58381... | 0.0 | -1 |
Get 1st derivative of shape function (Bmatrix) in global coordinates | def get_wdetJ(self, etype: str, *, elm: int, nds: list = None) -> np.ndarray:
if etype == "area":
cod = self._coords[:, np.array(self._connectivity[elm])[nds]][: self._n_dof]
else:
cod = self._coords[:, self._connectivity[elm]][: self._n_dof]
return self._shapef[self._el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(self, *args):\n if self.i_dim == 0:\n return np.ones_like(*args[0])\n else:\n return np.zeros_like(*args[0])",
"def dgdy(self, X):\n \n return 3*X[1]**2",
"def eval_Dxy(self):\n\n return self.Xf - self.Yf",
"def derivatives(x_p, y_p):\r\... | [
"0.6367847",
"0.6356957",
"0.63291055",
"0.6321411",
"0.6253899",
"0.62502164",
"0.62163144",
"0.6117512",
"0.60710317",
"0.60532486",
"0.6047797",
"0.59458286",
"0.59256405",
"0.5899265",
"0.5891074",
"0.58739454",
"0.5870604",
"0.58699936",
"0.58466184",
"0.5842252",
"0.584... | 0.0 | -1 |
Initialize the paddle with the specified geometry | def __init__(self, left, top, width, height):
self.left = left
self.top = top
self.width = width
self.height = height | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, x, y):\r\n super(paddle, self).__init__(image=paddle.paddle2, x=x, y=y)\r\n self.points=games.Text(value=0, size=50, color=color.white, top=5, right=games.screen.width-5)\r\n games.screen.add(self.points)",
"def __init__(self):\n self.center = Point()\n #x co... | [
"0.64071244",
"0.62822574",
"0.628143",
"0.60530794",
"0.6026822",
"0.59846056",
"0.5930751",
"0.5787879",
"0.5736638",
"0.57215744",
"0.57202053",
"0.5710384",
"0.5694874",
"0.5600134",
"0.55815196",
"0.553639",
"0.54929966",
"0.5474628",
"0.5460995",
"0.54493225",
"0.544734... | 0.0 | -1 |
Saves parameters to json file | def save(self, json_path):
with open(json_path, 'w') as f:
json.dump(self.__dict__, f, indent = 4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_json(self, path=None):\n if path is None:\n path = self.parampath\n\n params = {str(key): str(value) for key, value in self.__dict__.items()}\n # with open(f'{path}/params_{self.mode}.json', 'w') as f:\n with open(os.path.join(path, f'params_{self.mode}.json'), 'w') ... | [
"0.82312053",
"0.8181947",
"0.8057166",
"0.7808885",
"0.77812463",
"0.775106",
"0.7710382",
"0.7706769",
"0.76148814",
"0.75990826",
"0.7574917",
"0.75643057",
"0.7448175",
"0.7373087",
"0.7341731",
"0.7261098",
"0.719621",
"0.7154501",
"0.714766",
"0.7143015",
"0.71297264",
... | 0.6737431 | 53 |
Saves dict of floats in json file | def save_dict_to_json(self, json_path):
with open(json_path, 'w') as f:
# We need to convert the values to float for json (it doesn't accept np.array, np.float, )
d = {k: str(v) for k, v in self.params.dict.items()}
json.dump(d, f, indent = 4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_dict_to_json(d, json_path):\n with open(json_path, 'w') as f:\n # We need to convert the values to float for json (it doesn't accept np.array, np.float, )\n d = {k: float(v) for k, v in d.items()}\n json.dump(d, f, indent=4)",
"def save_dict_to_json(d, json_path):\n with open(... | [
"0.7564427",
"0.7564427",
"0.7253514",
"0.66701454",
"0.6560754",
"0.6480877",
"0.6427515",
"0.6369411",
"0.63336366",
"0.6319974",
"0.6308703",
"0.6225421",
"0.6213522",
"0.6200796",
"0.6162612",
"0.61495394",
"0.61287934",
"0.61068016",
"0.60562956",
"0.604909",
"0.60381424... | 0.721246 | 3 |
Learning Rate Schedule Learning rate is scheduled to be reduced after 80, 120, 160, 180 epochs. Called automatically every epoch as part of callbacks during training. Arguments | def lr_schedule(self, epoch):
lr = self.params.learning_rate
if epoch > int(self.params.num_epochs * 0.8):
lr *= 1e-3
elif epoch > int(self.params.num_epochs * 0.6):
lr *= 1e-2
elif epoch > int(self.params.num_epochs * 0.4):
lr *= 1e-1
print('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rnn_learning_rate_schedule(dataset):\n model, prefix = make_rnn(non_negative=True)\n # model.set_params(**{prefix + \"val\": 0.1})\n\n # base = no schedule\n print(\"Baseline RNN\")\n # model.set_params(**{prefix + \"history_file\": \"nn_default.csv\"})\n cross_validate(dataset, model)\n #... | [
"0.7523181",
"0.74990106",
"0.74865466",
"0.7482528",
"0.7470522",
"0.7470522",
"0.7470522",
"0.7470522",
"0.74078107",
"0.73543453",
"0.7348822",
"0.73360956",
"0.7268244",
"0.7265413",
"0.7228878",
"0.7224437",
"0.7197694",
"0.719144",
"0.71001893",
"0.7086968",
"0.70789975... | 0.7366162 | 9 |
Extract the 5day 3hour forecast for the provided City. | def pull_forecast(city, api_key):
base_url = "http://api.openweathermap.org/data/2.5/forecast?"
url = base_url + "appid=" + api_key + "&q=" + city
r = requests.get(url)
r.raise_for_status()
data = r.json()
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n #Load data for city\n print(\"\\nCity Data..\")\n df = pd.read_csv(CITY_DATA[city])\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n df['month'] = df['Start Time'].dt.month\n df['day_week'] = df['Start Time'].dt.day_name()\n df['hour'] = df['Start Time... | [
"0.60069734",
"0.6000779",
"0.596847",
"0.5942733",
"0.5914157",
"0.5891544",
"0.58722216",
"0.58638215",
"0.5838303",
"0.5817256",
"0.5810593",
"0.58050317",
"0.5796864",
"0.5792918",
"0.5790532",
"0.5785499",
"0.5775069",
"0.5774929",
"0.5773122",
"0.5772635",
"0.5769515",
... | 0.5924106 | 4 |
Computes the precision for the specified values of k | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0, keepdim=Tru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\... | [
"0.76427615",
"0.74189496",
"0.7418079",
"0.72710466",
"0.72456723",
"0.72446615",
"0.7237539",
"0.72213703",
"0.7210107",
"0.7058935",
"0.6852219",
"0.6786084",
"0.67836976",
"0.6768417",
"0.67273885",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.... | 0.0 | -1 |
Initialize/reset all optimization related variables. This method initializes correction factors to identity and resets history of the optimization. | def reset(self):
s = self
s.step_counter = 0
# TODO: initialize first layer activations here, and not everywhere else
# self.model.initialize_local_vars()
# self.model.initialize_global_vars()
ops = []
for var in self.model.trainable_vars:
if self.needs_correction(var... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.reset_image_estimate()\n self.init_m_aux()\n self.reset_hessian_and_bias()\n self.reset_adadelta_variables()",
"def resetParams(self):\n self.prediction = cons.init_pred # Classifier payoff - initialized to a constant initial payoff value\n sel... | [
"0.6920202",
"0.66721946",
"0.64612997",
"0.6431148",
"0.640165",
"0.63812256",
"0.63766646",
"0.63586855",
"0.6343203",
"0.63043207",
"0.63029104",
"0.628375",
"0.62772477",
"0.6264784",
"0.6249498",
"0.62140375",
"0.61908585",
"0.61620176",
"0.6147041",
"0.6145196",
"0.6139... | 0.6704145 | 1 |
Yield the bonds in the batch. | def get_bonds(self) -> Iterable[Bond]:
yield from self._bonds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_bonds(self):\n for bond in self.bond_list:\n yield bond",
"def get_bonds(self):\n\n yield from self._molecule_state.get_bonds()",
"def iter_bonds(self):\n visited = {}\n for atm in self.iter_atoms():\n for bond in atm.iter_bonds():\n if ... | [
"0.7943251",
"0.7452321",
"0.7133443",
"0.7133443",
"0.7133443",
"0.7097584",
"0.66456985",
"0.631133",
"0.61824894",
"0.61297166",
"0.6066924",
"0.5932639",
"0.5841496",
"0.58220917",
"0.5796081",
"0.57958835",
"0.579542",
"0.57850516",
"0.5744912",
"0.5725474",
"0.5718149",... | 0.7672025 | 1 |
Get bounding box coordinate information. | def get_bounding_box(img):
rows = np.any(img, axis=1)
cols = np.any(img, axis=0)
rmin, rmax = np.where(rows)[0][[0, -1]]
cmin, cmax = np.where(cols)[0][[0, -1]]
# due to python indexing, need to add 1 to max
# else accessing will be 1px in the box, not out
rmax += 1
cmax += 1
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bounding_box(self):\n lon, lat = self.coordinates\n\n ll = (np.min(lon),np.min(lat))\n ul = (np.min(lon),np.max(lat))\n ur = (np.max(lon),np.max(lat))\n lr = (np.max(lon),np.min(lat))\n\n return (ll, ul, ur, lr)",
"def boundingBox(self):\n y_max = np.max(s... | [
"0.7826119",
"0.76943433",
"0.7685138",
"0.76418823",
"0.76372904",
"0.7635961",
"0.7628765",
"0.76077354",
"0.75890565",
"0.75890565",
"0.7586321",
"0.7468325",
"0.7428931",
"0.7417812",
"0.7417812",
"0.7393874",
"0.7384683",
"0.7378131",
"0.73564994",
"0.73172516",
"0.72425... | 0.0 | -1 |
Compute the softmax in a numerically stable way. | def my_softmax(x):
x = x - np.max(x)
exp_x = np.exp(x)
softmax_x = exp_x / np.sum(exp_x)
return softmax_x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\n pass # TODO: Compute and return softmax(x)\n\n exp_x = np.exp(x)\n sum_x = np.sum(exp_x, axis=0)\n softmax = exp_x/sum_x\n \n return softmax",
"def softmax(x):\n #pass # TODO: Compute and return softmax(x)\n return np.exp(x) / np.sum(np.exp(x), axis=0)",
"def softmax(x)... | [
"0.8550425",
"0.8457038",
"0.84488344",
"0.84132797",
"0.83853513",
"0.8353569",
"0.835235",
"0.83453566",
"0.83386815",
"0.8329015",
"0.83232",
"0.83217776",
"0.83217776",
"0.8318111",
"0.8318111",
"0.8318111",
"0.8318111",
"0.82981586",
"0.8296965",
"0.8296965",
"0.8296965"... | 0.8206516 | 64 |
Return pdf of the multivariate normal distribution at a point x | def pdf(self, x):
if type(x) is not np.ndarray:
raise TypeError("x must be a numpy.ndarray")
if ((len(x.shape) != 2 or x.shape[1] != 1
or x.shape[0] != self.mean.shape[0])):
raise ValueError("x must have the shape ({}, 1)"
.format(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pdf(x, mu, std):\n if std == 0:\n return 0\n return (1.0 / (std * sqrt(2 * pi))) * np.exp(-(x - mu) ** 2 / (2 * std ** 2))",
"def norm_pdf(x, mu, sigma):\n\n prefac = 1 / (sigma * math.sqrt(2 * math.pi))\n expt = np.exp(-(x - mu)**2 / (2 * sigma**2))\n\n return prefac * expt",
"def no... | [
"0.7994099",
"0.7923467",
"0.7800269",
"0.77726316",
"0.7729975",
"0.7724094",
"0.7671156",
"0.7664487",
"0.76360565",
"0.76360565",
"0.759209",
"0.7573027",
"0.75457025",
"0.7486424",
"0.7402956",
"0.7358192",
"0.7335815",
"0.7312965",
"0.7284434",
"0.7243327",
"0.72275126",... | 0.7689972 | 6 |
Tests that the user is redirected to the home page. | def test_redirection(self):
self.assertRedirects(self.response, self.home_url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_home_page_redirect_when_loggin_attempt_successful(self):\n\t\tpass",
"def test_home_page(self):\r\n url = reverse('home')\r\n response = self.client.get(url)\r\n\r\n self.assertEqual(response.status_code, 200)",
"def test_home(self):\n\t\tresponse = self.client.get('/')\n\t\tself.... | [
"0.84217453",
"0.7769299",
"0.76420814",
"0.7638164",
"0.76040894",
"0.759174",
"0.758025",
"0.7538141",
"0.7536092",
"0.74214154",
"0.74214154",
"0.7371821",
"0.7367941",
"0.7366777",
"0.7333203",
"0.72763914",
"0.72220784",
"0.71568996",
"0.71443254",
"0.71340394",
"0.71012... | 0.7805177 | 1 |
This function splits a text into sentences. | def split_text_into_sentences(text: str, language: str='es') -> List[str]:
if not language in ACCEPTED_LANGUAGES[language]:
raise ValueError(f'Language {language} is not supported yet')
nlp = spacy.load(language, disable=['tagger', 'parser', 'ner'])
nlp.add_pipe(nlp.create_pipe('sentencizer'))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentence_split(self, text):\n return split_into_sentences(text)",
"def split_sentences(text):\n # sentence_delimiters = re.compile(r'(?<!\\w\\.\\w.)(?<![A-Z][a-z]\\.)(?<=\\.|\\?)\\s')\n # sentences = sentence_delimiters.split(text)\n sentences = nltk.sent_tokenize(text)\n return sentences"... | [
"0.8672343",
"0.85861427",
"0.8472792",
"0.84667826",
"0.8257693",
"0.81614894",
"0.7940572",
"0.7914254",
"0.7831395",
"0.7710162",
"0.7662661",
"0.76290506",
"0.7622077",
"0.7622077",
"0.75612384",
"0.7471516",
"0.74060327",
"0.7382098",
"0.73585206",
"0.73516166",
"0.73237... | 0.74611187 | 16 |
This function splits a text into sentences. | def split_doc_into_sentences(doc: Doc) -> List[Span]:
return [s
for s in doc.sents
if len(s.text.strip()) > 0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentence_split(self, text):\n return split_into_sentences(text)",
"def split_sentences(text):\n # sentence_delimiters = re.compile(r'(?<!\\w\\.\\w.)(?<![A-Z][a-z]\\.)(?<=\\.|\\?)\\s')\n # sentences = sentence_delimiters.split(text)\n sentences = nltk.sent_tokenize(text)\n return sentences"... | [
"0.8672311",
"0.85856885",
"0.8473692",
"0.84668624",
"0.82568705",
"0.81610686",
"0.7940494",
"0.791481",
"0.78306633",
"0.77087206",
"0.76636416",
"0.7629145",
"0.7621852",
"0.7621852",
"0.75620395",
"0.74730825",
"0.74618554",
"0.74090004",
"0.7385066",
"0.73591983",
"0.73... | 0.0 | -1 |
Method to clean black dots and set to 808080 | def decoding_the_captcha(captcha, l1=7):
im = Image.open(captcha)
im = im.convert("RGB")
p1 = im.load()
# Filtering the black dots
for x in range(im.size[0]):
for y in range(im.size[1]):
if (p1[x, y][0] < l1) and (p1[x, y][1] < l1) \
and (p1[x, y][2] < l1):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_urls(self, text: str) -> str:\n pattern = r\"http\\S+\"\n return re.sub(pattern, \" \", str(text))",
"def cleanmatomo_url(self):\n self.matomo_url = re.sub(r\"/\\/$/\", \"\", self.matomo_url) # Cuts \"/\"\n\n if re.match(r\"^http://\", self.matomo_url): # replace it to \... | [
"0.59661394",
"0.58218926",
"0.5761587",
"0.5714812",
"0.5661295",
"0.565335",
"0.5636224",
"0.56039876",
"0.55440944",
"0.5527531",
"0.55191916",
"0.54607946",
"0.5456812",
"0.5454855",
"0.54479426",
"0.54219395",
"0.54095036",
"0.53533024",
"0.53326285",
"0.53257805",
"0.52... | 0.0 | -1 |
r"""Standardize features by removing the mean and scaling to unit variance. | def normalize(feats, train_nid, dtype=np.float32):
train_feats = feats[train_nid]
scaler = preprocessing.StandardScaler()
scaler.fit(train_feats)
feats = scaler.transform(feats)
return feats.astype(dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standardiser(self):\n # Select only numeric features first\n\n #self.X = self.data.loc[:, self.data.columns != self.target].values\n numeric_columns = []\n for col in self.X.columns:\n if self.X[col].dtype!='object':\n numeric_columns.append(col)\n s... | [
"0.7807891",
"0.7597977",
"0.75549036",
"0.74405175",
"0.74150527",
"0.7391262",
"0.73537886",
"0.7308655",
"0.7305091",
"0.72536564",
"0.7250654",
"0.7210351",
"0.71905535",
"0.71505314",
"0.713604",
"0.71302843",
"0.71074224",
"0.70464814",
"0.70461905",
"0.7046183",
"0.702... | 0.0 | -1 |
Sets the seed for this env's random number generator(s). | def seed (self, seed=None):
self.np_random, seed = seeding.np_random(seed)
return [seed] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_seed(cls, seed: Any) -> None:\n cls.rand = Random(seed)",
"def set_seed(self, seed: int):\n self.__sim.seed(seed)",
"def set_seed(self, seed):\n self.seed = seed",
"def seed(self, seed=None):\n if seed is not None:\n self._rng.seed(seed)",
"def set_random_seed... | [
"0.837315",
"0.8116574",
"0.80862194",
"0.8081547",
"0.80698186",
"0.80698186",
"0.8035685",
"0.79711807",
"0.7949761",
"0.79067385",
"0.79045385",
"0.78622633",
"0.7830874",
"0.78281605",
"0.78175986",
"0.77908194",
"0.7770842",
"0.7770138",
"0.77453065",
"0.7741128",
"0.772... | 0.758876 | 30 |
The end date of the current term | def end_date(self) -> Optional[str]:
return pulumi.get(self, "end_date") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_date(self) -> str:\n return pulumi.get(self, \"end_date\")",
"def end_date(self) -> str:\n return pulumi.get(self, \"end_date\")",
"def end_date(self):\n return self.__end_date",
"def end_date(self):\n return self._end_date",
"def end_date(self):\n return self._en... | [
"0.8016982",
"0.8016982",
"0.79294646",
"0.78057766",
"0.78057766",
"0.78057766",
"0.7764251",
"0.7568661",
"0.75136626",
"0.73069984",
"0.7293585",
"0.70146596",
"0.6945339",
"0.69356525",
"0.6815827",
"0.67398614",
"0.67398614",
"0.6672662",
"0.66457826",
"0.6624636",
"0.66... | 0.7626937 | 8 |
The start date of the current term | def start_date(self) -> Optional[str]:
return pulumi.get(self, "start_date") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_start_date(self):\n return \"%d%02d\" % (self.year, self.term)",
"def start_date(self) -> str:\n return pulumi.get(self, \"start_date\")",
"def start_date(self) -> str:\n return pulumi.get(self, \"start_date\")",
"def start_date(self):\n return self.__start_date",
"def s... | [
"0.8313013",
"0.77163315",
"0.77163315",
"0.7669511",
"0.7624826",
"0.75638956",
"0.75638956",
"0.75638956",
"0.75638956",
"0.7483072",
"0.7297139",
"0.7262415",
"0.716523",
"0.7146404",
"0.7104689",
"0.70259964",
"0.6978446",
"0.696415",
"0.6856978",
"0.6804855",
"0.6799373"... | 0.72893286 | 12 |
The unit indicating Monthly / Yearly | def term_unit(self) -> Optional[str]:
return pulumi.get(self, "term_unit") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unit_mo(self):\n return (((self.time_base * 60.0) * 24.0) * 365.0) / 12",
"def unit_mo(self):\n return (((self.time_base * 60.0) * 24.0) * 365.0) / 12",
"def _unit_yr(self):\n return ((self.time_base * 60.0) * 24.0) * 365.0",
"def _unit_day(self):\n return (self.time_base * 6... | [
"0.76864266",
"0.75879943",
"0.6720808",
"0.6638905",
"0.6562602",
"0.6562602",
"0.65231407",
"0.64992774",
"0.64830637",
"0.6470921",
"0.6422167",
"0.63863474",
"0.63855857",
"0.6282617",
"0.6263456",
"0.62479097",
"0.61852545",
"0.61839813",
"0.61303926",
"0.61143076",
"0.6... | 0.0 | -1 |
The created date of this resource. | def created(self) -> str:
return pulumi.get(self, "created") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_date(self):\n return self._created_date",
"def created_date(self):\n return self._created_date",
"def date_created(self):\n return self._date_created",
"def date_created(self):\n return self._date_created",
"def date_created(self):\n return self._date_created"... | [
"0.8752678",
"0.8752678",
"0.8514051",
"0.8514051",
"0.8514051",
"0.84255594",
"0.83635926",
"0.83635926",
"0.83635926",
"0.8300944",
"0.8245852",
"0.82184666",
"0.8198086",
"0.813445",
"0.8043646",
"0.8043646",
"0.79941124",
"0.7802316",
"0.7742131",
"0.77390605",
"0.7710792... | 0.7867446 | 19 |
Whether the SaaS subscription will auto renew upon term end. | def auto_renew(self) -> Optional[bool]:
return pulumi.get(self, "auto_renew") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_renew(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"auto_renew\")",
"def auto_renew(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"auto_renew\")",
"def auto_renew(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"auto_rene... | [
"0.7635799",
"0.7555081",
"0.7555081",
"0.7060618",
"0.66018945",
"0.63008267",
"0.6166622",
"0.6105066",
"0.6095437",
"0.60400766",
"0.6024941",
"0.60069394",
"0.59538114",
"0.5946263",
"0.5913129",
"0.59094524",
"0.590431",
"0.5873234",
"0.5791154",
"0.5784895",
"0.5782406"... | 0.79429305 | 1 |
The Payment channel for the SaasSubscription. | def payment_channel_type(self) -> Optional[str]:
return pulumi.get(self, "payment_channel_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channel(self):\n return Channel({'id': self.channel_id, 'connection': self.connection})",
"def getChannel(self):\r\n return self.channel",
"def channel(self) -> 'Channel': # stub\n return self._channel",
"def channel(self):\n return self._channel",
"def channel(self):\n ... | [
"0.64235836",
"0.6375752",
"0.63539016",
"0.6338129",
"0.6338129",
"0.6270923",
"0.62647957",
"0.6255194",
"0.61652064",
"0.6117484",
"0.5970928",
"0.5964751",
"0.59157217",
"0.58987176",
"0.58987176",
"0.58987176",
"0.5872529",
"0.5872529",
"0.5872529",
"0.5861939",
"0.58208... | 0.6670644 | 1 |
The SaaS resource name. | def saas_resource_name(self) -> Optional[str]:
return pulumi.get(self, "saas_resource_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_name(self):\n return self._resource_name",
"def resource_name(self) -> Optional[str]:\n return pulumi.get(self, \"resource_name\")",
"def resource_name(self) -> Optional[str]:\n return pulumi.get(self, \"resource_name\")",
"def name(self):\n return self.raw_resour... | [
"0.75283563",
"0.742396",
"0.742396",
"0.7398112",
"0.7182074",
"0.7104791",
"0.7104791",
"0.7104791",
"0.7104791",
"0.7104791",
"0.70863575",
"0.69936925",
"0.69936925",
"0.6841932",
"0.6746869",
"0.6736587",
"0.6699765",
"0.6691915",
"0.6676494",
"0.66206276",
"0.66170204",... | 0.8277715 | 0 |
The current Term id. | def term_id(self) -> Optional[str]:
return pulumi.get(self, "term_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id(self, term):\n term = term.lower() if self.lower else term\n try:\n return self.term2id[term]\n except KeyError:\n return self.term2id[self.unk_term]",
"def get_term_id(self, term):\n query = self.db.execute('SELECT rowid FROM terms WHERE term = ?;', (... | [
"0.695331",
"0.6933238",
"0.6902128",
"0.6885298",
"0.6561754",
"0.6549523",
"0.6519543",
"0.64798254",
"0.64798254",
"0.64798254",
"0.64798254",
"0.64798254",
"0.64798254",
"0.64798254",
"0.64798254",
"0.64798254",
"0.64798254",
"0.64798254",
"0.64798254",
"0.64798254",
"0.6... | 0.7920032 | 0 |
Create instance of sqlalchemy.engine.Engine. URL should be a string that indicates database dialect and connection arguments. | def __init__(self, url):
try:
self.engine = sqlalchemy.create_engine(url)
except Exception as e:
raise RuntimeError(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(self, url=None):\n\n # If no URL was provided then create one through `self.create_url`.\n if not url:\n url = self.create_url()\n\n # Create the engine.\n engine = sqlalchemy.create_engine(\n url,\n pool_size=self.sql_engine_pool_size,\n ... | [
"0.81839484",
"0.81197804",
"0.8006621",
"0.79811877",
"0.74319786",
"0.7261863",
"0.7229383",
"0.71871376",
"0.71557087",
"0.7149246",
"0.7106051",
"0.70689964",
"0.7022129",
"0.69169366",
"0.6916641",
"0.687477",
"0.687477",
"0.687477",
"0.687477",
"0.687477",
"0.6861764",
... | 0.73803365 | 5 |
Test to validates ``mimeType`` is replaced by ``mediaType`` for all descriptions. Also we validate that processes that use ``mimeType`` or ``mediaType`` can be deployed successfully. | def test_mediatype_io_format_references(self):
ns_json, type_json = get_cwl_file_format(CONTENT_TYPE_APP_JSON)
namespaces = dict(list(ns_json.items()))
body = {
"processDescription": {
"process": {
"id": self._testMethodName,
"t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_media(self):\n manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST)\n manifest['job']['interface']['inputs']['files'][0]['mediaTypes'] = []\n config = copy.deepcopy(self.configuration)\n json_data = {\n 'manifest': manifest,\n 'configuration': ... | [
"0.6418336",
"0.57625765",
"0.53959703",
"0.53888893",
"0.5337691",
"0.52999",
"0.5279323",
"0.5244089",
"0.51923144",
"0.51400024",
"0.5133637",
"0.51287067",
"0.5109834",
"0.51068723",
"0.50749046",
"0.5027425",
"0.49983624",
"0.49710092",
"0.49595988",
"0.49017262",
"0.489... | 0.5752137 | 2 |
Test verifies that ``minOccurs`` and/or ``maxOccurs`` definitions other than allowed formats are raised as invalid schemas. | def test_invalid_io_min_max_occurs_wrong_format(self):
cwl = {
"cwlVersion": "v1.0",
"class": "CommandLineTool",
"inputs": [{}], # updated after
"outputs": {"values": {"type": "string"}}
}
body = {
"processDescription": {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_supported_schemas(self):\n supported_schemas = modelprop.get_supported_schemas()\n\n assumed_schemas = [\n \"HAZUS_v1.0\",\n \"SARA_v1.0\",\n \"SUPPASRI2013_v2.0\",\n \"Mavrouli_et_al_2014\",\n \"Torres_Corredor_et_al_2017\",\n ... | [
"0.6614721",
"0.6577441",
"0.6567425",
"0.6553559",
"0.64648145",
"0.64188457",
"0.641412",
"0.63875085",
"0.6359459",
"0.63483405",
"0.6324148",
"0.6290119",
"0.6287649",
"0.628245",
"0.6272029",
"0.6266671",
"0.62480336",
"0.62457275",
"0.6243545",
"0.62339765",
"0.62214714... | 0.6609925 | 1 |
Filter posts by tag, return 404 if no post is found. | def get_queryset(self):
return Post.objects.filter(
user_id=self.kwargs['user_id'], status='published', visibility='public'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_posts_tag(url_tag):\n return Posts.objects.filter(tags__tag=url_tag)",
"def _filter_posts(posts):\n\n return filter(_filter_post, posts)",
"def filter_queryset(self, queryset):\n tags = self.request.GET.getlist(\"tag\")\n if tags:\n for tag in tags:\n query... | [
"0.6856305",
"0.64649606",
"0.6225477",
"0.601161",
"0.5983079",
"0.5930495",
"0.59113294",
"0.58109844",
"0.5793466",
"0.57592404",
"0.56951296",
"0.5690261",
"0.5667304",
"0.565259",
"0.55932647",
"0.55529505",
"0.55511284",
"0.5488095",
"0.542649",
"0.5378492",
"0.5346248"... | 0.0 | -1 |
Test whether the underlying data is bytewiseequal. >>> a = numpy.arange(16); b = a.copy() >>> ak = NumKeyLite(a); bk = NumKeyLite(b) >>> ak == bk True >>> ak != bk False >>> bk = NumKeyLite(b + 0.1) >>> ak == bk False >>> b = a.reshape(4, 1).copy(); bk = NumKeyLite(b) >>> ak == bk False >>> ak != bk True | def __eq__(self, other):
# NOTE: This is debatable.
# NOTE: Hopefully, the hash function should behave so well that
# collisions are rare, therefore making it rare that the expensive
# equality comparison is called.
try:
# numpy.all() works on zero-dimensional arrays.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allequal(a, b, flavor=\"numpy\"):\n\n # print(\"a-->\", repr(a))\n # print(\"b-->\", repr(b))\n if not hasattr(b, \"shape\"):\n # Scalar case\n return a == b\n\n if ((not hasattr(a, \"shape\") or a.shape == ()) and\n (not hasattr(b, \"shape\") or b.shape == ())):\n r... | [
"0.6826737",
"0.68032116",
"0.67569584",
"0.6716373",
"0.66690123",
"0.6648836",
"0.66395783",
"0.65901333",
"0.65335965",
"0.6531204",
"0.64945734",
"0.6479077",
"0.6456584",
"0.6451906",
"0.64480895",
"0.6436678",
"0.6390705",
"0.63904655",
"0.6376124",
"0.63293356",
"0.628... | 0.5957682 | 71 |
Sets the token_unique_reference of this TokenizeResponseSchema. | def token_unique_reference(self, token_unique_reference):
self._token_unique_reference = token_unique_reference | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_reference(self, unique_reference):\n\n self._unique_reference = unique_reference",
"def pan_unique_reference(self, pan_unique_reference):\n\n self._pan_unique_reference = pan_unique_reference",
"def token_uri(self, token_uri):\n\n self._token_uri = token_uri",
"def token(self,... | [
"0.66069114",
"0.54265714",
"0.52031356",
"0.51464486",
"0.51464486",
"0.5061283",
"0.50280356",
"0.49233103",
"0.48930898",
"0.48925546",
"0.48611587",
"0.48317307",
"0.47713757",
"0.47481495",
"0.4733137",
"0.47289088",
"0.47012594",
"0.46930283",
"0.46761343",
"0.46750033",
... | 0.82809067 | 0 |
Sets the token_detail of this TokenizeResponseSchema. | def token_detail(self, token_detail):
self._token_detail = token_detail | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_info(self, token_info):\n\n self._token_info = token_info",
"def set_token(self, token):\n # type: (Token) -> None\n self.token = token\n self._token_header = \"Bearer \" + token[\"access_token\"]",
"def error_detail(self, error_detail):\n\n self._error_detail = err... | [
"0.63697726",
"0.5925274",
"0.5838624",
"0.5797187",
"0.5791003",
"0.5791003",
"0.5643845",
"0.56285834",
"0.55679846",
"0.55679846",
"0.55679846",
"0.55239844",
"0.52082306",
"0.51737744",
"0.5173633",
"0.5173558",
"0.5164342",
"0.5164342",
"0.5126371",
"0.5104957",
"0.50998... | 0.8307674 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, TokenizeResponseSchema):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, TokenizeResponseSchema):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Sets the speed of the left and right motors to the given speed. The speed should be in the range of [0, 255]. Sleeps for 0.1 seconds in between setting the left and right motor speeds. | def set_speed(speed):
if speed >255:
speed =255
elif speed <0:
speed =0
set_left_speed(speed)
#time.sleep(.1)
set_right_speed(speed) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self, speed=1):\n self.set_motor(self.left_motor, 'left', speed)\n self.set_motor(self.right_motor, 'right', speed)\n time.sleep(0.5)",
"def set_left_speed(speed):\n if speed >255:\n speed =255\n elif speed <0:\n speed =0\n return write_i2c_block(ADDRESS,set_l... | [
"0.78023344",
"0.7445923",
"0.7445923",
"0.73864216",
"0.72845906",
"0.726722",
"0.7251113",
"0.7161834",
"0.71615404",
"0.7146234",
"0.7146234",
"0.7104322",
"0.7103598",
"0.70458686",
"0.69860035",
"0.6962281",
"0.69477236",
"0.69449216",
"0.69364804",
"0.6886092",
"0.68427... | 0.8324373 | 0 |
Checks that we're consistently running at 60 ticks/s. | def test_tick_rate(self):
history = self.history
fps = 60 # I know it's not frames but I find it easier to read than tps.
def get_time(history_item):
return history_item.game_tick_proto.GameInfo().SecondsElapsed()
def is_admissible(history_item):
return history... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_clocks(self) -> int:\n pass",
"def must_run(self):\r\n self.current_time = datetime.now()\r\n return all([self._minute(), self._hour(), self._day_of_month(), self._month(), self._day_of_week()])",
"def trigger(self):\n if self.timer is None or time.time() - self.last_try >... | [
"0.6439625",
"0.6252726",
"0.6111706",
"0.6087357",
"0.6052535",
"0.60162747",
"0.60071677",
"0.6004329",
"0.5976713",
"0.59697694",
"0.59691685",
"0.5926805",
"0.59260744",
"0.592052",
"0.5848709",
"0.5847624",
"0.58312494",
"0.58304274",
"0.5811613",
"0.5803207",
"0.5800268... | 0.6675983 | 0 |
Tests that the api can be hit and that authorization works and that it can return one particular person who is likely to be with the company for some time | def test_api():
# person id for one long time employee
content = get_person(10050)
assert content['preferredName'].endswith('immel') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generic_test(self):\n api_params[params_to_api[\"org_id\"]] = str(self.org_id)\n valid_response = [\n entry for entry in self.valid_response\n if all(\n str(entry[k]).lower().find(str(api_params[k]).lower()) != -1\n for k in api_params\n ... | [
"0.65235025",
"0.6501353",
"0.6472427",
"0.64364195",
"0.6426616",
"0.64263946",
"0.6409696",
"0.6380067",
"0.6376479",
"0.633538",
"0.63281476",
"0.62975615",
"0.6294384",
"0.6268598",
"0.6262227",
"0.62525415",
"0.6242194",
"0.6224487",
"0.6209244",
"0.61947787",
"0.6183047... | 0.6604673 | 0 |
``` Get current weight decay rate ``` | def get_weight_decay(self):
if type(self.model.optimizer).__name__ == "AdamWeightDecay":
return self.model.optimizer.weight_decay_rate
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight_decay(self):\n if self._weight_decay is not None:\n return self._weight_decay\n return 5e-5 if 'VG' in self.dataset else 5e-4",
"def decay(self):\n return self._decay",
"def _decay(self):\n wd_losses = tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)\n log.... | [
"0.7772663",
"0.7588543",
"0.7197065",
"0.70361257",
"0.6825383",
"0.6824575",
"0.67655575",
"0.67583513",
"0.67453355",
"0.6740679",
"0.6740679",
"0.6651961",
"0.6601236",
"0.65886915",
"0.6570518",
"0.6546319",
"0.65148735",
"0.6501756",
"0.64437497",
"0.6422064",
"0.639320... | 0.7858903 | 0 |
``` Sets global weight decay via AdamWeightDecay optimizer | def set_weight_decay(self, wd=U.DEFAULT_WD):
self._recompile(wd=wd)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weights_decay(self):\n for param_group in self.optimizer.param_groups:\n for param in param_group['params']:\n param.data = param.data.add(-1.*self.weights_decay * param_group['lr'], param.data)",
"def __init__(self,\n weight_decay,\n learning_rate... | [
"0.7529152",
"0.7424105",
"0.70994705",
"0.7070848",
"0.70599794",
"0.7018945",
"0.70012134",
"0.69909436",
"0.6972249",
"0.69699156",
"0.6891229",
"0.67930806",
"0.67761046",
"0.6766105",
"0.6699152",
"0.66976225",
"0.6680061",
"0.66540873",
"0.65958995",
"0.65872186",
"0.65... | 0.7015071 | 6 |
``` Reinitializes network with original weights ``` | def reset_weights(self, verbose=1):
if os.path.isfile(self._original_weights):
self.model.load_weights(self._original_weights)
self.history = None
U.vprint("Model weights have been reset.", verbose=verbose)
else:
warnings.warn(
"Weights ha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_weights(self):\n pass",
"def reset_nn(self): # Clear current network\n self.weights = np.zeros((p.num_rovers, self.n_weights))\n self.in_layer = np.zeros((p.num_rovers, self.n_inputs))\n self.hid_layer = np.zeros((p.num_rovers, self.n_nodes))\n self.out_layer =... | [
"0.7458227",
"0.7412517",
"0.73875344",
"0.73781663",
"0.7371596",
"0.7259882",
"0.7183528",
"0.7132337",
"0.712373",
"0.7110474",
"0.71094805",
"0.7104507",
"0.70966613",
"0.7035379",
"0.70156866",
"0.6962031",
"0.6941823",
"0.6907929",
"0.6880448",
"0.6868592",
"0.6859495",... | 0.0 | -1 |
Make converter that returns a truthy value or ``None``. ``converter`` is called to further convert non``None`` values. | def truthy_or_none(converter: Callable[[Any], T]) -> Callable[[Any], Optional[T]]:
return lambda value: converter(value) if value else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value_or_none(converter: Callable[[Any], T]) -> Callable[[Any], Optional[T]]:\n return lambda value: None if value is None else converter(value)",
"def convert(self, converter=None):\n if converter is not None:\n self.converter = converter\n self.code(self.prepare)",
"def conver... | [
"0.74117136",
"0.6217806",
"0.60996294",
"0.6047573",
"0.58413285",
"0.5426432",
"0.54246247",
"0.54015446",
"0.5386038",
"0.5373192",
"0.53192526",
"0.5307836",
"0.52500135",
"0.5246546",
"0.52267283",
"0.5171171",
"0.5150713",
"0.5147207",
"0.5136645",
"0.5133075",
"0.50921... | 0.8393245 | 0 |
Make converter that returns a string stripped of newlines or ``None``. ``converter`` is called to further convert non``None`` values. | def stripped_newlines(converter: Callable[[Any], T]) -> Callable[[Any], Optional[T]]:
return lambda value: converter(value.replace('\r', '').replace('\n', '')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_safe_str_or_none(value: Optional[str]) -> Optional[str]:\n if value is None:\n return None\n v = str(value.strip()).replace('\\r', '').replace('\\n', '')\n return v or None",
"def _coerce_str_unless_none(value):\n return str(value) if value is not None else None",
"def _nullify(self, ... | [
"0.57796806",
"0.5565792",
"0.5423951",
"0.51866627",
"0.5173151",
"0.5128336",
"0.51152",
"0.50806856",
"0.5063399",
"0.496225",
"0.4939525",
"0.49193722",
"0.4881577",
"0.48720887",
"0.4861825",
"0.48315695",
"0.48274344",
"0.48204777",
"0.4794638",
"0.4782126",
"0.47787866... | 0.79939085 | 0 |
Return the density of the mask's model. | def mask_density(mask):
return get_number_of_unpruned_weights(mask).float() / get_number_of_weights(mask).float() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(self):\n return self.nnz/self.dim",
"def density(self):\n return self.get_density()",
"def density( self ) :\n return self.__density",
"def density( self ) :\n return self.__density",
"def density( self ) :\n return self.__density",
"def density(self):\n ... | [
"0.7146775",
"0.7057674",
"0.6915033",
"0.6915033",
"0.6915033",
"0.68925333",
"0.6860638",
"0.68238187",
"0.6782899",
"0.6741262",
"0.67350525",
"0.6734582",
"0.66461",
"0.6584711",
"0.655791",
"0.654934",
"0.6408289",
"0.618068",
"0.6179919",
"0.61492056",
"0.6135738",
"0... | 0.8207859 | 0 |
The __init__ should be used to load all data into the object which is necessary for calculation of the logposterior probability which will be returned by the __call__ method. Typically this includes experimental measurements with their associated uncertainties, and any relevant physical constants. | def __init__(self, wavelength):
# store experimental data
self.x = wavelength
# Central wavelengths of the lines are known constants:
self.c1 = 422.
self.c2 = 428. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n \r\n self.shape_parameter = 0.0\r\n \"\"\"Shape parameter describes the skew of the Weibull distribution. \r\n If shape < 3.5, data skews left.\r\n If shape == 3.5, data is normal.\r\n If shape > 3.5, data skews right.\r\n \"\"\"\r\n \... | [
"0.704647",
"0.6935416",
"0.69181246",
"0.69077706",
"0.68912816",
"0.68874115",
"0.68645275",
"0.68167216",
"0.68167216",
"0.68167216",
"0.6805164",
"0.6799064",
"0.6790852",
"0.67805284",
"0.67520815",
"0.6751402",
"0.6740377",
"0.67364275",
"0.67152387",
"0.6713303",
"0.67... | 0.0 | -1 |
Generates examples for the dSprites data set. | def _generate_examples(self, filepath):
# Simultaneously iterating through the different data sets in the hdf5
# file is >100x slower and the data set is small (26.7MB). Hence, we first
# load everything into memory before yielding the samples.
with tfds.core.lazy_imports.h5py.File(filepath, "r") as h5d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_examples(self, data_dir_path):\n\n for class_name in tf.io.gfile.listdir(data_dir_path):\n class_dir_path = os.path.join(data_dir_path, class_name)\n for image_name in tf.io.gfile.listdir(class_dir_path):\n image = os.path.join(class_dir_path, image_name)\n yield image, {\n... | [
"0.6653823",
"0.6332842",
"0.62703526",
"0.62283355",
"0.59563273",
"0.5934799",
"0.59232813",
"0.5902306",
"0.5902306",
"0.5882513",
"0.58446765",
"0.58446765",
"0.58446765",
"0.58446765",
"0.58446765",
"0.583835",
"0.58275044",
"0.58089954",
"0.57928115",
"0.57856613",
"0.5... | 0.5801675 | 18 |
Compare this iDevice with other | def __cmp__(self, other):
return cmp(self.id, other.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other: Any) -> bool:\n if isinstance(other, Device):\n return self.device_type == other.device_type and self.device_id == other.device_id\n elif isinstance(other, torch.device):\n return self.device_type == other.type and self.device_id == other.index\n e... | [
"0.73767394",
"0.7251255",
"0.72493994",
"0.7232587",
"0.70750767",
"0.70426285",
"0.7021127",
"0.70188135",
"0.69482976",
"0.69293094",
"0.6920181",
"0.6907133",
"0.6903699",
"0.6796442",
"0.67254376",
"0.6682992",
"0.66745126",
"0.66745126",
"0.65955245",
"0.6589126",
"0.65... | 0.0 | -1 |
Computes the backward pass of an affine function. | def affine_backward(dout, x, w, b):
############################################################################
# TODO: Implement the affine backward pass. #
############################################################################
###############################################... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_backward(dout, cache):\n x, w, b = cache\n dx, dw, db = None, None, None\n ###########################################################################\n # TODO: Implement the affine backward pass. #\n ##########################################################... | [
"0.7472531",
"0.7303336",
"0.72739273",
"0.72518855",
"0.7249961",
"0.7240876",
"0.71885693",
"0.71885693",
"0.71885693",
"0.71885693",
"0.70969874",
"0.7090897",
"0.7083341",
"0.70574296",
"0.7027857",
"0.700729",
"0.70063347",
"0.699855",
"0.6964251",
"0.6934633",
"0.692569... | 0.7206497 | 6 |
Computes the forward pass for rectified linear units (ReLUs). | def relu_forward(x):
############################################################################
# TODO: Implement the ReLU forward pass. #
############################################################################
###############################################################... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_relus(self):\n\n def relu_backward_hook_function(module, grad_in, grad_out):\n \"\"\"\n If there is a negative gradient, change it to zero\n \"\"\"\n # Get last forward output\n corresponding_forward_output = self.forward_relu_outputs[-1]\n ... | [
"0.69386315",
"0.6738482",
"0.6700439",
"0.6639096",
"0.6637197",
"0.6555062",
"0.6436974",
"0.63124865",
"0.62632155",
"0.6243523",
"0.6224539",
"0.6208889",
"0.6193527",
"0.61763686",
"0.6022533",
"0.5998642",
"0.5998347",
"0.597587",
"0.59679216",
"0.5951862",
"0.5884953",... | 0.6384566 | 7 |
Computes the backward pass for rectified linear units (ReLUs). | def relu_backward(dout, x):
############################################################################
# TODO: Implement the ReLU backward pass. #
############################################################################
########################################################... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relu_backward(self, dUpper, cache):\n x = cache\n #############################################################################\n # TODO: Implement the ReLU backward pass. #\n #########################################################################... | [
"0.7124722",
"0.7017195",
"0.7015673",
"0.6892136",
"0.68882793",
"0.68678695",
"0.6858797",
"0.6836433",
"0.6825028",
"0.68220276",
"0.6786696",
"0.6786696",
"0.67829865",
"0.6777763",
"0.67603457",
"0.67577285",
"0.67430496",
"0.67430496",
"0.67378974",
"0.6713772",
"0.6684... | 0.6825718 | 8 |
The full XML stream for the chart specified by this chart builder, as unicode text. This method must be overridden by each subclass. | def xml(self):
raise NotImplementedError('must be implemented by all subclasses') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_xml(self):\n with io.StringIO() as string:\n string.write(ET.tostring(self.root, encoding=\"unicode\"))\n return string.getvalue()",
"def toString(self):\n return _libsbml.XMLInputStream_toString(self)",
"def get_xml(self):\n return etree.tostring(self.get_etr... | [
"0.6885545",
"0.6277913",
"0.6193232",
"0.6142608",
"0.61369824",
"0.6129046",
"0.61222863",
"0.60559154",
"0.6035094",
"0.59926337",
"0.59828854",
"0.5953446",
"0.59503734",
"0.5929605",
"0.59173256",
"0.58949184",
"0.5893518",
"0.5893518",
"0.5879584",
"0.5803865",
"0.57939... | 0.6124511 | 6 |
Returns two lists, where the first one contains answers that would be lost due to tokenization, while the second one contains wrong answers | def _lost_answers_indexes(self, df, tokenized_contexts):
whole_answers_start = df["answer_start"].tolist()
whole_answers_end = df["answer_end"].tolist()
lost_dirty, lost_truncated = [], []
for i, (c, s, e) in enumerate(
zip(tokenized_contexts, whole_answers_start, whole_answe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diff(gold_tokens, pred_tokens):\n return list(_diff(gold_tokens, pred_tokens))",
"def answers():\n answer = ([[1, 2, 2, 1], # 3. Not necessarily legal if terms of service disallow\n ['https://soundcloud.com/', # 1. soundcloud, some disallow\n 'https://cfmriweb.ucsd.edu/', # ... | [
"0.6093905",
"0.6059985",
"0.5974665",
"0.578052",
"0.5764473",
"0.57333994",
"0.5700691",
"0.56971943",
"0.5693195",
"0.56718713",
"0.5667118",
"0.56469125",
"0.5629894",
"0.55992776",
"0.5597915",
"0.5587587",
"0.55770713",
"0.55751204",
"0.5565917",
"0.55606455",
"0.555868... | 0.5283619 | 56 |
Fetch and return index data as xarray DataSet This is a shortcut to .load().index.to_xarray() Returns | def to_xarray(self, **kwargs):
if self._AccessPoint not in self.valid_access_points:
raise InvalidFetcherAccessPoint(
" Initialize an access point (%s) first."
% ",".join(self.Fetchers.keys())
)
return self.load().index.to_xarray(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_xarray_data():\n pressure = xr.DataArray([850., 700., 500.], dims=('isobaric',), attrs={'units': 'hPa'})\n temp = xr.DataArray([[[[296., 295., 294.], [293., 292., 291.]],\n [[286., 285., 284.], [283., 282., 281.]],\n [[276., 275., 274.], [273., 272.... | [
"0.66301817",
"0.6526453",
"0.64050734",
"0.6305211",
"0.6266725",
"0.62328595",
"0.6203111",
"0.61584604",
"0.6153438",
"0.6139485",
"0.60812867",
"0.6065309",
"0.6064389",
"0.60103244",
"0.60103244",
"0.6007262",
"0.60051835",
"0.60036457",
"0.60001653",
"0.5986962",
"0.591... | 0.68834615 | 0 |
Parse a learning rate argument into an initial rate and an optional scheduler callback. | def parse_learning_rate_arg(learning_rate: str):
sp = str(learning_rate).split('*')
initial = float(sp[0])
if len(sp) == 1:
return initial, []
elif len(sp) == 2:
return initial, [_parse_schedule(sp[1])]
assert False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(args,optimizer, epoch):\n lr = args.lr\n schedule = args.lr_schedule\n # schedule from TRADES repo (different from paper due to bug there)\n if schedule == 'trades':\n if epoch >= 0.75 * args.epochs:\n lr = args.lr * 0.1\n # schedule as in TRADES paper\n ... | [
"0.632414",
"0.626112",
"0.62322897",
"0.61935663",
"0.6161706",
"0.61524177",
"0.61368936",
"0.6128309",
"0.6113266",
"0.6106419",
"0.60915613",
"0.6090125",
"0.60646015",
"0.6049675",
"0.6031494",
"0.6018241",
"0.60113454",
"0.6008282",
"0.60074973",
"0.597578",
"0.59740263... | 0.77980846 | 0 |
return block diagonal matrix with entries A,B | def vsum(self, B):
A = self
m, n = A.shape
p, q = B.shape
X = np.zeros([m + p, n + q])
X[:m, :n] = A
X[m:, n:] = B
return Matrix(X) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_diag_full(W_):\n assert(W_.ndim == 3)\n bsize = W_.shape[0]\n full = np.concatenate([\n np.concatenate([ np.diag(W_[:,i,j]) for j in range(W_.shape[2]) ], axis=1)\n for i in range(W_.shape[1]) ], axis=0)\n return full",
"def _block_diagonal(factor_matrices):\n shapes_dict = {}... | [
"0.7059728",
"0.6913739",
"0.6728796",
"0.66922975",
"0.66883457",
"0.667499",
"0.6457386",
"0.640291",
"0.63497514",
"0.6323933",
"0.6246453",
"0.6184476",
"0.6173583",
"0.61535287",
"0.61428887",
"0.6106134",
"0.5953221",
"0.5921137",
"0.5916368",
"0.5903814",
"0.58936244",... | 0.0 | -1 |
GET/PUT for camera controller. | def camera_controller(self, camera_controller_id=None,
path=None, value=None, **kwargs):
if path == None:
path = []
if camera_controller_id != None:
path.insert(0, camera_controller_id)
path.insert(0, "cameracontroller")
location = '/'.jo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cam():\n\treturn Response(gen(camera),\n\t\t\t\t\tmimetype='multipart/x-mixed-replace; boundary=frame'), 200",
"def camera(self):\n return self.__camera",
"def camera(self):\n return self._camera",
"def camera(self):\n return self._camera",
"def get_camera(camid):\n camera = get... | [
"0.65088314",
"0.60280484",
"0.5967427",
"0.5967427",
"0.59517896",
"0.59313315",
"0.5858214",
"0.5843304",
"0.57947284",
"0.577467",
"0.5726902",
"0.5630387",
"0.5625143",
"0.5621106",
"0.56064785",
"0.5561165",
"0.55356747",
"0.5528753",
"0.55175257",
"0.55114865",
"0.55013... | 0.757974 | 0 |
this method returns a onehot vector of the given size, where the 1 is placed in the ind entry. | def get_one_hot(size, ind):
one_hot = np.zeros((size,))
one_hot[ind] = 1
return one_hot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_one_hot(ind, n):\n vec = np.zeros(n)\n vec[ind] = 1\n return vec",
"def turn_to_one_hot(self,length,ind):\n one_hot = [0 for _ in range(length)]\n if (ind >= len(one_hot)):\n one_hot[-1] = 1\n else:\n one_hot[ind] = 1\n return one_hot",
"def one... | [
"0.84444565",
"0.8298798",
"0.8195772",
"0.8189615",
"0.8126685",
"0.81259286",
"0.81199",
"0.810238",
"0.7999138",
"0.7949889",
"0.79117304",
"0.7889848",
"0.7886849",
"0.77816015",
"0.7770782",
"0.77627516",
"0.7722842",
"0.7692494",
"0.76899445",
"0.7679778",
"0.7666221",
... | 0.8994864 | 0 |
from absolute positions to relative positions, centred around the middle (yolo format) | def convert(size, box):
# TODO rewrite box to be [TL, BR] coordinates
#pdb.set_trace()
dw = 1./size[0]
dh = 1./size[1]
x = (box[0] + box[1])/2.0
y = (box[2] + box[3])/2.0
w = box[1] - box[0]
h = box[3] - box[2]
x = x*dw
w = w*dw
y = y*dh
h = h*dh
return (x,y,w,h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_abs(self, source):\n if self.relative:\n return source.center + self.center\n else:\n return self.center",
"def center_mario(self):\n self.rect.midbottom = self.screen_rect.midbottom\n self.x, self.y = float(self.rect.x), float(self.rect.y)",
"def po... | [
"0.7057521",
"0.6928795",
"0.6912088",
"0.68229353",
"0.6720442",
"0.6695829",
"0.66890335",
"0.660353",
"0.6571176",
"0.65602934",
"0.65575945",
"0.65461105",
"0.65344065",
"0.6482683",
"0.64808226",
"0.64451253",
"0.64381176",
"0.64342654",
"0.639161",
"0.6372221",
"0.63061... | 0.0 | -1 |
create one hot vector for each element in the structure | def one_hot_vector_one_element(element):
# in one-hot-vector notaiton 1 corresponds to the presence of valence e's in the shell
# according to the key in the dict, for key notation see notes on dict_shell_v_electrons_for_one_hot_vector()
D = dict_shell_v_electrons_for_one_hot_vector()
shell_v_electrons_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output",
"def one_hot_encode(x):\n # TODO: Implement Function\n x_l = list(x)\n for index in np.arange(len(x_l)):\n x_... | [
"0.7645146",
"0.76057005",
"0.7551651",
"0.75490177",
"0.75124705",
"0.74896836",
"0.7467359",
"0.74551237",
"0.73987114",
"0.73829705",
"0.73699",
"0.73542374",
"0.7347406",
"0.7342356",
"0.733751",
"0.7330842",
"0.7315053",
"0.7276076",
"0.7255521",
"0.7252579",
"0.7252579"... | 0.0 | -1 |
Adds an item at the front of the list. | def push_front(self, item):
new_node = Node(item)
# if the list is empty, make it head
if self.head is None:
self.head = new_node
# else,
else:
new_node.next = self.head # new node points to current head
self.head = new_node # current head p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_front(self, item):\n\n self.items.insert(0, item)",
"def push(self, item):\n self.list.prepend(item)",
"def enqueue_front(self, item):\n self._items.insert(0, item)",
"def push(self, item):\n self.linked_list.prepend(item)",
"def append_front(self, item):\n\n self... | [
"0.8478339",
"0.78348863",
"0.7722424",
"0.76395625",
"0.7530378",
"0.75040954",
"0.74947596",
"0.74927473",
"0.71589714",
"0.7130175",
"0.71164906",
"0.7080073",
"0.7035995",
"0.6870759",
"0.6870759",
"0.68705535",
"0.68518543",
"0.6771763",
"0.67336917",
"0.6660746",
"0.663... | 0.7720473 | 3 |
returns the value of the nth item (starting at 0) | def value_at(self, index):
if index==0:
return self.head.val
temp_node = self.head
for _ in range(index):
temp_node = temp_node.next
return temp_node.val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, i):\n return self.get(i, i + 1)",
"def get(self, index: int) -> int:\n if index + 1 >self.cnt:\n return -1\n\n tmp = self.dummy\n for i in range(index+1):\n tmp = tmp.next\n return tmp.val",
"def __getitem__(self, n):\n retur... | [
"0.7461209",
"0.7198535",
"0.71174335",
"0.7068467",
"0.6979077",
"0.6949385",
"0.6928961",
"0.68497336",
"0.67874527",
"0.6725961",
"0.66929966",
"0.6687388",
"0.66578394",
"0.66318387",
"0.66274095",
"0.6566982",
"0.6566982",
"0.6566982",
"0.6563464",
"0.6531671",
"0.652858... | 0.65629685 | 19 |
returns the value of the node at nth position from the end of the list | def value_n_from_end(self, n):
# check the validity of the input
if n > self.n-1:
print(f"Error; n is greater than the length of the list = {self.n-1}")
return
temp_node = self.head # store head
for _ in range((self.n-1) - n):
temp_node = te... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nth_node_from_end(self, n):\n\n length = 0\n\n if self.head:\n current = self.head\n while current:\n length += 1\n current = current.next\n\n count = 0\n current = self.head\n while count < (length - n): \n ... | [
"0.74624777",
"0.7346212",
"0.7245577",
"0.7144503",
"0.7056932",
"0.6897913",
"0.6836249",
"0.68209404",
"0.68094146",
"0.67188853",
"0.6701307",
"0.66925293",
"0.66457725",
"0.6619531",
"0.66030765",
"0.65967846",
"0.6596734",
"0.6596202",
"0.65683895",
"0.6555614",
"0.6543... | 0.7774788 | 0 |
Display the single Butter front page and allow visitors to start a Buy a=or Sell transaction | def index(request):
if request.method == 'POST':
form = TxForm(request.POST)
if form.is_valid():
if request.POST['tx_type'] == 'BUY':
# address validation
if not request.POST['address']:
print('no address')
messages.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trade_action(self, BUY_QTY):\n BUY_QTY = 4500\n self.trade(BUY_QTY)\n #self.show()",
"def buy():\n\n if request.method == \"POST\":\n response = trade(db, session['user_id'], request.form, 'BUY')\n if response:\n if response['type'] is 'error':\n ... | [
"0.64694035",
"0.64094466",
"0.6284296",
"0.60376376",
"0.60059065",
"0.5976704",
"0.59608257",
"0.5959968",
"0.59041345",
"0.59013575",
"0.58992827",
"0.58914644",
"0.587166",
"0.58528227",
"0.5842987",
"0.58223736",
"0.58221805",
"0.5811866",
"0.5807332",
"0.58057636",
"0.5... | 0.63998646 | 2 |
A list of all headlines in html_root_node. | def all_headlines(html_root_node):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_headlines(self):\r\n\t\tlist_vals = list(self.keyword_headlines().values())\r\n\t\tuniq_headlines = set()\r\n\t\tfor list_val in list_vals:\r\n\t\t\tfor headlineobj in list_val:\r\n\t\t\t\tuniq_headlines.add(headlineobj.headlineid.content)\r\n\r\n\t\treturn list(uniq_headlines)",
"def get_headlines(s... | [
"0.67986226",
"0.65997756",
"0.65986437",
"0.6581237",
"0.6533369",
"0.64754415",
"0.6419111",
"0.62299573",
"0.62149304",
"0.6154909",
"0.6016565",
"0.59933895",
"0.5969729",
"0.5963461",
"0.59520066",
"0.59432167",
"0.5813856",
"0.57545596",
"0.5723752",
"0.56269383",
"0.56... | 0.90039504 | 0 |
Renders the home page. | def cart_detail(request):
assert isinstance(request, HttpRequest)
if request.method == "POST":
cart_service.remove_from_cart(request)
return render(
request,
'cartapp/cart_detail.html',
{
'title':'Cart Page',
'year':datetime.now().year,
}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.0 | -1 |
Tokenize given text into paragraphs, sentences and words. Endpoint uses Newline method to tokenize paragraphs and regexes and rules to tokenize sentences and words | async def tokenize_text_handler(request, *args):
return tokenize_text(request["text"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n sentence = Sentence(text)\n return sentence.tokens()",
"def tokenize_text(document, nlp):\n\n return [token.text for token in nlp(document)]",
"def tokenize(text):\n return text.split(' ')",
"def tokenize(self, text):\n\n # Normalize text\n text = re.sub(r\"[^a-zA... | [
"0.77011746",
"0.7228713",
"0.7202503",
"0.7153594",
"0.7108917",
"0.7074527",
"0.70556897",
"0.7049619",
"0.70398355",
"0.7023222",
"0.70075214",
"0.7003905",
"0.69966006",
"0.6993002",
"0.6990796",
"0.698593",
"0.69777656",
"0.69753927",
"0.697454",
"0.69680476",
"0.6942435... | 0.67757994 | 36 |
Returns if the word is in the trie. | def search(self, word: str) -> bool:
if len(word) == 0:
return True
idx = ord(word[0]) - ord('a')
if not self.children[idx]:
return False
if len(word) == 1:
return self.children[idx].tail # switch for only once
return self.children[idx].searc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr... | [
"0.838632",
"0.8150416",
"0.8123471",
"0.7856802",
"0.7830664",
"0.77935004",
"0.7792806",
"0.77642965",
"0.7753436",
"0.7747724",
"0.7711298",
"0.76816714",
"0.7677101",
"0.7664614",
"0.76506114",
"0.76338875",
"0.7628353",
"0.76114196",
"0.7577657",
"0.75695884",
"0.756079"... | 0.7139436 | 53 |
Get the connected signs | def signs(self) -> Dict[str, HanoverSign]:
return self._signs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _connectivity(self):\n if not self.is_connected():\n raise gfapy.ArgumentError(\n \"Cannot compute the connectivity of {}\\n\".format(self)+\n \"Segment is not connected to a GFA instance\")\n return self._connectivity_symbols(len(self.dovetails_L),\n ... | [
"0.5988669",
"0.59284824",
"0.57749724",
"0.56526196",
"0.56343955",
"0.56310093",
"0.55913466",
"0.55886096",
"0.55867475",
"0.55490667",
"0.55300474",
"0.55252635",
"0.5496374",
"0.5487526",
"0.5479785",
"0.54754657",
"0.5448505",
"0.5398998",
"0.5371763",
"0.5349526",
"0.5... | 0.60209274 | 0 |
Set a list of modules to a particular logging level. | def _logging_individual_modules(logmod, modlevel):
if not logmod:
return
module_log_level = getattr(logging, modlevel.upper(), modlevel)
if not isinstance(module_log_level, int):
try:
module_log_level = int(module_log_level)
except ValueError:
logging.warning... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLevel(level:int)->None:\n for logger in loggers:\n logger.setLevel(level)",
"def set_log_level(loggers=[\"vaex\"], level=logging.DEBUG):\n for logger in loggers:\n logging.getLogger(logger).setLevel(level)",
"def set_loggers_level(names, level=logging.CRITICAL):\n for item in name... | [
"0.754282",
"0.7299224",
"0.72906643",
"0.709733",
"0.69048655",
"0.6828029",
"0.67473036",
"0.671748",
"0.6643824",
"0.6637931",
"0.6613942",
"0.648382",
"0.64391565",
"0.64324754",
"0.6421063",
"0.6417684",
"0.6400293",
"0.6390389",
"0.6388985",
"0.6385155",
"0.6378326",
... | 0.71237177 | 3 |
Test correct error is raised when a nonevendimensional array is passed | def test_change_basis_raises_not_even(self, fun, dim):
size = (5,) * dim
A = np.random.rand(*size)
with pytest.raises(ValueError, match="The input array is not even-dimensional"):
fun(A) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_flatten_array_failure():\n with pytest.raises(ValueError, match=\"Please pass in a valid array\"):\n flatten_array(\"\")",
"def test_Sobol_G_raises_error_if_values_not_numpy_array():\n fixture = [list(range(8)), str(12345678)]\n for x in fixture:\n with raises(TypeError):\n ... | [
"0.7476376",
"0.7124102",
"0.71235746",
"0.7106779",
"0.7014832",
"0.6992509",
"0.6902733",
"0.6823309",
"0.6800893",
"0.6757861",
"0.66611123",
"0.6646919",
"0.66283774",
"0.66185856",
"0.6580735",
"0.6577013",
"0.6551648",
"0.65404934",
"0.653902",
"0.6509724",
"0.64953256"... | 0.629896 | 44 |
Constructs a generator based on a ResNet50 model. | def genresnet50(**kwargs):
return EresNet(resnetblocks.EresNetBottleneck, [3, 4, 6, 3], **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_resnet_generator(self, model_shape, filters=32, k_size=3, last_act='tanh', summary=False, model_file=None, name='gan_g_'):\n if (model_file):\n \"\"\"\n Load pretreined model\n \"\"\"\n model = self.utils.build_pretrained_model(model_file)\n i... | [
"0.68357396",
"0.6660795",
"0.66268563",
"0.6449131",
"0.64019734",
"0.6350461",
"0.63176906",
"0.63161147",
"0.62941504",
"0.62886864",
"0.6261149",
"0.6252632",
"0.6252632",
"0.6252632",
"0.6252632",
"0.6242074",
"0.6233013",
"0.62021315",
"0.6199121",
"0.61881065",
"0.6172... | 0.5578411 | 94 |
Constructs a generator based on a ResNet152 model. | def genresnet152(**kwargs):
return EresNet(resnetblocks.EresNetBottleneck, [3, 8, 36, 3], **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnext152(**kwargs):\n model = ResNeXt(Bottleneck, [3, 8, 36, 3], **kwargs)\n return model",
"def _init_model(self):\r\n\r\n self.model = ResNet152V2(weights='imagenet')",
"def resnet152(pretrained=False, **kwargs):\n model = ResNet('resnet152', Bottleneck, [3, 8, 36, 3], **kwargs)\n if... | [
"0.69971883",
"0.68275565",
"0.65654314",
"0.65592206",
"0.6533679",
"0.64743906",
"0.64743906",
"0.64743906",
"0.64743906",
"0.6450941",
"0.6419934",
"0.6335441",
"0.6335441",
"0.6238511",
"0.6228068",
"0.6189244",
"0.6005388",
"0.59869194",
"0.59712064",
"0.5920513",
"0.584... | 0.608068 | 16 |
The list of required import lines (as strings with python code) | def import_lines(self) -> List[str]:
result = []
# To summarize multiple names imported from a same module, we collect those
# in the `module_map` dictionary, mapping a module path to the list of names that should
# be imported from it. the names can also be alias in the form 'original ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_imports(self) -> str:\n\n imports = [\n \"_ = require('lodash');\",\n \"stream = require('stream');\",\n f\"const hookRegister = require('./{settings.ARTILLERY_HOOK_FILE}').hookRegister;\",\n f\"hook = require('./{settings.ARTILLERY_LIB_FOLDER}/hooks').hoo... | [
"0.7392999",
"0.7008633",
"0.7006744",
"0.6577546",
"0.65343875",
"0.6469632",
"0.63858473",
"0.6340286",
"0.6318618",
"0.62747866",
"0.62601453",
"0.6256329",
"0.624323",
"0.6182229",
"0.61704916",
"0.6132508",
"0.61241585",
"0.6098096",
"0.60951346",
"0.6083969",
"0.6073907... | 0.74202406 | 0 |
Return initializer for a variable. Return None if we've generated one already or if the variable is internal. | def get_init(self, lvalue: str, rvalue: Expression,
annotation: Optional[Type] = None) -> Optional[str]:
if lvalue in self._vars[-1]:
# We've generated an initializer already for this variable.
return None
# TODO: Only do this at module top level.
if self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self):\n return self._variable.initializer",
"def variable(initializer=None, shape=None, dtype=None, name=None, **kwargs):\n return get_var(name, shape=shape, dtype=dtype, initializer=initializer, **kwargs)",
"def _default_initializer(name, shape, dtype):\n # pylint: disable=protected... | [
"0.7012431",
"0.640539",
"0.62067115",
"0.6109931",
"0.6077824",
"0.60201895",
"0.5894355",
"0.5758639",
"0.5741372",
"0.5715161",
"0.5671216",
"0.5660715",
"0.55991495",
"0.5595322",
"0.5546396",
"0.5451056",
"0.54067546",
"0.54067546",
"0.5384396",
"0.5382944",
"0.53653044"... | 0.5486726 | 15 |
Find checkpoint files based on its max steps. is_outdir indicates whether find from outdir or modeldir. note that outdir generated from train and eval copy them to modeldir. | def _find_train_ckptfiles(path, is_delete):
# if not exists(path):
# return None, -1
steps = [int(f[len(ckpt_prefix):-5]) for f in os.listdir(path)
if f[:len(ckpt_prefix)] == ckpt_prefix and f[-5:] == '.meta']
if len(steps) == 0:
if is_delete:
raise FileNotFoundError... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_dir(self):\n return os.path.join(self.checkpoint_dir, self.model_dir)",
"def find_last(self):\n # Get directory names. Each directory corresponds to a model\n dir_names = next(os.walk(self.model_dir))[1]\n key = self.config.NAME.lower()\n dir_names = filter(lambda f:... | [
"0.6018463",
"0.5785135",
"0.5748152",
"0.57382095",
"0.5651902",
"0.55859107",
"0.5512155",
"0.5418045",
"0.5396361",
"0.5361415",
"0.5323277",
"0.53144616",
"0.53109574",
"0.5308277",
"0.5305889",
"0.52755123",
"0.52709544",
"0.51943886",
"0.5179579",
"0.5176981",
"0.512353... | 0.61166877 | 0 |
Test all expected versioned base URLs responds with 200 This depends on the routers for each kind of server. | def test_versioned_base_urls(client, index_client, server: str):
try:
import simplejson as json
except ImportError:
import json
from optimade.server.routers.utils import BASE_URL_PREFIXES
clients = {
"regular": client,
"index": index_client,
}
valid_endpoints =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_all_http_stats(self):\n client = Client()\n response = client.get(reverse('home'))\n self.assertEqual(200, response.status_code)\n response = client.get(reverse('browse_produce'))\n self.assertEqual(200, response.status_code)\n response = client.get(reverse('brows... | [
"0.6897015",
"0.68129045",
"0.677679",
"0.6763513",
"0.6698699",
"0.6693176",
"0.65127456",
"0.6466742",
"0.6453278",
"0.6448831",
"0.6442751",
"0.63902104",
"0.63858867",
"0.63354486",
"0.6322557",
"0.6315488",
"0.63115126",
"0.63115126",
"0.63044256",
"0.6285797",
"0.627788... | 0.74736565 | 0 |
Ensures that flavorid duplicates raise InstanceTypeCreateFailed | def test_duplicate_flavorids_fail(self):
flavorid = 'flavor1'
instance_types.create('name one', 256, 1, 120, 200, flavorid)
self.assertRaises(exception.InstanceTypeIdExists,
instance_types.create,
'name two', 256, 1, 120, 200, flavorid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_duplicate_names_fail(self):\n name = 'some_name'\n instance_types.create(name, 256, 1, 120, 200, 'flavor1')\n self.assertRaises(exception.InstanceTypeExists,\n instance_types.create,\n name, 256, 1, 120, 200, 'flavor2')",
"def test_c... | [
"0.6808342",
"0.67799765",
"0.6590003",
"0.6453586",
"0.64351535",
"0.6365518",
"0.6303799",
"0.62312794",
"0.60959566",
"0.5960529",
"0.58526385",
"0.5842749",
"0.57575655",
"0.57458967",
"0.5740525",
"0.57401335",
"0.5717716",
"0.5713491",
"0.56291854",
"0.5617452",
"0.5548... | 0.8336245 | 0 |
Obtain the current execution status. | def getStatus(self):
return self.controller.getStatus() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self) -> pulumi.Output['outputs.JobStatus']:\n return pulumi.get(self, \"status\")",
"def getstatus(self):\n return self.__status",
"def get_current_status(cls):\n from sauna.plugins.base import Plugin\n from sauna import check_results_lock, check_results\n\n def r... | [
"0.78136736",
"0.7751159",
"0.7657813",
"0.76288384",
"0.7592241",
"0.7535528",
"0.7535528",
"0.75348437",
"0.75277287",
"0.7518563",
"0.75127155",
"0.74892646",
"0.74881625",
"0.7473243",
"0.7473243",
"0.74728304",
"0.7460494",
"0.7460494",
"0.7460494",
"0.7460494",
"0.74604... | 0.7142546 | 88 |
returns the expected future reward for taking each action | def forward(self, state, text, logits=True):
assert not torch.isnan(state).any(), f"NaN in input state {state}"
assert not torch.isnan(text).any(), f"NaN in input embedding {text}"
h_state = F.relu(self.l1_state(state))
h_text = F.relu(self.l1_text(text))
h = h_state + h_text
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_reward(self, i_state, action, is_execute_success, coverage_vector):\n pass",
"def _get_reward(self):\n if self.status():\n return self.current_step/self.ep_length # the reward is proportional to the duration \n else:\n return 0",
"def step(self, action):\n res = self.reward_t... | [
"0.735721",
"0.7279181",
"0.71540534",
"0.7067911",
"0.7016758",
"0.69453704",
"0.6944374",
"0.6939781",
"0.6938727",
"0.69059646",
"0.6894488",
"0.6880816",
"0.687064",
"0.6843841",
"0.68362904",
"0.68348783",
"0.6828078",
"0.6823985",
"0.68140066",
"0.68140066",
"0.68140066... | 0.0 | -1 |
extracts file name with and without extension from the full file path | def extract_file_name(self, input_file):
self.file_name_with_ext, self.file_name = extract_file_name(input_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_name_with_ext(path: str) -> str:\n return os.path.basename(path)",
"def extract_file_name(file_path):\n # ファイルパスからファイル名(拡張子含む)を取り出す\n file_name = file_path.split('/')[-1]\n # 拡張子を取り除く\n return file_name.split('.')[0]",
"def get_file_name(path: str) -> str:\n return os.path.splite... | [
"0.8303241",
"0.82110685",
"0.8128588",
"0.80927277",
"0.7958194",
"0.7909453",
"0.79039913",
"0.7895643",
"0.7865542",
"0.784489",
"0.7813938",
"0.77781713",
"0.77732307",
"0.77731204",
"0.7605138",
"0.7603767",
"0.75907135",
"0.7587515",
"0.7577802",
"0.7551133",
"0.7540287... | 0.7103106 | 73 |
Returns True if var should be enqueued under the allreduceddomains condition, otherwise False | def condition_domain_reduction(csp, var) :
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def condition_singleton(csp, var) :\n if len(csp.get_domain(var))==1:\n return True\n return False",
"def condition_singleton(csp, var) :\n return len(csp.get_domain(var))==1",
"def any_holds(self, domains, const, env, other_vars, ind=0, assigned_vars=[]):\r\n # All the variables in the ... | [
"0.6265647",
"0.6243808",
"0.5521765",
"0.5475188",
"0.54499143",
"0.5381839",
"0.5379803",
"0.5367007",
"0.53247434",
"0.5320797",
"0.53065324",
"0.53065324",
"0.5259333",
"0.52381426",
"0.5214658",
"0.5190644",
"0.5171438",
"0.5169606",
"0.5158193",
"0.5148482",
"0.51421607... | 0.6505326 | 1 |
Returns True if var should be enqueued under the singletondomains condition, otherwise False | def condition_singleton(csp, var) :
if len(csp.get_domain(var))==1:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def condition_singleton(csp, var) :\n return len(csp.get_domain(var))==1",
"def is_shared_with_domain(self):\n return self.has_label(SHAREDWITHDOMAIN_LABEL)",
"def condition_domain_reduction(csp, var) :\n return True",
"def condition_domain_reduction(csp, var) :\n return True",
"def allow_bare_... | [
"0.7515692",
"0.6359609",
"0.6248687",
"0.6248687",
"0.6022763",
"0.6022763",
"0.6010284",
"0.58347994",
"0.5811564",
"0.5811564",
"0.5689526",
"0.55664146",
"0.55624366",
"0.5551198",
"0.55263907",
"0.55263907",
"0.5476592",
"0.5419524",
"0.54008955",
"0.5396627",
"0.5390506... | 0.7757652 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.