query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return a tensor with the cumulative sum of elements. | def cumsum(self, dim):
return array_funcs.cumsum(self, dim) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumulative_sum(t):\n c = []\n sum = 0\n for ele in t:\n sum = ele + sum\n c.append(sum)\n return c",
"def cumsum(x, axis=0, exclusive=False):\n if not is_xla_compiled():\n return tf.cumsum(x, axis=axis, exclusive=exclusive)\n x_shape = shape_list(x)\n rank = len(x_shape)\n le... | [
"0.7463067",
"0.72609127",
"0.7248465",
"0.71491957",
"0.71086335",
"0.7072247",
"0.70481604",
"0.70331645",
"0.700914",
"0.6952843",
"0.68024606",
"0.67737025",
"0.67603433",
"0.65995306",
"0.6556727",
"0.65338254",
"0.65159065",
"0.6487168",
"0.6451662",
"0.64246225",
"0.64... | 0.78974235 | 0 |
Return a float64 tensor with the same data. Returns dragon.vm.torch.Tensor The output tensor. | def double(self):
return array_funcs.cast(self, 'float64', False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_tensor(self):\n return self.tensor",
"def to_float_tensor(img) -> torch.tensor:\n #\n return torch.from_numpy(img.transpose(2, 0, 1)).float()",
"def _ensure_float_tensor(val_in, device):\n if not isinstance(val_in, torch.Tensor):\n val_out = torch.tensor(val_in, dtype=torch.float32, d... | [
"0.67303",
"0.6635235",
"0.653062",
"0.6520683",
"0.6477599",
"0.62855947",
"0.6247484",
"0.62369007",
"0.62369007",
"0.6214719",
"0.62137884",
"0.61737233",
"0.61399454",
"0.6085905",
"0.6054519",
"0.60211647",
"0.6012743",
"0.58950096",
"0.58566463",
"0.5835762",
"0.5828714... | 0.6085117 | 14 |
Return a tensor with elements broadcast. | def expand(self, *sizes):
return array_funcs.expand(self, sizes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def broadcast(broadcast_shape, x):\n if F.shape(x) == broadcast_shape:\n return x\n multiples = const_utils.compute_multiples(F.shape(x), broadcast_shape)\n if multiples:\n return F.tile(x, multiples)\n return x",
"def shape_broadcast(*elements):\n return expand_and_broadcast(*(B.sha... | [
"0.7549591",
"0.7132664",
"0.70226496",
"0.6922799",
"0.6819509",
"0.6765657",
"0.6521212",
"0.62973166",
"0.62955713",
"0.62955713",
"0.62955713",
"0.62698996",
"0.6232802",
"0.6229654",
"0.6104597",
"0.6074719",
"0.5995273",
"0.5965947",
"0.5943988",
"0.5907041",
"0.5859856... | 0.0 | -1 |
r"""Fill self with a scalar value. | def fill_(self, value):
return init_funcs.fill(self, self.shape, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self):\n self.tensor.fill(self.value)",
"def fill_null(self, value):\n return type(self)(C.fill_null(self.array, value))",
"def Fill(self, value: 'double const &') -> \"void\":\n return _itkMatrixPython.itkMatrixD33_Fill(self, value)",
"def Fill(self, value: 'float const &') ... | [
"0.70111805",
"0.6846847",
"0.6546793",
"0.6517798",
"0.64992046",
"0.6474936",
"0.6428798",
"0.6403978",
"0.64002025",
"0.6398847",
"0.639204",
"0.6391937",
"0.63820636",
"0.6363165",
"0.63286567",
"0.63258487",
"0.63215417",
"0.6313401",
"0.63119555",
"0.621793",
"0.6208211... | 0.70357 | 0 |
Return a float32 tensor with the same data. Returns dragon.vm.torch.Tensor The output tensor. | def float(self):
return array_funcs.cast(self, 'float32', False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tf_float32(x):\n if isinstance(x, tf.Tensor):\n return tf.cast(x, dtype=tf.float32) # This is a no-op if x is float32.\n else:\n return tf.convert_to_tensor(x, tf.float32)",
"def convert_to_float_tensor(self, data):\n\n data = data.astype(np.float32)\n\n return torch.from_numpy(data).t... | [
"0.7285722",
"0.70936495",
"0.6833231",
"0.6833231",
"0.67659307",
"0.67566866",
"0.67112035",
"0.6675256",
"0.66493535",
"0.6604233",
"0.6584931",
"0.63234985",
"0.6204032",
"0.61887115",
"0.6161297",
"0.6157165",
"0.6080468",
"0.60525143",
"0.60446316",
"0.6043291",
"0.6028... | 0.64753604 | 11 |
Cast to a float32 tensor. Returns dragon.vm.torch.Tensor The self. | def float_(self):
return array_funcs.cast(self, 'float32', True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tf_float32(x):\n if isinstance(x, tf.Tensor):\n return tf.cast(x, dtype=tf.float32) # This is a no-op if x is float32.\n else:\n return tf.convert_to_tensor(x, tf.float32)",
"def convert_to_float_tensor(self, data):\n\n data = data.astype(np.float32)\n\n return torch.from_numpy(data).t... | [
"0.763478",
"0.75315917",
"0.7144874",
"0.7144874",
"0.70089024",
"0.68046343",
"0.67282075",
"0.6726104",
"0.6712348",
"0.64154804",
"0.63847995",
"0.63279015",
"0.63100386",
"0.62164736",
"0.62158704",
"0.62127686",
"0.61629486",
"0.61405003",
"0.6030226",
"0.5999104",
"0.5... | 0.72559303 | 2 |
Return a float16 tensor with the same data. Returns dragon.vm.torch.Tensor The output tensor. | def half(self):
return array_funcs.cast(self, 'float16', False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ggml_fp16_to_fp32(x: np.float16) -> float:\n ...",
"def ggml_fp32_to_fp16(x: float) -> np.float16:\n ...",
"def half_(self):\n return array_funcs.cast(self, 'float16', True)",
"def to_float_tensor(img) -> torch.tensor:\n #\n return torch.from_numpy(img.transpose(2, 0, 1)).float()",
"def ... | [
"0.68088955",
"0.6779472",
"0.6759397",
"0.6589213",
"0.63789797",
"0.6326114",
"0.62713224",
"0.6266358",
"0.6264949",
"0.6139717",
"0.6089782",
"0.6074233",
"0.60703987",
"0.6044264",
"0.5899049",
"0.5898109",
"0.5895631",
"0.5875938",
"0.58642936",
"0.5854283",
"0.58403254... | 0.64784575 | 4 |
r"""Return if the elements are infinite. | def isinf(self):
return math_funcs.isinf(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_infinite(self):\n\t\tpass",
"def is_infinite(self):\n points = self.points()\n for point in points:\n if point[-1] == 0:\n return True\n return False",
"def isfinite(self):\n return True",
"def is_infinite(self):\n return... | [
"0.8124602",
"0.78540534",
"0.774749",
"0.77418375",
"0.7728634",
"0.76429236",
"0.757555",
"0.75595915",
"0.7552092",
"0.7478159",
"0.73742545",
"0.73515534",
"0.73322517",
"0.72173846",
"0.72049654",
"0.715671",
"0.69937104",
"0.6988597",
"0.69812715",
"0.6976684",
"0.69620... | 0.7364443 | 11 |
r"""Return if the elements are NaN. | def isnan(self):
return math_funcs.isnan(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_nan(value):\n\n return value != value",
"def has_no_nan(arr, *args):\n return not (np.isnan(arr).any())",
"def contains_nan(arr, node=None, var=None):\n if not _is_numeric_value(arr, var):\n return False\n elif getattr(arr, \"dtype\", \"\") in discrete_dtypes:\n return False\n ... | [
"0.7535124",
"0.7485145",
"0.7431003",
"0.74006414",
"0.7346008",
"0.72285175",
"0.7224134",
"0.72185266",
"0.72006965",
"0.7176815",
"0.71069074",
"0.706981",
"0.70359665",
"0.7030845",
"0.7027031",
"0.69776213",
"0.6972755",
"0.69727534",
"0.6943857",
"0.69407934",
"0.69278... | 0.76118535 | 0 |
r"""Fill self with the value where mask is 1. | def masked_fill_(self, mask, value):
return array_funcs.masked_fill(self, mask, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elementMask(self, value):\r\n self.mask = value",
"def masked(self, mask, mask_data=np.nan):\n if mask.data.size != self.data.size:\n raise ValueError('The dimension of mask does not match.')\n dat = self.data\n self.data = np.where(mask.data==0, mask_data, dat)",
"de... | [
"0.6764103",
"0.64231807",
"0.63880426",
"0.6299522",
"0.6118041",
"0.6108086",
"0.60925883",
"0.60914797",
"0.60629135",
"0.6020377",
"0.59816355",
"0.59816355",
"0.5926411",
"0.5917774",
"0.5917774",
"0.5915249",
"0.59083724",
"0.58742815",
"0.58651096",
"0.586055",
"0.5854... | 0.75675595 | 0 |
Select the elements where mask is 1. | def masked_select(self, mask):
return array_funcs.masked_select(self, mask) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def masked_select(data, mask, X=None):\n output = []\n for i, val in enumerate(mask):\n if val == 1:\n if i != 0 and mask[i - 1] == 0 and X is not None:\n output.append(X)\n output.append(data[i])\n\n # If there is an X at the beginning, remove it\n if X is ... | [
"0.73005974",
"0.6641714",
"0.6324195",
"0.59953296",
"0.5993102",
"0.5969423",
"0.59637654",
"0.59596854",
"0.59242254",
"0.58988327",
"0.5859135",
"0.5852683",
"0.5718421",
"0.57112664",
"0.5676361",
"0.56749564",
"0.5674742",
"0.56389743",
"0.56374997",
"0.5625126",
"0.561... | 0.7464379 | 0 |
r"""Compute the elementwise notequal comparison. | def ne(self, other):
return math_funcs.ne(self, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_equal(x1, x2, out=None):\n return _ufunc_helper(x1, x2, _npi.not_equal, _np.not_equal, _npi.not_equal_scalar, None, out)",
"def __ne__(a, b):\n result = not (a == b)\n\n return result",
"def compare_not_equal(self, size, a, b):\n\t\treturn self.expr(core.LLIL_CMP_NE, a.index, b.index, ... | [
"0.7703957",
"0.747571",
"0.74339634",
"0.7308496",
"0.7250312",
"0.7186972",
"0.708148",
"0.69205695",
"0.69172055",
"0.68936235",
"0.6862367",
"0.68556404",
"0.684911",
"0.68444425",
"0.68425137",
"0.6818848",
"0.6818848",
"0.681846",
"0.68059975",
"0.6795848",
"0.67952514"... | 0.0 | -1 |
Return a tensor filled with a scalar. Refer this tensor if ``dtype`` and ``device`` not provided. | def new_full(
self,
size,
fill_value,
dtype=None,
device=None,
requires_grad=False,
):
return init_funcs.full(
size,
fill_value,
dtype=self.dtype if dtype is None else dtype,
device=self.device if device is None else device,
requires_grad=requires_grad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scalar(name=None, dtype=None):\n if dtype is None:\n dtype = config.floatX\n type = TensorType(dtype, ())\n return type(name)",
"def scalar(dtype=dtypes.float32):\n return ndarray([1], dtype)",
"def define_local_scalar(dtype=dtypes.float32):\n return ndarray([1], dtype=dtype)",
"def... | [
"0.74036294",
"0.7126363",
"0.66384673",
"0.64391136",
"0.6277581",
"0.62369144",
"0.6234982",
"0.6165484",
"0.6038192",
"0.60376316",
"0.60006845",
"0.5970388",
"0.5935301",
"0.5924148",
"0.5916651",
"0.58851916",
"0.5881238",
"0.5855302",
"0.58522713",
"0.58457494",
"0.5816... | 0.0 | -1 |
r"""Fill self from a normal distribution. | def normal_(self, mean=0, std=1):
return init_funcs.normal_fill(self, mean, std) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_normal(raster, mean, sd, old_value):\n\n norm = np.random.normal(loc=mean, scale=sd, size=raster.shape)\n norm[norm < 0] = 0\n\n raster = (raster / old_value) * norm\n\n return raster",
"def normal_init(self, shape):\r\n return np.random.normal(loc= 0 ,scale=0.01,size = shape)",
"de... | [
"0.6611101",
"0.6140799",
"0.60193235",
"0.59434116",
"0.58644485",
"0.5839335",
"0.58392346",
"0.5790242",
"0.5717248",
"0.56922203",
"0.5669556",
"0.5650319",
"0.5572001",
"0.5495628",
"0.548855",
"0.54775304",
"0.5476541",
"0.54717946",
"0.54672027",
"0.5448917",
"0.544341... | 0.6735752 | 0 |
Repeat elements along the specified dimensions. | def repeat(self, *sizes):
return array_funcs.repeat(self, sizes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeat_along_axis(a, dim, n_repeats):\n repeats = [1] * (a.ndim+1)\n repeats[dim+1] = n_repeats\n new_shape = list(a.shape)\n new_shape[dim] *= n_repeats\n\n if isinstance(a, torch.Tensor):\n return a.unsqueeze(dim+1).repeat(repeats).reshape(new_shape)\n else:\n a = np.expand_di... | [
"0.7321237",
"0.72654253",
"0.7179727",
"0.68519294",
"0.6848824",
"0.6786393",
"0.6780514",
"0.67678356",
"0.6620404",
"0.64975864",
"0.6486162",
"0.6467437",
"0.6449202",
"0.635941",
"0.63059783",
"0.6201498",
"0.6162846",
"0.61183393",
"0.61065835",
"0.6082814",
"0.6075313... | 0.7281076 | 1 |
Return a tensor with the same data but a different shape. | def reshape(self, shape):
return array_funcs.reshape(self, shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make2D(t):\n ndim = tf.rank(t)\n if ndim == 2:\n return t\n elif ndim == 1:\n return tf.expand_dims(t, 0)\n else:\n t = tf.squeeze(t)\n if tf.rank(t) != 2:\n raise ValueError(f'Tensor cant be made 2D: {t}')\n else:\n return t",
"def uncombi... | [
"0.66036624",
"0.61141324",
"0.60135865",
"0.59970284",
"0.59925306",
"0.59899896",
"0.5976208",
"0.5967084",
"0.59579194",
"0.59491444",
"0.58897114",
"0.5874565",
"0.58544904",
"0.5848774",
"0.58288383",
"0.58049446",
"0.5787325",
"0.57853955",
"0.57695353",
"0.5760743",
"0... | 0.0 | -1 |
r"""Return a tensor taken the round of elements. | def round(self):
return math_funcs.round(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def round(self) -> 'Matrix':\n return Matrix(self.sds_context, \"round\", [self])",
"def round(self, eps=1e-14, rmax=100000):\n c = matrix()\n c.tt = self.tt.round(eps, rmax)\n c.n = self.n.copy()\n c.m = self.m.copy()\n return c",
"def tensor(self):\n\t\treturn self._... | [
"0.6052994",
"0.5940221",
"0.5879694",
"0.5832519",
"0.57811326",
"0.5678364",
"0.56631565",
"0.5549306",
"0.55354565",
"0.5508664",
"0.5404608",
"0.5387849",
"0.5367381",
"0.53547984",
"0.5339592",
"0.53161365",
"0.53089714",
"0.530896",
"0.53071064",
"0.52923447",
"0.526589... | 0.514187 | 30 |
r"""Return a tensor taken the sign indication of elements. | def sign(self):
return math_funcs.sign(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softsign(x):\n return tf.nn.softsign(x)",
"def sign(x):\n return SignOp(x)",
"def opposite(tensor):\n return -tensor",
"def sign(x):\n return numpy.sign(x)",
"def softsign(x):\n return K.softsign(x)",
"def sign(THETA):\n shape = THETA.shape\n out = [0 if theta == 0 else theta / a... | [
"0.679616",
"0.6638215",
"0.6590495",
"0.6576614",
"0.6443219",
"0.639986",
"0.63463664",
"0.6324459",
"0.6302295",
"0.62827724",
"0.6263374",
"0.61591303",
"0.6074",
"0.6056435",
"0.60091823",
"0.59917784",
"0.59866846",
"0.5982728",
"0.5965676",
"0.5937658",
"0.5929874",
... | 0.6318134 | 8 |
Return the split chunks along the given dimension. | def split(self, split_size_or_sections, dim=0):
return array_funcs.split(split_size_or_sections, dim) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_chunk_ranges(ds_dim, chunk_size):\n chunks = list(range(0, ds_dim, chunk_size))\n if chunks[-1] < ds_dim:\n chunks.append(ds_dim)\n else:\n chunks[-1] = ds_dim\n\n chunks = list(zip(chunks[:-1], chunks[1:]))\n\n return chunks",
"def split_multi(num_chunks: int, *dimensions: i... | [
"0.7299957",
"0.7068942",
"0.70300144",
"0.69376683",
"0.6933093",
"0.689406",
"0.6812022",
"0.6802046",
"0.67479354",
"0.67342865",
"0.66822404",
"0.66568893",
"0.6647183",
"0.6643342",
"0.664142",
"0.6624651",
"0.6547622",
"0.653881",
"0.6532067",
"0.6530341",
"0.6525675",
... | 0.7204776 | 1 |
Return a tensor with dimensions of size 1 removed. | def squeeze(self, dim=None):
return array_funcs.squeeze(self, dim) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsqueeze(self, dim):\n return array_funcs.unsqueeze(self, dim)",
"def unsqueeze_(self, dim):\n return array_funcs.unsqueeze(self, dim, self)",
"def squeeze_(self, dim=None):\n return array_funcs.squeeze(self, dim, self)",
"def strip_empty_space(x, size, **kwargs):\n\n img = vision_transform.... | [
"0.6518755",
"0.6503564",
"0.6175036",
"0.61619556",
"0.6084569",
"0.60669774",
"0.6004356",
"0.5963574",
"0.5961968",
"0.59522164",
"0.5941944",
"0.59256595",
"0.5915044",
"0.5902928",
"0.588069",
"0.58711445",
"0.5860142",
"0.58282876",
"0.5803393",
"0.57869005",
"0.5785706... | 0.62775993 | 2 |
Compute the sum value of elements along the given dimension. | def sum(self, dim=None, keepdim=False):
return array_funcs.sum(self, dim, keepdim) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(input, axis=None, dtype=None, keepdims=False, acc_dtype=None):\n\n out = elemwise.Sum(axis=axis, dtype=dtype, acc_dtype=acc_dtype)(input)\n\n if keepdims:\n out = makeKeepDims(input, out, axis)\n return out",
"def sum(self, axis=None, out=None, keepdim=None):\n return arithmetics.s... | [
"0.736622",
"0.7358757",
"0.73110753",
"0.72097856",
"0.7192838",
"0.70973754",
"0.70756847",
"0.7045815",
"0.7020592",
"0.699684",
"0.69528395",
"0.6900484",
"0.68972456",
"0.6873754",
"0.6867878",
"0.6847719",
"0.6845523",
"0.6838945",
"0.6826228",
"0.68231946",
"0.6773414"... | 0.7910089 | 0 |
Return a tensor with dimensions of size 1 inserted. | def unsqueeze(self, dim):
return array_funcs.unsqueeze(self, dim) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand_1st(x):\n return np.expand_dims(x, axis=0)",
"def combine_initial_dims_to_1d_or_2d(tensor: torch.Tensor) -> torch.Tensor:\n if tensor.dim() <= 2:\n return tensor\n else:\n return tensor.view(-1, tensor.size(-1))",
"def convert_to_1d_tensor(tensor, name=None):\n tensor = tf.co... | [
"0.6554875",
"0.654452",
"0.628223",
"0.6147567",
"0.6137286",
"0.61084354",
"0.61080545",
"0.60903966",
"0.60878986",
"0.6002814",
"0.59271836",
"0.5884809",
"0.5874794",
"0.58733237",
"0.58652735",
"0.58467233",
"0.58467233",
"0.58375996",
"0.5825473",
"0.5788812",
"0.57690... | 0.0 | -1 |
Adds parameter descriptions relevant to preprocess job flow to an object of class argparse.ArgumentParser. No return value. | def add_args(general_parser, output_parser, elastic=False):
if not elastic:
output_parser.add_argument(
'--nucleotides-per-input', type=int, required=False,
metavar='<int>',
default=100000000,
help='max nucleotides from input reads to a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arg_parser():\n import argparse\n return argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)",
"def create_argument_parser():\n return argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)",
"def AddToParser(self, parser):\n arg = parser... | [
"0.6578736",
"0.6574588",
"0.64700705",
"0.646161",
"0.6441843",
"0.6421917",
"0.6420071",
"0.63971436",
"0.6396577",
"0.6335949",
"0.63315135",
"0.6330433",
"0.6322191",
"0.63137436",
"0.6304168",
"0.62950534",
"0.6284349",
"0.6253989",
"0.6250885",
"0.62468266",
"0.6238371"... | 0.0 | -1 |
Given a node, finds the minimum value in the subtree of the node. | def minimum(self, node):
if not node:
return node
root = node
while root.left:
root = root.left
return root | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min(node):\n while node.left is not None:\n node = node.left\n return node",
"def _get_min_node(self, node):\n if node.left is None:\n return node\n return self._get_min_node(node.left)",
"def __getMin(self, node: Node) -> Union[int, float]:\n if node.leftC... | [
"0.830251",
"0.8278423",
"0.8272069",
"0.8227791",
"0.8216343",
"0.81632257",
"0.80710036",
"0.8032244",
"0.78901273",
"0.78634995",
"0.76218855",
"0.7556505",
"0.75294834",
"0.7516565",
"0.7514289",
"0.75116175",
"0.7509488",
"0.74470675",
"0.7419961",
"0.7412775",
"0.732008... | 0.81411767 | 6 |
Finds the node with the value equal to key. If right node exists, then find the leftmost node in the right subtree. Else, find the nearest ancestor (parent) whose left child is also an ancestor of the node. | def successor(self, key):
node = self.find(key=key)
if node.right:
return self.minimum(node=node.right)
parent = node.parent
while parent and parent.right == node:
node = parent
parent = parent.parent
return parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(self, key):\n root = self.root\n while root:\n if root.val == key:\n break\n elif root.val < key:\n root = root.left\n else:\n root = root.right\n return root",
"def search(self, key):\n if (self.ro... | [
"0.7798031",
"0.7723263",
"0.77155185",
"0.76146394",
"0.7529729",
"0.72840977",
"0.72730047",
"0.7223419",
"0.707696",
"0.70667964",
"0.6914082",
"0.68941414",
"0.68874794",
"0.68398356",
"0.67903775",
"0.6777912",
"0.6748362",
"0.6627283",
"0.6606926",
"0.6564273",
"0.65234... | 0.650554 | 21 |
Finds the node with the value equal to key. If left node exists, then find the rightmost node in the leftsubtree. Else, find the nearest ancestor (parent) whose right child is also an ancestor of the code. | def predecessor(self, key):
node = self.find(key=key)
if node.left:
return self.maximum(node=node.left)
parent = node.parent
while parent and parent.left == node:
node = parent
parent = parent.parent
return parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(self, key):\n root = self.root\n while root:\n if root.val == key:\n break\n elif root.val < key:\n root = root.left\n else:\n root = root.right\n return root",
"def search(self, key):\n if (self.ro... | [
"0.7608143",
"0.7479378",
"0.7477354",
"0.7364275",
"0.72595966",
"0.7220765",
"0.71416295",
"0.7070216",
"0.7053034",
"0.7017927",
"0.6994656",
"0.69580495",
"0.6811647",
"0.67801416",
"0.67554826",
"0.67509806",
"0.6660844",
"0.659524",
"0.65869004",
"0.6574997",
"0.6526693... | 0.61269873 | 40 |
Build a network that maps state > action values. | def forward(self, state):
return self.fcnet(state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _network_template(self, state):\n weights_initializer = slim.variance_scaling_initializer(\n factor=1.0 / np.sqrt(3.0), mode='FAN_IN', uniform=True)\n\n net = tf.cast(state, tf.float32)\n net = tf.subtract(net, tf.reduce_min(net))\n net = tf.div(net, tf.reduce_max(net))\n net = slim.conv2... | [
"0.63946366",
"0.63886064",
"0.63507026",
"0.6328887",
"0.6328887",
"0.63190526",
"0.62626165",
"0.6228537",
"0.6205531",
"0.61980116",
"0.61628056",
"0.6102542",
"0.6077717",
"0.6031706",
"0.60232824",
"0.59831923",
"0.59382755",
"0.5907368",
"0.5839515",
"0.5820617",
"0.582... | 0.0 | -1 |
Adds a song played when closed. | def addsongipod(self,song):
song['mbid'] = self.getMBID(song)
if song['duration'] < 30:
if song['mbid'] is None:
log.verb("\"%s\" by %s disqualified because the duration is less than 30 seconds" % (song['name'],song['artist']))
return
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(self, song):\n self.songs += [song]",
"def add_song(self, song, position=None):\r\n if position is None:\r\n self.track.append(song)\r\n else:\r\n self.track.insert(position, song)",
"def addSong(self, song, position=None):\n songFound = findObject... | [
"0.6916298",
"0.6456118",
"0.63221526",
"0.6202784",
"0.6056239",
"0.596579",
"0.5896358",
"0.5888195",
"0.58686996",
"0.5834784",
"0.5753177",
"0.5714074",
"0.56953543",
"0.5680296",
"0.56710064",
"0.566954",
"0.55704385",
"0.5560756",
"0.5515389",
"0.5508165",
"0.55008113",... | 0.5758262 | 10 |
Adds a song played when closed. | def addsongipodmanual(self,song):
if f.cacheadd(song.copy()):
self.songsqueued += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(self, song):\n self.songs += [song]",
"def add_song(self, song, position=None):\r\n if position is None:\r\n self.track.append(song)\r\n else:\r\n self.track.insert(position, song)",
"def addSong(self, song, position=None):\n songFound = findObject... | [
"0.6916298",
"0.6456118",
"0.63221526",
"0.6202784",
"0.6056239",
"0.596579",
"0.5896358",
"0.5888195",
"0.58686996",
"0.5834784",
"0.5758262",
"0.5753177",
"0.5714074",
"0.56953543",
"0.5680296",
"0.56710064",
"0.566954",
"0.55704385",
"0.5560756",
"0.5515389",
"0.5508165",
... | 0.54043937 | 32 |
Checks to see whether cache needs to be chunked. | def chunkcheck(self,songstosubmit):
log.info("%d song%s queued for submission" % (len(songstosubmit),self._pluralise(len(songstosubmit))))
if self.pausesubmissions:
return
success = True
chunked = self._chunkcache(songstosubmit)
if songstosubmit != chunked:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cachecheck(self):\n if os.path.isfile(os.path.join(main.mypath,\"iSproggler Cache.pkl\")):\n if len(self.cacheread()) > 0:\n return True\n return False",
"def is_cache_valid(self, state:URLState):\n # TODO Something more fancy?\n fetch_time = state[ST_FET... | [
"0.6642683",
"0.66005707",
"0.6561965",
"0.65161747",
"0.6441445",
"0.64333004",
"0.6366396",
"0.6252534",
"0.62223434",
"0.6206765",
"0.61321366",
"0.6127781",
"0.6064423",
"0.6061962",
"0.6020399",
"0.6017825",
"0.6000995",
"0.5932946",
"0.5903715",
"0.5875786",
"0.5864825"... | 0.58189994 | 23 |
Takes a list with dictionaries and returns them in smaller lists. | def _chunkcache(self,songs):
chunked = []
index = -1
maxlength = main.local['batchsize']
if len(songs) > maxlength:
counter = 0
for item in songs:
if counter == 0:
chunked.append([item])
index += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_dict2dict_list(list_dict):\n keys = list_dict[0].keys()\n dict_list = {}\n for key in keys:\n dict_list[key] = []\n for dict in list_dict:\n for key in keys:\n dict_list[key].append(dict[key])\n return(dict_list)",
"def dedup_dicts(list_of_dicts: List[Dict]) -> Li... | [
"0.72603637",
"0.7182254",
"0.71769303",
"0.7080435",
"0.6931896",
"0.69015485",
"0.68880475",
"0.6727985",
"0.6574167",
"0.65472007",
"0.6533737",
"0.6514146",
"0.6463767",
"0.6442392",
"0.6426045",
"0.6420991",
"0.641518",
"0.6341676",
"0.63394254",
"0.63248515",
"0.6237721... | 0.0 | -1 |
Return true if cache is populated. | def cachecheck(self):
if os.path.isfile(os.path.join(main.mypath,"iSproggler Cache.pkl")):
if len(self.cacheread()) > 0:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_cache(self):\n\n return self._cache.has_items()",
"def hasCache(self):\n return bool(self.cached == self.__class__.CACHED)",
"def is_cached(self):\n return self.promise._deliver_from_cache()",
"def cache_is_valid(self):\n return True",
"def IsCacheable(self):\n return... | [
"0.8199942",
"0.80329955",
"0.7771027",
"0.7547551",
"0.74379444",
"0.73604214",
"0.72332",
"0.7128631",
"0.7118243",
"0.70872086",
"0.70864785",
"0.708182",
"0.7069887",
"0.70371604",
"0.6998794",
"0.6988465",
"0.6964978",
"0.6948407",
"0.69313985",
"0.6929833",
"0.68986315"... | 0.7481299 | 4 |
Changes the player's volume | async def volume(self, ctx, volume: int):
if ctx.voice_client is None:
return await ctx.send("Not connected to a voice channel.")
ctx.voice_client.source.volume = volume / 100
await ctx.send("Changed volume to {}%".format(volume)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_volume(self, volume):\n\t\tself._player.set_volume(volume)",
"def volume(self, new_value: float):\n self._player.volume = new_value",
"def set_volume(self, volume: int) -> None:\n self.player.setVolume(volume)",
"def setVolume(self, v):\r\n if self._audio_stream_player:\r\n ... | [
"0.8530771",
"0.8452739",
"0.8415957",
"0.8124036",
"0.8121699",
"0.8089574",
"0.80675906",
"0.8067533",
"0.8067533",
"0.8003992",
"0.7967711",
"0.79283386",
"0.7908185",
"0.78231335",
"0.7782036",
"0.77661103",
"0.7732492",
"0.7648053",
"0.76423556",
"0.76380855",
"0.7631826... | 0.8161477 | 4 |
Compute the axis from actual data | def to_axis(
self, data: Data, kinematic_chain: BiomechanicalModelReal, parent_scs: SegmentCoordinateSystemReal = None
) -> AxisReal:
start = self.start.to_marker(data, kinematic_chain, parent_scs)
end = self.end.to_marker(data, kinematic_chain, parent_scs)
return AxisReal(self.name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axis(self):\n return self._axis",
"def axis(self):\n return self._axis",
"def get_axis(self, axis_name) :\n \n if isinstance(axis_name, int) :\n axis_name = self.axes[axis_name]\n len = self.shape[self.axes.index(axis_name)]\n return (self.info[axis_name + '_del... | [
"0.74885315",
"0.74885315",
"0.7167772",
"0.7147158",
"0.68553793",
"0.6768928",
"0.6628649",
"0.64082783",
"0.63654673",
"0.63102514",
"0.6301522",
"0.61812055",
"0.61727834",
"0.6100017",
"0.6087195",
"0.60617644",
"0.5979507",
"0.59512866",
"0.5951036",
"0.59505725",
"0.59... | 0.0 | -1 |
Utility function to make json encoded data an ascii string | def _unicode_to_str(data):
if isinstance(data, dict):
return {_unicode_to_str(key): _unicode_to_str(value) for key, value in data.iteritems()}
elif isinstance(data, list):
return [_unicode_to_str(element) for element in data]
elif isinstance(data, unicode):
return data.encode('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_encode_legible_to_str(data):\n return _READABLE_ENCODER.encode(data)",
"def _json(data):\n\tjson_str = json.dumps(data)\n\n\t# Escape all the XML/HTML special characters.\n\tescapes = [\"<\", \">\", \"&\"]\n\tfor c in escapes:\n\t\tjson_str = json_str.replace(c, r\"\\u%04x\" % (ord(c)))\n\n\treturn m... | [
"0.77356243",
"0.7602884",
"0.7475244",
"0.713915",
"0.71188676",
"0.70729685",
"0.705095",
"0.7034658",
"0.6929124",
"0.68265796",
"0.68158174",
"0.6801809",
"0.679064",
"0.6788829",
"0.67065465",
"0.6699847",
"0.66969514",
"0.661738",
"0.66024965",
"0.65761673",
"0.6569454"... | 0.0 | -1 |
Onehot encodes a single word given its index and the size of the vocabulary. | def one_hot_encode(idx, vocab_size):
# Initialize the encoded array
one_hot = np.zeros(vocab_size)
# Set the appropriate element to one
one_hot[idx] = 1.0
return one_hot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(self, word_idx):\n # Check if the given index is from the word_idx dictionary\n if word_idx > self.num_words - 1:\n raise ValueError(\n 'Tokenizer cannot encode the given index. The index {} is not recognized as being one of the '\n 'tokenizer word... | [
"0.81430495",
"0.7764963",
"0.7741862",
"0.76275134",
"0.7567708",
"0.750775",
"0.7425988",
"0.7348269",
"0.7310543",
"0.71602345",
"0.7072354",
"0.70364785",
"0.70304084",
"0.69835633",
"0.69832104",
"0.6951622",
"0.6846314",
"0.6839901",
"0.6838384",
"0.68192214",
"0.681800... | 0.8516595 | 0 |
Onehot encodes a sequence of words given a fixed vocabulary size. | def one_hot_encode_sequence(sequence, vocab_size, word_to_idx):
# Encode each word in the sentence
encoding = np.array([one_hot_encode(word_to_idx[word], vocab_size) for word in sequence])
# Reshape encoding s.t. it has shape (num words, vocab size, 1)
encoding = encoding.reshape(encoding.shape[0], enc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(idx, vocab_size):\n # Initialize the encoded array\n one_hot = np.zeros(vocab_size)\n \n # Set the appropriate element to one\n one_hot[idx] = 1.0\n\n return one_hot",
"def one_hot_encode_target(outputs, vocab_size):\n one_hot = np.zeros((len(outputs), len(outputs[0]), voc... | [
"0.8067221",
"0.76654977",
"0.76602185",
"0.7472814",
"0.73155",
"0.7295163",
"0.7282555",
"0.7269112",
"0.72493684",
"0.7208576",
"0.71703106",
"0.71538395",
"0.7130539",
"0.7110059",
"0.7103714",
"0.7095316",
"0.7045931",
"0.70238835",
"0.702245",
"0.70199466",
"0.7009964",... | 0.7891146 | 1 |
If the vertex "vertex" is not in self.__graph_dict, a key "vertex" with an empty list as a value is added to the dictionary. Otherwise nothing has to be done. | def add_vertex(self, vertex):
if vertex not in self.__graph_dict:
self.__graph_dict[vertex] = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n\n #here if the vertex is not present,\n #then it is initialized with an empty list\n #and is added as a key to the graph dict\n #and thus gets added to the graph\n if vertex not in self.graph_dict:\n self.graph_dict[vertex] = []",
"def... | [
"0.8648912",
"0.86211133",
"0.8323919",
"0.8224421",
"0.7500994",
"0.7298097",
"0.7244151",
"0.7072806",
"0.70220387",
"0.7009911",
"0.69918215",
"0.69221795",
"0.69197226",
"0.6919191",
"0.6808032",
"0.68017465",
"0.67932254",
"0.67774785",
"0.67737794",
"0.6749403",
"0.6740... | 0.8586963 | 3 |
Remove session content_type because we want to delete the session model in the next step. | def remove_session_content_type(apps, schema_editor):
# We get the model from the versioned app registry;
# if we directly import it, it will be the wrong version.
ContentType = apps.get_model("contenttypes", "ContentType")
Session = apps.get_model("core", "Session")
ContentType.objects.get_for_mode... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clearSession(self):\n session.pop('qid', None)\n session.pop('_csrf_token', None)",
"def remove_form_data_from_session(self):\n if self.form_class.__name__ in session.checker:\n del session.checker[self.form_class.__name__]",
"def delete_session():\n pass",
"def clear(self, ses... | [
"0.61529076",
"0.6068619",
"0.6015527",
"0.5853737",
"0.5834703",
"0.57703286",
"0.57676214",
"0.57596666",
"0.575534",
"0.56773734",
"0.5634709",
"0.5557519",
"0.55147594",
"0.54660696",
"0.5459363",
"0.5444747",
"0.5437499",
"0.5413968",
"0.54063714",
"0.538391",
"0.5338656... | 0.82586837 | 0 |
Grab a random subset from arr1 and arr2. The subset is from the same area in both arr1 and arr2. | def grab_random_subset(arr1, arr2, subset_dim, orient=True):
if arr1.shape != arr2.shape:
raise ValueError('Array shapes have to be the same')
# Choose a random subset
row_start = np.random.randint(0, arr1.shape[0] - subset_dim[0])
col_start = np.random.randint(0, arr1.shape[1] - subset_dim[1])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomize_data(arr_a, arr_b):\n for ix in range(0, len(arr_a)-1):\n j = random.randint(ix+1, len(arr_a)-1)\n __swap(ix, j, arr_a)\n __swap(ix, j, arr_b)",
"def informed_random_mapping(size1, size2, dm1, dm2):\n #global dm1, dm2\n mapping12 = -np.ones(size1, dtype=np.int)\n so... | [
"0.6740685",
"0.6369193",
"0.6260659",
"0.62241536",
"0.62074924",
"0.61226135",
"0.6100613",
"0.607733",
"0.6025842",
"0.6001359",
"0.59908986",
"0.59700006",
"0.59585184",
"0.5931638",
"0.59215",
"0.5902411",
"0.58148265",
"0.57468206",
"0.57126766",
"0.5676866",
"0.5662555... | 0.81886446 | 0 |
Renders the home page. | def home():
return render_template(
'index.html',
title='Home Page',
year=datetime.now().year,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\treturn render_template('home.html')",
"def home():\n return render_template(\n 'home.html',\n title='Home Page',\n )",
"def home():\r\n return render_template('home.html')",
"def home():\r\n return render_template(\"home.html\")",
"def home():\n\n return render_t... | [
"0.8605755",
"0.8495015",
"0.8452865",
"0.84418297",
"0.83532524",
"0.83532524",
"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.8061255 | 48 |
Renders the contact page. | def contact():
return render_template(
'contact.html',
title='Contact',
year=datetime.now().year,
message='Your contact page.'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact():\n return render_template(\"contact.html\")",
"def contact():\n return render_template(\"home/contact.html\")",
"def contact():\r\n return render_template(\r\n 'contact.html',\r\n title='Contact',\r\n year=datetime.now().year,\r\n message='Your contact page.'\... | [
"0.8325958",
"0.82439756",
"0.8212342",
"0.8212342",
"0.8172992",
"0.8172992",
"0.8051458",
"0.8005288",
"0.79718024",
"0.79118836",
"0.7901152",
"0.78097415",
"0.7809068",
"0.77874994",
"0.77312005",
"0.7640753",
"0.76210904",
"0.760557",
"0.75893056",
"0.755838",
"0.755838"... | 0.8185291 | 12 |
Renders the about page. | def about():
return render_template(
'about.html',
title='About',
year=datetime.now().year,
message='Your application description page.'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\"about.html\")",
"def about():\n about_template = templates_lookup.get_template('about.html')\n return about_template.render(active_page='about')",
"def about():\n\n return render_template('about_page/about.html')",
"def about():\n\n return render_tem... | [
"0.85373485",
"0.842411",
"0.841022",
"0.83836156",
"0.8296103",
"0.82935613",
"0.82935613",
"0.82837594",
"0.82837594",
"0.8260304",
"0.8248251",
"0.8224137",
"0.8224137",
"0.8217449",
"0.8211058",
"0.8205582",
"0.8193239",
"0.8173699",
"0.8173699",
"0.8122126",
"0.8119327",... | 0.82709616 | 18 |
Creates StringIO for results storage. | def __init__(self):
self.__io_str = StringIO() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_file(my_data):\n\tfile = StringIO()\n\tcsv_writer = csv.writer(file)\n\tcsv_writer.writerows(my_data)\n\treturn file.getvalue()",
"def to_StringIO(self):\n result = io.StringIO()\n result.write(\"2DX V2.1\")\n result.write(\"---\")\n result.write(yaml.dump(self.metadata))\... | [
"0.6105563",
"0.5771147",
"0.5761895",
"0.5745855",
"0.56144756",
"0.5547333",
"0.54300725",
"0.5378875",
"0.5364464",
"0.53027093",
"0.5283734",
"0.52832353",
"0.52513033",
"0.5232546",
"0.5216666",
"0.52115965",
"0.5193561",
"0.51239985",
"0.5106503",
"0.5105173",
"0.510035... | 0.64012456 | 0 |
Returns current value of the Stream. | def get_value(self):
return self.__io_str.getvalue() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getvalue(self):\n if callable(getattr(self.stream, 'getvalue', None)):\n return self.stream.getvalue()",
"def read(self):\n return self.current_value",
"def value(self):\n if hasattr(self, '_m_value'):\n return self._m_value if hasattr(self, '_m_va... | [
"0.8342635",
"0.80107075",
"0.74946386",
"0.74946386",
"0.74454427",
"0.74128836",
"0.7401489",
"0.7396765",
"0.73735374",
"0.7326768",
"0.7301341",
"0.7286028",
"0.7239735",
"0.7127842",
"0.71206486",
"0.7081661",
"0.6971363",
"0.69689",
"0.69091827",
"0.6826245",
"0.6800234... | 0.71414983 | 13 |
Return the FLUX HDU header from any CFRAME file at this path. | def get_hdr(path):
for (CFRAME,), camera, spec in iterspecs(path, 'cframe'):
return CFRAME['FLUX'].read_header() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_header(filename_hdu, ext=0):\n if isinstance(filename_hdu, fits.Header):\n header = filename_hdu\n else:\n with fits.open(filename_hdu) as hdul:\n header = hdul[ext].header\n return header",
"def get_c_header_filename(self):\n return self.wrap_directory.file(\"mad... | [
"0.67457455",
"0.67209363",
"0.6689182",
"0.64710706",
"0.64688474",
"0.64622164",
"0.638921",
"0.63497406",
"0.62383914",
"0.6217047",
"0.61958873",
"0.60463566",
"0.5973048",
"0.59688544",
"0.59588605",
"0.5954391",
"0.59138846",
"0.5862809",
"0.5846362",
"0.58448607",
"0.5... | 0.83651453 | 0 |
Returns the gaussian sum of x. | def gaussian_sum(x):
return x * (x + 1) / 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian(x, mu, sig):\n\treturn 1 / (sig * np.sqrt(2 * np.pi)) * np.exp((-1 / 2) * ((x - mu) / sig)**2)",
"def gaussian(x, mu=0.0, sigma=1.0):\n return 1.0/np.sqrt(2*np.pi*sigma**2) * np.exp(-(x-mu)**2/(2*sigma**2))",
"def gaussian(x, sigma, x0=0):\n return 1/(sigma*np.sqrt(2*np.pi)) \\\n * np... | [
"0.7709479",
"0.7483577",
"0.74735844",
"0.74151534",
"0.73928666",
"0.7392764",
"0.7371637",
"0.73368007",
"0.7322917",
"0.7315067",
"0.73067683",
"0.7290587",
"0.72689104",
"0.72265124",
"0.7214543",
"0.7171626",
"0.7168042",
"0.7145232",
"0.71175593",
"0.71128505",
"0.7089... | 0.905271 | 0 |
Returns True if the rewind attempt succeeded. | def attempt_rewind_with_previous_token_and_retry_index(
self, retry_index:int, previous_token:Token, token:Token, sentence_deque:deque,
token_indexes_without_coordination_to_mention_sets:dict,
token_indexes_with_coordination_to_mention_sets:dict) -> bool:
doc = token.doc
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance(self):\n status = -1\n try:\n # note: in streaming mode releases the current_step\n # note: no effect in file based engines\n self.fh.end_step()\n self.stream = self.fh.__next__()\n status = self.current_step()\n except StopIte... | [
"0.5996449",
"0.57031125",
"0.56826437",
"0.5575485",
"0.55714625",
"0.55664396",
"0.5546565",
"0.54948026",
"0.5490671",
"0.54827285",
"0.5473113",
"0.5458096",
"0.5451097",
"0.5449867",
"0.54416615",
"0.5429032",
"0.5422817",
"0.5415077",
"0.5389955",
"0.5389955",
"0.536473... | 0.50511414 | 44 |
Returns the certificate byte arrays and declarations | def full_cert_arrays(cert_file: str, array_name: str) -> tuple[str, str]:
with open(cert_file, "rb") as infile:
b = infile.read()
cert = make_c_array(b, array_name, 21)
header = make_array_header(b, array_name)
return [header, cert] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_arrays(self) -> tuple[str, str]:\n return full_cert_arrays(self.own.cert_file_name, self.own.cert_array_name)",
"def extractCert():\n \n lib = '/usr/local/lib/libpteidpkcs11.so'\n pkcs11 = PyKCS11.PyKCS11Lib()\n pkcs11.load(lib)\n slots = pkcs11.getSlotList()\n backend = default... | [
"0.6672388",
"0.66346264",
"0.6542581",
"0.641003",
"0.63227725",
"0.6254038",
"0.62206465",
"0.6162534",
"0.60756874",
"0.58770317",
"0.58721495",
"0.5867138",
"0.58629143",
"0.57812065",
"0.57186764",
"0.5703921",
"0.5703921",
"0.5681777",
"0.5674926",
"0.56478",
"0.5629543... | 0.65975946 | 2 |
The gradient is given by [f(2x) f(0)] / (2 sin(x)), by subsituting shift = x into the two term parametershift rule. | def grad_recipe(self):
x = self.data[0]
c = 0.5 / np.sin(x)
return ([[c, 0.0, 2 * x], [-c, 0.0, 0.0]],) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gradient(self, x):\n return 2 * x - 2",
"def shakeshake2_grad(x1, x2, dy):\n y = shakeshake2_py(x1, x2)\n dx = tf.gradients(ys=[y], xs=[x1, x2], grad_ys=[dy])\n return dx",
"def second_order_param_shift(tape, dev_wires, argnum=None, shifts=None, gradient_recipes=None):\r\n argnum = argnum or l... | [
"0.650708",
"0.6338716",
"0.61751425",
"0.61122954",
"0.60389286",
"0.5913216",
"0.58423644",
"0.5825937",
"0.5795031",
"0.5779959",
"0.5760299",
"0.5727092",
"0.5723352",
"0.5712639",
"0.5709188",
"0.5708782",
"0.5665057",
"0.5638223",
"0.56274045",
"0.5622009",
"0.5621184",... | 0.0 | -1 |
Tests a qubit Hermitian observable that is not involutory alongside an involutory observable when there's a single trainable parameter. | def test_involutory_and_noninvolutory_variance_single_param(self):
shot_vec = tuple([1000000] * 3)
dev = qml.device("default.qubit", wires=2, shots=shot_vec)
a = 0.54
_herm_shot_vec_tol = shot_vec_tol * 100
with qml.queuing.AnnotatedQueue() as q:
qml.RX(a, wires=0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_hermitian(self):\n\n class DummyObserv(qml.operation.Observable):\n r\"\"\"Dummy custom observable\"\"\"\n num_wires = 1\n grad_method = None\n\n op = DummyObserv(wires=0)\n assert op.is_hermitian is True",
"def test_invalid_input_for__or__():\n ... | [
"0.5865004",
"0.57914877",
"0.5772961",
"0.5771065",
"0.5756398",
"0.57231545",
"0.5714427",
"0.5701555",
"0.5697289",
"0.5688089",
"0.56708586",
"0.5650162",
"0.56444997",
"0.56301636",
"0.56015813",
"0.5585372",
"0.554531",
"0.55427104",
"0.5535253",
"0.55302685",
"0.551719... | 0.5855056 | 1 |
Tests a qubit Hermitian observable that is not involutory alongside an involutory observable and probs when there's one trainable parameter. | def test_var_and_probs_single_param(self, ind):
shot_vec = many_shots_shot_vector
dev = qml.device("default.qubit", wires=4, shots=shot_vec)
a = 0.54
x = 0.543
y = -0.654
with qml.queuing.AnnotatedQueue() as q:
# Ops influencing var res
qml.RX(a,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_has_observed(self):\n algo = self.create_algo()\n\n a = algo.suggest(1)[0]\n assert not algo.has_observed(a)\n backward.algo_observe(algo, [a], [dict(objective=1)])\n assert algo.has_observed(a)\n\n b = algo.suggest(1)[0]\n assert not algo.has_observed(b)\n... | [
"0.6060475",
"0.58879304",
"0.584468",
"0.58327824",
"0.5805119",
"0.5784519",
"0.5740901",
"0.57299644",
"0.5727883",
"0.5725212",
"0.57155424",
"0.5714978",
"0.57101977",
"0.5707062",
"0.5681654",
"0.5663963",
"0.562654",
"0.5623006",
"0.5617148",
"0.56098104",
"0.5602873",... | 0.54838073 | 27 |
Test that the transform output shape matches that of the QNode. | def test_output_shape_matches_qnode_expval(self, cost, expected_shape):
shot_vec = many_shots_shot_vector
dev = qml.device("default.qubit", wires=4, shots=shot_vec)
x = np.random.rand(3)
circuit = qml.QNode(cost, dev)
all_res = qml.gradients.param_shift(circuit)(x)
asse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_output_shape_matches_qnode_probs(self, cost, expected_shape):\n shot_vec = many_shots_shot_vector\n dev = qml.device(\"default.qubit\", wires=4, shots=shot_vec)\n\n x = np.random.rand(3)\n circuit = qml.QNode(cost, dev)\n\n all_res = qml.gradients.param_shift(circuit)(x)... | [
"0.7055539",
"0.65714777",
"0.6444881",
"0.63800406",
"0.6363838",
"0.6213509",
"0.6030272",
"0.6030272",
"0.5951875",
"0.5936601",
"0.59111696",
"0.5900128",
"0.5887873",
"0.58684635",
"0.58524823",
"0.5826713",
"0.5815576",
"0.57687503",
"0.57609886",
"0.5756236",
"0.575056... | 0.67298627 | 1 |
Test that the transform output shape matches that of the QNode. | def test_output_shape_matches_qnode_probs(self, cost, expected_shape):
shot_vec = many_shots_shot_vector
dev = qml.device("default.qubit", wires=4, shots=shot_vec)
x = np.random.rand(3)
circuit = qml.QNode(cost, dev)
all_res = qml.gradients.param_shift(circuit)(x)
asser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_output_shape_matches_qnode_expval(self, cost, expected_shape):\n shot_vec = many_shots_shot_vector\n dev = qml.device(\"default.qubit\", wires=4, shots=shot_vec)\n\n x = np.random.rand(3)\n circuit = qml.QNode(cost, dev)\n\n all_res = qml.gradients.param_shift(circuit)(x... | [
"0.67298627",
"0.65714777",
"0.6444881",
"0.63800406",
"0.6363838",
"0.6213509",
"0.6030272",
"0.6030272",
"0.5951875",
"0.5936601",
"0.59111696",
"0.5900128",
"0.5887873",
"0.58684635",
"0.58524823",
"0.5826713",
"0.5815576",
"0.57687503",
"0.57609886",
"0.5756236",
"0.57505... | 0.7055539 | 0 |
Sets the size of this IOverrideDefaultFragmentSetting. | def size(self, size):
self._size = size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_size(self, size):\n pass",
"def setSize(self, size, needReset=True, log=None):\r\n self._needReset = needReset\r\n setAttribute(self, 'size', size, log)",
"def set_size(self, arg):\n self.mod[\"size\"]= arg.size",
"def setSize(self, size):\n origin = self.getOrigin(... | [
"0.6934787",
"0.6364614",
"0.6312848",
"0.631004",
"0.62956756",
"0.62954247",
"0.6123823",
"0.6092942",
"0.60899866",
"0.60899866",
"0.60885215",
"0.6084356",
"0.5972431",
"0.595508",
"0.59385353",
"0.5916786",
"0.589779",
"0.5859525",
"0.5845307",
"0.58431816",
"0.58244616"... | 0.603367 | 16 |
Returns the string representation of the model | def to_str(self):
return pprint.pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8602374",
"0.85093755",
"0.8237104",
"0.8050309",
"0.80128866",
"0.79348034",
"0.78766525",
"0.77898884",
"0.7786461",
"0.7745792",
"0.7627315",
"0.76055235",
"0.757999",
"0.7514394",
"0.75038797",
"0.75035286",
"0.74850684",
"0.7440529",
"0.74325883",
"0.74239755",
"0.740... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
DB 'with' destructor kills the DB connection | def __exit__(self, exc_type, exc_value, traceback):
self._db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __del__(self):\n\n if hasattr(self, \"db\"): # Else failed to __init__\n self.db.close()",
"def __del__(self):\n if self.db:\n self.db.close()",
"def __del__(self):\n if self.db:\n self.db.close()",
"def __del__(self):\n self.closeDB()",
"de... | [
"0.78746843",
"0.7867349",
"0.7867349",
"0.7725828",
"0.7679894",
"0.7560824",
"0.7267333",
"0.7230199",
"0.721667",
"0.72158045",
"0.71686673",
"0.7161989",
"0.7145729",
"0.71413326",
"0.71392846",
"0.713819",
"0.7132277",
"0.71096355",
"0.70910925",
"0.70910925",
"0.7082395... | 0.69659114 | 36 |
returns True if symbols right of dot is a non terminal | def headNonTerminal(self):
if self.dot==len(self.rhs):
return False
else:
return self.rhs[self.dot][0].isupper() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _has_dot(self, tokens):\n return '.' in tokens",
"def test_dot(self):\n self.assertIn(b'.', self.f)\n self.assertIn('.', self.f)",
"def is_dotted(self) -> bool:\n return self._dotted",
"def terminal(node):\n return node[L] == ''",
"def IsNonDots(self):\n return self.ba... | [
"0.71812546",
"0.65559214",
"0.6533662",
"0.64364743",
"0.639161",
"0.63511133",
"0.6144148",
"0.61087984",
"0.60623384",
"0.59956795",
"0.5992309",
"0.59752095",
"0.5974467",
"0.59559274",
"0.5933477",
"0.593147",
"0.5888119",
"0.5882247",
"0.5860111",
"0.5848911",
"0.584464... | 0.6468107 | 3 |
Test that template_file and raw_template traitlets play nicely together. source assigns template_file default first, then raw_template checks that the raw_template overrules template_file if set checks that once raw_template is set to '', template_file returns | def test_raw_template_init(self):
nb = v4.new_notebook()
nb.cells.append(v4.new_code_cell("some_text"))
class AttrExporter(RSTExporter):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.raw_template = raw_template
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testValidSimpleTemplateFile(self):\n\n # load template\n self.tr.loadFromPath(os.path.join(self.fixpath,\"%s.tmpl\" % self.tname))\n self.assertTrue(self.tname in self.tr)\n\n # check template class\n tcls=self.tr[self.tname]\n self.assertTrue(issubclass(tcls,Template))\n\n # check generat... | [
"0.7005305",
"0.6740481",
"0.6739448",
"0.6560521",
"0.65295786",
"0.6427371",
"0.6424887",
"0.6389961",
"0.63654923",
"0.635627",
"0.63376194",
"0.6324295",
"0.63116944",
"0.6269442",
"0.62619185",
"0.6170663",
"0.6111647",
"0.6065947",
"0.6040745",
"0.59611",
"0.5892527",
... | 0.67260003 | 3 |
Test that template_file and raw_template traitlets play nicely together. source assigns template_file default first, then raw_template checks that the raw_template overrules template_file if set checks that once raw_template is set to '', template_file returns | def test_raw_template_dynamic_attr(self):
nb = v4.new_notebook()
nb.cells.append(v4.new_code_cell("some_text"))
class AttrDynamicExporter(TemplateExporter):
@default("default_template_file")
def _template_file_default(self):
return "index.rst.j2"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testValidSimpleTemplateFile(self):\n\n # load template\n self.tr.loadFromPath(os.path.join(self.fixpath,\"%s.tmpl\" % self.tname))\n self.assertTrue(self.tname in self.tr)\n\n # check template class\n tcls=self.tr[self.tname]\n self.assertTrue(issubclass(tcls,Template))\n\n # check generat... | [
"0.700398",
"0.674061",
"0.67377037",
"0.6724966",
"0.6560864",
"0.6528227",
"0.6426751",
"0.64249367",
"0.6389005",
"0.6364469",
"0.63545066",
"0.63367903",
"0.63231224",
"0.6311413",
"0.62696177",
"0.62614876",
"0.6110339",
"0.6066319",
"0.6041556",
"0.5961148",
"0.5892194"... | 0.6169503 | 16 |
Test that template_file and raw_template traitlets play nicely together. source assigns raw_template default first, then template_file checks that the raw_template overrules template_file if set checks that once raw_template is set to '', template_file returns | def test_raw_template_dynamic_attr_reversed(self):
nb = v4.new_notebook()
nb.cells.append(v4.new_code_cell("some_text"))
class AttrDynamicExporter(TemplateExporter):
@default("raw_template")
def _raw_template_default(self):
return raw_template
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testValidSimpleTemplateFile(self):\n\n # load template\n self.tr.loadFromPath(os.path.join(self.fixpath,\"%s.tmpl\" % self.tname))\n self.assertTrue(self.tname in self.tr)\n\n # check template class\n tcls=self.tr[self.tname]\n self.assertTrue(issubclass(tcls,Template))\n\n # check generat... | [
"0.7032614",
"0.677359",
"0.6763489",
"0.67156535",
"0.6562122",
"0.6558637",
"0.6497334",
"0.6438314",
"0.6426071",
"0.6400248",
"0.63957125",
"0.6392551",
"0.63255924",
"0.6313432",
"0.6270449",
"0.6270072",
"0.61414176",
"0.61072963",
"0.60977155",
"0.60366565",
"0.5973047... | 0.5680046 | 50 |
Create and finalize a TF graph including ops | def create_tf_ops(data_dict=None,
model_type='mlp',
n_outputs=2,
init_lr=0.001,
l2_reg=1e-3,
batch_size=32):
dataset_dict = create_batch_tf_dataset(data_dict,
batch_size=batch_size)
tra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tf_graph(layers=1):\n\n # setup placeholder for network input\n net_input = tf.placeholder(tf.float32, shape=[None, 64, 64, 1])\n\n # setup layers\n conv_stack, _ = setup_conv_layers(layers, net_input)\n pool0 = tf.layers.max_pooling2d(inputs=conv_stack, pool_size=(2, 2), strides=2, name=... | [
"0.67643607",
"0.6575144",
"0.65216964",
"0.65165323",
"0.65022737",
"0.64587957",
"0.6435875",
"0.64027894",
"0.63473284",
"0.6346969",
"0.6330194",
"0.62787646",
"0.6261689",
"0.62240636",
"0.6223322",
"0.62163156",
"0.62005794",
"0.61655027",
"0.61631525",
"0.6155058",
"0.... | 0.6339424 | 10 |
Create a summary writer logging to log_dir. | def __init__(self, log_dir, task_name):
self.writer = tf.summary.create_file_writer(log_dir)
"""Create a file writter logging to .log"""
self.logger = logging.getLogger("VAE")
self.logger.setLevel(logging.DEBUG)
if not self.logger.handlers:
fh = logging.FileHandler(f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_summary_writer(log_dir):\n if not os.path.exists(log_dir):\n os.makedirs(log_dir)\n log_dir = os.path.join(log_dir, datetime.now().strftime('%m-%d_%H-%M-%S'))\n if not os.path.exists(log_dir):\n os.mkdir(log_dir)\n writer = SummaryWriter(log_dir, max_queue=3, flush_secs=10)\n\n... | [
"0.87329197",
"0.7834896",
"0.7596309",
"0.75817883",
"0.7565108",
"0.743666",
"0.7149351",
"0.7149351",
"0.7149351",
"0.7149351",
"0.7094658",
"0.68956393",
"0.6762742",
"0.6742876",
"0.6722066",
"0.6685269",
"0.65616673",
"0.64830863",
"0.6414361",
"0.6411645",
"0.638577",
... | 0.60045385 | 29 |
Cause all gameobjects in group to accelerate downwards. | def apply_gravity(group):
for go in group.sprites():
go.speed += config["physics"]["gravity"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_up(self):\n if self.top_index > 0:\n self.top_index -= 1",
"def move_up(self):\n pass",
"def move_stage_out(self):\n\n self.z.move([0,0,0])\n self.x.move(self.x.home)\n self.y.move(self.y.min_y)",
"def shiftDown(self):\n if self.gear > 0:\n ... | [
"0.5797885",
"0.57462704",
"0.5677965",
"0.564974",
"0.5633496",
"0.55515516",
"0.5518107",
"0.550478",
"0.54698044",
"0.5455724",
"0.54526657",
"0.5421164",
"0.5410773",
"0.5410773",
"0.5408661",
"0.53930837",
"0.53852046",
"0.5368667",
"0.5362874",
"0.5340202",
"0.5340202",... | 0.6051654 | 0 |
Handler for how to respond when sprites collide. | def handle_collisions(player, terrain):
# If the player has collided with an impassable object, stop player movement
for barrier in pygame.sprite.spritecollisions(player, terrain, False):
pass # TODO: HTF do I reliably detect which side collided? | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_collide(self):\n for fireball in self.overlapping_sprites:\n fireball.handle_collide()",
"def collide_with_player(self, player):\n pass",
"def collision(*args, **kwargs):\n return True",
"def handleCollision(self):\n self._ranInto = True",
"def enemy_col... | [
"0.7359975",
"0.71052516",
"0.70081615",
"0.691739",
"0.6833421",
"0.6789164",
"0.6733623",
"0.661666",
"0.6583949",
"0.6551175",
"0.65373814",
"0.65373814",
"0.6500485",
"0.64476943",
"0.63858926",
"0.63779426",
"0.6374122",
"0.6374122",
"0.63034225",
"0.6261382",
"0.6197424... | 0.62515193 | 20 |
The region that the block storage volume will be created in. | def region(self) -> pulumi.Input[Union[str, 'Region']]:
return pulumi.get(self, "region") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_region(self):\n return self.region",
"def region(self):\n return self.__region",
"def get_region():\n if bb.aws.region is None:\n __init_region()\n log.debug('Return region: %s', bb.aws.region)\n return bb.aws.region",
"def get_region(self):\n return self._region"... | [
"0.75236124",
"0.751784",
"0.74683976",
"0.7394339",
"0.738957",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73057735",
"0.73057735",
"0.73057735",
"0.73057735",
"0.7240098",
"0.7199243",
"0.71031326",
"0.... | 0.66082764 | 65 |
Filesystem label for the block storage volume. | def filesystem_label(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "filesystem_label") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filesystem_label(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"filesystem_label\")",
"def volume_name(self):\n return self._volume_name",
"def volume_name(self):\n return self._volume_name",
"def volume_name(self):\n return self._volume_name",
"def initial_filesys... | [
"0.7661525",
"0.67097735",
"0.67097735",
"0.67097735",
"0.6707923",
"0.66319436",
"0.6580506",
"0.6577158",
"0.6536779",
"0.6536779",
"0.65248865",
"0.64563835",
"0.64558154",
"0.6369871",
"0.6250002",
"0.6132799",
"0.60955685",
"0.60488427",
"0.60488427",
"0.5830856",
"0.582... | 0.74383193 | 1 |
The region that the block storage volume will be created in. | def region(self) -> Optional[pulumi.Input[Union[str, 'Region']]]:
return pulumi.get(self, "region") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_region(self):\n return self.region",
"def region(self):\n return self.__region",
"def get_region():\n if bb.aws.region is None:\n __init_region()\n log.debug('Return region: %s', bb.aws.region)\n return bb.aws.region",
"def get_region(self):\n return self._region"... | [
"0.75236124",
"0.751784",
"0.74683976",
"0.7394339",
"0.738957",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73057735",
"0.73057735",
"0.73057735",
"0.73057735",
"0.7240098",
"0.7199243",
"0.71031326",
"0.... | 0.6599391 | 66 |
The uniform resource name for the volume. | def volume_urn(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "volume_urn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_name(self):\n return self._volume_name",
"def volume_name(self):\n return self._volume_name",
"def volume_name(self):\n return self._volume_name",
"def volume_name(self) -> Optional[str]:\n return pulumi.get(self, \"volume_name\")",
"def unique_volume_name(base_name: ... | [
"0.7241955",
"0.7241955",
"0.7241955",
"0.7128536",
"0.71264017",
"0.7092525",
"0.7015841",
"0.700637",
"0.68840593",
"0.68004876",
"0.6778827",
"0.6737116",
"0.6737116",
"0.6713509",
"0.6694622",
"0.664794",
"0.6582667",
"0.6492981",
"0.6464738",
"0.6434876",
"0.64256716",
... | 0.0 | -1 |
Filesystem label for the block storage volume. | def filesystem_label(self) -> pulumi.Output[str]:
return pulumi.get(self, "filesystem_label") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filesystem_label(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"filesystem_label\")",
"def volume_name(self):\n return self._volume_name",
"def volume_name(self):\n return self._volume_name",
"def volume_name(self):\n return self._volume_name",
"def initia... | [
"0.74383193",
"0.67097735",
"0.67097735",
"0.67097735",
"0.6707923",
"0.66319436",
"0.6580506",
"0.6577158",
"0.6536779",
"0.6536779",
"0.65248865",
"0.64563835",
"0.64558154",
"0.6369871",
"0.6250002",
"0.6132799",
"0.60955685",
"0.60488427",
"0.60488427",
"0.5830856",
"0.58... | 0.7661525 | 0 |
The region that the block storage volume will be created in. | def region(self) -> pulumi.Output[str]:
return pulumi.get(self, "region") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_region(self):\n return self.region",
"def region(self):\n return self.__region",
"def get_region():\n if bb.aws.region is None:\n __init_region()\n log.debug('Return region: %s', bb.aws.region)\n return bb.aws.region",
"def get_region(self):\n return self._region"... | [
"0.75236124",
"0.751784",
"0.74683976",
"0.7394339",
"0.738957",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73819506",
"0.73057735",
"0.73057735",
"0.73057735",
"0.73057735",
"0.7240098",
"0.7199243",
"0.71031326",
"0.... | 0.7089799 | 25 |
The uniform resource name for the volume. | def volume_urn(self) -> pulumi.Output[str]:
return pulumi.get(self, "volume_urn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_name(self):\n return self._volume_name",
"def volume_name(self):\n return self._volume_name",
"def volume_name(self):\n return self._volume_name",
"def volume_name(self) -> Optional[str]:\n return pulumi.get(self, \"volume_name\")",
"def unique_volume_name(base_name: ... | [
"0.7241955",
"0.7241955",
"0.7241955",
"0.7128536",
"0.71264017",
"0.7092525",
"0.7015841",
"0.700637",
"0.68840593",
"0.68004876",
"0.6778827",
"0.6737116",
"0.6737116",
"0.6713509",
"0.6694622",
"0.664794",
"0.6582667",
"0.6492981",
"0.6464738",
"0.6434876",
"0.6310205",
... | 0.64256716 | 20 |
Get self._quantity as string. | def get_quantity_str(self, fmt=None):
return self.get_quantity_universal_str(
fmt=fmt,
quantity=self._quantity,
quantity_fmt=self.quantity_format
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_quantity(self):\n return self.__quantity",
"def get_quantity(self):\n return self.__quantity",
"def quantity(self):\n return self._quantity",
"def quantity(self):\n return self._quantity",
"def display_name(self):\n return self.quantity.name",
"def Quantity(self... | [
"0.79189825",
"0.79189825",
"0.7638213",
"0.7638213",
"0.7578226",
"0.73155063",
"0.7264412",
"0.7264412",
"0.7237263",
"0.70909137",
"0.70282954",
"0.69840616",
"0.6957869",
"0.69553983",
"0.6840477",
"0.6785404",
"0.6784202",
"0.6750007",
"0.67335904",
"0.67298555",
"0.6721... | 0.84208655 | 0 |
Get self._quantity_b as string. | def get_quantity_b_str(self, fmt=None):
return self.get_quantity_universal_str(
fmt=fmt,
quantity=self._quantity_b,
quantity_fmt=self.quantity_b_format
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_quantity_str(self, fmt=None):\n return self.get_quantity_universal_str(\n fmt=fmt,\n quantity=self._quantity,\n quantity_fmt=self.quantity_format\n )",
"def as_string_in(self, another_unit):\n return console.DefaultPrintingStrategy().quantity_to_strin... | [
"0.7685948",
"0.7012435",
"0.6910248",
"0.6910248",
"0.6644392",
"0.6644392",
"0.6610676",
"0.65100706",
"0.64359415",
"0.6332157",
"0.6332157",
"0.63113284",
"0.62009865",
"0.6196972",
"0.6192086",
"0.61597794",
"0.61391026",
"0.6080958",
"0.6062106",
"0.6050779",
"0.6043826... | 0.8704896 | 0 |
Get quantity as string with possible formatting. In case the offer is for music production for example, it would be good if the quantity of the offer posting would not be listed as a decimal rather than a readable time format. So instead of | def get_quantity_universal_str(self, fmt=None, quantity=None, quantity_fmt=None):
if type(quantity) is not QuantityTime:
return str(fmt)
# get self.quantity_format if no argument is given
if fmt is None:
fmt = quantity_fmt
# is this also is empty, get '{s}' as d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_quantity_str(self, fmt=None):\n return self.get_quantity_universal_str(\n fmt=fmt,\n quantity=self._quantity,\n quantity_fmt=self.quantity_format\n )",
"def format_quantity(self, quantity):\n precision = self._size_limits[3] or self._quote_precision\n... | [
"0.78793436",
"0.7489124",
"0.7264287",
"0.7158022",
"0.7053638",
"0.6890819",
"0.6887853",
"0.68855935",
"0.6656077",
"0.65611744",
"0.64881444",
"0.64570355",
"0.6426656",
"0.63489145",
"0.63194126",
"0.61951864",
"0.61190575",
"0.6091076",
"0.60793203",
"0.6058222",
"0.602... | 0.7586122 | 1 |
Get time as '' if time is 0, else str of time. | def get_time_zero(self, *args, **kwargs):
if self.get_time(*args, **kwargs) == QuantityTime(0):
return '-'
else:
return str(self.get_time(*args, **kwargs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_to_string(self, time):\n\n return str(time.strftime(\"%Y%m%d%H%M\"))",
"def time_to_str(time):\n time_str = str(time)\n return \"0\"*(4-len(time_str))+time_str",
"def time_to_str(time):\n\n return time.strftime('%H:%M:%S')",
"def time_string() -> str:\n delta = time.time() - t0\n ... | [
"0.76475877",
"0.76314664",
"0.76296955",
"0.7378037",
"0.7322956",
"0.73179394",
"0.73059577",
"0.72680676",
"0.72209585",
"0.71929526",
"0.71684045",
"0.7159383",
"0.71354586",
"0.71354586",
"0.7109679",
"0.70934635",
"0.70890385",
"0.70137835",
"0.7005855",
"0.6995773",
"0... | 0.73574597 | 4 |
Return a copy of this object. | def copy(self, keep_id=True):
return BaseEntry().from_json(js=self.to_json(), keep_id=keep_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self",
"def copy(self):\n return self.__copy__()",
"def copy(self):\n return copy(self)",
"def __copy__(self):\n return self.copy()",
"def copy(self):\n return copy.deepcopy(self)",
"def copy(self):\n return copy.deepcopy(self)",
"def c... | [
"0.9167166",
"0.9166268",
"0.9104144",
"0.9066833",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9049596",
"0.9044227",
"0.9044227",
"0.9037887",
"... | 0.0 | -1 |
Return a copy of this object. | def copy(self, keep_id=True):
return MultiplyEntry().from_json(js=self.to_json(), keep_id=keep_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self",
"def copy(self):\n return self.__copy__()",
"def copy(self):\n return copy(self)",
"def __copy__(self):\n return self.copy()",
"def copy(self):\n return copy.deepcopy(self)",
"def copy(self):\n return copy.deepcopy(self)",
"def c... | [
"0.9167166",
"0.9166268",
"0.9104144",
"0.9066833",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9049596",
"0.9044227",
"0.9044227",
"0.9037887",
"... | 0.0 | -1 |
Return a copy of this object. | def copy(self, keep_id=True):
return ConnectEntry().from_json(js=self.to_json(), keep_id=keep_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self",
"def copy(self):\n return self.__copy__()",
"def copy(self):\n return copy(self)",
"def __copy__(self):\n return self.copy()",
"def copy(self):\n return copy.deepcopy(self)",
"def copy(self):\n return copy.deepcopy(self)",
"def c... | [
"0.9167166",
"0.9166268",
"0.9104144",
"0.9066833",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9055192",
"0.9049596",
"0.9044227",
"0.9044227",
"0.9037887",
"... | 0.0 | -1 |
Sets the id of this VoiceTest. | def id(self, id):
if id is None:
raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setId(self, id):\n self.id = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._... | [
"0.75150865",
"0.7322971",
"0.7322971",
"0.7322971",
"0.7322971",
"0.7322971",
"0.72951",
"0.72951",
"0.72951",
"0.72734964",
"0.72734964",
"0.72734964",
"0.72734964",
"0.72734964",
"0.72722036",
"0.72722036",
"0.72722036",
"0.72722036",
"0.72722036",
"0.72722036",
"0.7272203... | 0.0 | -1 |
Sets the last_action_date_time of this VoiceTest. | def last_action_date_time(self, last_action_date_time):
self._last_action_date_time = last_action_date_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_click_date(self, last_click_date):\n\n self._last_click_date = last_click_date",
"def _set_last_run(self, last_run: datetime) -> None:\n self._last_run = last_run",
"def last_edition_time(self, last_edition_time):\n\n self._last_edition_time = last_edition_time",
"def last_modif... | [
"0.6254586",
"0.62370294",
"0.59478563",
"0.583226",
"0.58119035",
"0.5781428",
"0.5754441",
"0.5725378",
"0.57220596",
"0.5654372",
"0.5630239",
"0.5615048",
"0.5615048",
"0.5615048",
"0.55919147",
"0.5539609",
"0.5532507",
"0.5515445",
"0.5493068",
"0.5493068",
"0.54647195"... | 0.83128065 | 0 |
Sets the created_date_time of this VoiceTest. | def created_date_time(self, created_date_time):
self._created_date_time = created_date_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_time(self, created_time):\n\n self._created_time = created_time",
"def created_date(self, created_date):\n \n self._created_date = created_date",
"def date_created(self, date_created: datetime):\n\n self._date_created = date_created",
"def creation_date_time(self, crea... | [
"0.74846107",
"0.74221766",
"0.7394621",
"0.73919255",
"0.7388882",
"0.7388882",
"0.7388882",
"0.7318091",
"0.7276216",
"0.7276216",
"0.725007",
"0.72004896",
"0.72004896",
"0.72004896",
"0.72004896",
"0.6905765",
"0.6905765",
"0.6870853",
"0.6870853",
"0.6870853",
"0.6870853... | 0.7826412 | 0 |
Returns the string representation of the model | def to_str(self):
return pprint.pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8602374",
"0.85093755",
"0.8237104",
"0.8050309",
"0.80128866",
"0.79348034",
"0.78766525",
"0.77898884",
"0.7786461",
"0.7745792",
"0.7627315",
"0.76055235",
"0.757999",
"0.7514394",
"0.75038797",
"0.75035286",
"0.74850684",
"0.7440529",
"0.74325883",
"0.74239755",
"0.740... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
The providerassigned unique ID for this managed resource. | def id(self) -> str:
return pulumi.get(self, "id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provider_id(self) -> str:\n return self._provider_id",
"def provider_id(self):\n return self.__provider_id",
"def provider_id(self):\n raise NotImplementedError",
"def get_id(self):\n return \"{0} {1}\".format(self.get_issuer(), self.get_serial_number())",
"def get_resource_... | [
"0.8126292",
"0.80488974",
"0.7851373",
"0.7627896",
"0.75990766",
"0.7476093",
"0.7476093",
"0.7476093",
"0.7476093",
"0.7476093",
"0.7445641",
"0.7445641",
"0.737442",
"0.7371964",
"0.7371964",
"0.7371964",
"0.7371964",
"0.73697764",
"0.73408705",
"0.73204225",
"0.7317522",... | 0.0 | -1 |
Reshape an image with the good ratio | def get_image(path, width=1*cm):
img = utils.ImageReader(path)
iw, ih = img.getSize()
aspect = ih / float(iw)
return Image(path, width=width, height=(width * aspect)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reshape(img):\n # resize image to from 300*300*5 => 244*244*5, also converts to float\n img = ski_transform.resize(img, (244, 244, 5), mode=\"reflect\")\n # reshape from width*height*channel => channel*width*height\n return Tensor(img).permute(2, 0, 1)",
"def _reshape_and_normaliz... | [
"0.6761725",
"0.67387086",
"0.6524226",
"0.6302758",
"0.62731224",
"0.62653196",
"0.6225515",
"0.6206633",
"0.6125524",
"0.6102344",
"0.60953546",
"0.603513",
"0.6030741",
"0.60291046",
"0.60264117",
"0.60157603",
"0.60127956",
"0.5996226",
"0.59805924",
"0.59767824",
"0.5962... | 0.0 | -1 |
returns min_max_set and max_min_set if they are both equal, that means the element has been found | def search(self, element):
# We build a LatticeElement for the comparison (top, bottom)
le = LatticeElement(element)
# We use a top-down approach and aim at building two sets:
# - the minimal-majorant set (min_max_set)
# - the maximal-minorant set (max_min_set)
# All e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get(self, element, search_type = SEARCH_EQUAL):\n min_max_set, max_min_set = self.search(element)\n if min_max_set == max_min_set:\n assert len(min_max_set) == 1, \"min_max_set == max_min_set and length != 1\"\n return min_max_set\n else:\n if search_type ... | [
"0.72117096",
"0.62464887",
"0.61591995",
"0.6080055",
"0.6069567",
"0.60568506",
"0.5955867",
"0.5901345",
"0.5879758",
"0.58424526",
"0.5805687",
"0.5796767",
"0.5794171",
"0.57839185",
"0.5772629",
"0.5751554",
"0.57472336",
"0.57226056",
"0.5705932",
"0.5705055",
"0.56783... | 0.7092009 | 1 |
\return set of lattice_element | def _get(self, element, search_type = SEARCH_EQUAL):
min_max_set, max_min_set = self.search(element)
if min_max_set == max_min_set:
assert len(min_max_set) == 1, "min_max_set == max_min_set and length != 1"
return min_max_set
else:
if search_type == SEARCH_EQU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _lattice_initializer(self):\n # get a list of the elements and switch to a tuple\n # representation\n set_ = [tuple(tuple(_) for _ in x) for x in list(self)]\n return (set_, [(a,b) for a in set_ for b in set_ if _is_a_cover(a,b)])",
"def lattice(self):\n return self._lattic... | [
"0.699059",
"0.668331",
"0.668331",
"0.668331",
"0.6584763",
"0.65532917",
"0.6500008",
"0.6489188",
"0.6406339",
"0.6341465",
"0.6341465",
"0.6303675",
"0.6252526",
"0.6110418",
"0.6109094",
"0.61083966",
"0.6094772",
"0.608764",
"0.6083573",
"0.606089",
"0.60531014",
"0.6... | 0.0 | -1 |
Sets the description of the item | def set_description(self, description):
self.description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, description):\n\t\tself.description = description",
"def set_description(self, description):\n self.__description = description",
"def set_description(self, description):\n self._description = description",
"def updateDescription(self, descr):\n self.description... | [
"0.82787514",
"0.80409515",
"0.80223274",
"0.79951674",
"0.7974979",
"0.79214996",
"0.7885238",
"0.7876333",
"0.78594834",
"0.78550833",
"0.78550833",
"0.78550833",
"0.78550833",
"0.78550833",
"0.78550833",
"0.78550833",
"0.78502846",
"0.78502846",
"0.77894723",
"0.7768694",
... | 0.8153976 | 1 |
Sets the name of the item | def set_name(self, name):
self.name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_name(self, item_name: str):\n\n self._item_name = item_name",
"def set_name(self, name):\n pass",
"def _set_name(self, new_name):\n self._name = new_name",
"def setName(self, name):\n self.name = self.name + name",
"def name(self, value): \n self._name = v... | [
"0.8579834",
"0.77762675",
"0.7731145",
"0.7692749",
"0.7689867",
"0.7689867",
"0.7686109",
"0.7682165",
"0.76658255",
"0.76620936",
"0.76390326",
"0.7602791",
"0.7601787",
"0.7601787",
"0.7601787",
"0.7601787",
"0.7601787",
"0.7601787",
"0.7601787",
"0.7591127",
"0.7591127",... | 0.77553767 | 3 |
Implementation of the gelu activation function. | def gelu(x):
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gelu(x):\n return tf.keras.activations.gelu(x)",
"def gelu(x):\n return tf.nn.gelu(x, approximate=True)",
"def gelu_fast(x):\n return 0.5 * x * (1.0 + torch.tanh(x * 0.7978845608 * (1.0 + 0.044715 * x * x)))",
"def gelu_new(x):\n return 0.5 * x * (1 + torch.tanh(\n math.sqrt(2 / math.p... | [
"0.8156728",
"0.77075464",
"0.74103373",
"0.7364669",
"0.7364094",
"0.7364094",
"0.73561054",
"0.7306623",
"0.72241336",
"0.7206583",
"0.7206583",
"0.7196593",
"0.7190447",
"0.7158747",
"0.7074584",
"0.7027239",
"0.70180595",
"0.6982674",
"0.6968394",
"0.6968394",
"0.6968394"... | 0.69553304 | 28 |
Instantiate a BertPreTrainedModel from a pretrained model file or a pytorch state dict. Download and cache the pretrained model file if needed. | def from_pretrained(cls, pretrained_model_name_or_path, state_dict=None, cache_dir=None,
from_tf=False, *inputs, **kwargs):
if pretrained_model_name_or_path in PRETRAINED_MODEL_ARCHIVE_MAP:
archive_file = PRETRAINED_MODEL_ARCHIVE_MAP[pretrained_model_name_or_path]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_pretrained(cls, pretrained_model_name, state_dict=None, cache_dir=None, *inputs, **kwargs):\n if pretrained_model_name in PRETRAINED_MODEL_ARCHIVE_MAP:\n archive_file = PRETRAINED_MODEL_ARCHIVE_MAP[pretrained_model_name]\n else:\n archive_file = pretrained_model_name\n ... | [
"0.8039261",
"0.7880466",
"0.7788667",
"0.7670973",
"0.7641179",
"0.756345",
"0.7539243",
"0.7524119",
"0.74961966",
"0.73699355",
"0.7267791",
"0.7210436",
"0.71139526",
"0.6946453",
"0.6860832",
"0.6858162",
"0.6855924",
"0.6832651",
"0.6788635",
"0.6780389",
"0.6741856",
... | 0.79045075 | 1 |
Get the values of the file in form of list of dictionary of records | def get_val(self):
return self.val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values(self):\n return self._file.values()",
"def result(self):\n\n keys = [x.text for x in self.parts]\n values = self.read().split('|')\n return {k:v for k, v in zip(keys, values)}",
"def get_records(self):\n if self.fh.tell(): # if file's position is not at the beginn... | [
"0.6912612",
"0.655077",
"0.64529103",
"0.64290744",
"0.6422156",
"0.63548136",
"0.6339037",
"0.6211116",
"0.6197268",
"0.6195769",
"0.61733514",
"0.6170549",
"0.61603564",
"0.6145954",
"0.6143071",
"0.6134274",
"0.6109771",
"0.60999334",
"0.6035798",
"0.6008828",
"0.59879136... | 0.0 | -1 |
Returns true iff chords are present in the stream and there are pitches assigned to the chord. The abc importer seems to pollute the stream with empty chord objects. | def stream_has_chords(music21_stream):
chord_list = music21_stream.flat.getElementsByClass(chord.Chord)
if len(chord_list) > 0:
for cho in chord_list:
if cho.pitchClassCardinality > 0:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_orderly(self):\n if DPart.stream_has_chords(music21_stream=self._stream):\n return False\n\n notes = self._stream.flat.getElementsByClass(note.Note)\n for i in range(len(notes)):\n # print(\"{0}: {1}\".format(str(notes[i].offset), str(notes[i].pitch)))\n ... | [
"0.66006786",
"0.59464777",
"0.58129054",
"0.56692207",
"0.56377923",
"0.56087255",
"0.56064373",
"0.5598518",
"0.5570641",
"0.5555702",
"0.5535861",
"0.5524013",
"0.5507927",
"0.54739076",
"0.54729253",
"0.54562294",
"0.5449591",
"0.5447519",
"0.5439601",
"0.53929234",
"0.53... | 0.76719564 | 0 |
Returns True iff this DPart contains no notes that start at the same offset as any other note. | def is_orderly(self):
if DPart.stream_has_chords(music21_stream=self._stream):
return False
notes = self._stream.flat.getElementsByClass(note.Note)
for i in range(len(notes)):
# print("{0}: {1}".format(str(notes[i].offset), str(notes[i].pitch)))
start = notes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasnotes(self, entities):\n return any(entity.notes for entity in entities)",
"def empty(self):\n return self.delta == 0 and self.start == self.end",
"def containsOffset(self, offset: long) -> bool:\n ...",
"def _is_any_indel(self, x, y):\n # Things get complicated when a cont... | [
"0.6209225",
"0.61647654",
"0.5964448",
"0.5818212",
"0.57598346",
"0.57283324",
"0.57170564",
"0.5625539",
"0.5621481",
"0.56059116",
"0.558026",
"0.55733097",
"0.5560866",
"0.5478458",
"0.5472444",
"0.5442091",
"0.54259527",
"0.5402512",
"0.53818315",
"0.5380466",
"0.538012... | 0.62579715 | 0 |
Returns True iff this DPart has no notes that sound at the same time as other notes. | def is_monophonic(self):
if DPart.stream_has_chords(music21_stream=self._stream):
return False
notes = self._stream.flat.getElementsByClass(note.Note)
for i in range(len(notes)):
# print("{0}: {1}".format(str(notes[i].offset), str(notes[i].pitch)))
start = no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_orderly(self):\n if DPart.stream_has_chords(music21_stream=self._stream):\n return False\n\n notes = self._stream.flat.getElementsByClass(note.Note)\n for i in range(len(notes)):\n # print(\"{0}: {1}\".format(str(notes[i].offset), str(notes[i].pitch)))\n ... | [
"0.6059912",
"0.605917",
"0.5918731",
"0.585778",
"0.57995176",
"0.5700432",
"0.5671768",
"0.5554118",
"0.5515175",
"0.5474311",
"0.54212165",
"0.5409791",
"0.54096866",
"0.5365402",
"0.53576505",
"0.5332381",
"0.5300411",
"0.529513",
"0.52509874",
"0.52285135",
"0.52248204",... | 0.5782874 | 5 |
manage dict all cls and entities | def all(self, cls=None):
new_dict = {}
if cls is not None:
if cls in all_classes:
see = self.__session.query(all_classes[cls])
else:
see = self.__session.query(cls)
for instance in see:
key = instance.__class__.__name__ ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self._entities = {}",
"def updateEntityClasses(dictionary):\n cxx_entityList = wrap.factory_get_entity_class_list()\n for e in filter(lambda x: x not in Entity.entityClassNameList, cxx_entityList):\n # Store new class in dictionary with class name\n PyEntityFactor... | [
"0.7229278",
"0.63457537",
"0.6292165",
"0.61838394",
"0.61674523",
"0.61073977",
"0.60636985",
"0.6030172",
"0.60247713",
"0.5974405",
"0.59399974",
"0.59286064",
"0.59217244",
"0.5901696",
"0.58400744",
"0.58342826",
"0.58340895",
"0.5823842",
"0.5822236",
"0.58166134",
"0.... | 0.5811866 | 20 |
Returns an approximation of the dawson function's output using the Simpson's method, given the number of slices (n) and x value. | def d_simpson(n, x_at):
if n % 2 != 0:
return None
h = x_at / n
odd_sum = 0
even_sum = 0
for i in range(1, n):
if i % 2 == 1:
odd_sum += 4 * f(i * h)
elif i % 2 == 0:
even_sum += 2 * f(i * h)
return h / 3 * (f(0) + f(x_at) + odd_sum + even_sum) * e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simpson(f, a, b, n=1):\n x = lambda k: a + k * dx(a, b, 2 * n)\n return dx(a, b, 2 * n) / 3 * (f(a) + f(b) + 2 * sum(f(x(k)) for k in\n xrange(2, 2 * n, 2)) + 4 * sum(f(x(k)) for k in xrange(1, 2 * n, 2)))",
"def simpson(f, a, b, n):\n x = np.linspace(a, b, 2 * n + 1)\n h = (b - a) / n\n ... | [
"0.6999181",
"0.69015396",
"0.68322897",
"0.65877134",
"0.6296675",
"0.60635865",
"0.6054213",
"0.60208327",
"0.59973645",
"0.59565157",
"0.5911244",
"0.5835936",
"0.5819617",
"0.5811751",
"0.5810728",
"0.5716072",
"0.5696714",
"0.56946254",
"0.5616334",
"0.5568334",
"0.55605... | 0.77310187 | 0 |
Return a preconfigured sshtunnel.SSHTunnelForwarder instance. | def setup_proxy(self) -> Callable:
proxy = self.device.proxy
def opener():
"""Set up an SSH tunnel according to a device's configuration."""
tunnel_kwargs = {
"ssh_username": proxy.credential.username,
"remote_bind_address": (self.device._target,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_forwarding_class(self):\n return self.__forwarding_class",
"def _get_forwarding_class(self):\n return self.__forwarding_class",
"def _get_forwarding_class(self):\n return self.__forwarding_class",
"def _get_forwarding_class(self):\n return self.__forwarding_class",
"def opener():\n ... | [
"0.577381",
"0.577381",
"0.577381",
"0.577381",
"0.55894923",
"0.54604083",
"0.543047",
"0.543047",
"0.543047",
"0.543047",
"0.543047",
"0.533059",
"0.5115747",
"0.51136506",
"0.5101319",
"0.5093249",
"0.49962825",
"0.49138406",
"0.48906153",
"0.4885893",
"0.4854329",
"0.48... | 0.5127855 | 12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.