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
Converts normalized vector v and angle of rotation theta into quaternion format
def v_theta_to_quaternion(v, theta): v_x, v_y, v_z = v[0], v[1], v[2] w = math.cos(theta / 2) x = v_x * math.sin(theta / 2) y = v_y * math.sin(theta / 2) z = v_z * math.sin(theta / 2) return w, x, y, z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quaternion_from_axis_angle(x, y, z, theta):\n if x == y == z == 0:\n return np.array([1, 0, 0, 0])\n axis = np.array([x, y, z])\n axis /= np.linalg.norm(axis)\n return rowan.from_axis_angle(axis, theta)", "def angle_axis_to_quaternion(axis, theta):\n if isinstance(axis, string_types):\n...
[ "0.72794396", "0.7156318", "0.7139391", "0.7046337", "0.6987438", "0.69167876", "0.6913066", "0.6894534", "0.68589807", "0.6782428", "0.6722065", "0.67155", "0.66725487", "0.6667836", "0.66520226", "0.66392064", "0.6637463", "0.6627092", "0.66093755", "0.6593288", "0.6545275"...
0.84191024
0
Converts euler (yaw, pitch, roll) to quaternion equivalent (x, x, y, z)
def euler_to_quaternion(yaw, pitch, roll): cy = math.cos(yaw * 0.5) sy = math.sin(yaw * 0.5) cp = math.cos(pitch * 0.5) sp = math.sin(pitch * 0.5) cr = math.cos(roll * 0.5) sr = math.sin(roll * 0.5) w = cy * cp * cr + sy * sp * sr x = cy * cp * sr - sy * sp * cr y = sy * cp ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euler_from_quaternion(x, y, z, w):\n t0 = +2.0 * (w * x + y * z)\n t1 = +1.0 - 2.0 * (x * x + y * y)\n roll_x = math.atan2(t0, t1)\n \n t2 = +2.0 * (w * y - z * x)\n t2 = +1.0 if t2 > +1.0 else t2\n t2 = -1.0 if t2 < -1.0 else t2\n pitch_y = math.asin(t2)\n ...
[ "0.8429312", "0.8423185", "0.8400243", "0.8332193", "0.8192959", "0.8170563", "0.8155459", "0.8058223", "0.80349743", "0.79742205", "0.7747596", "0.7597188", "0.7543305", "0.7500849", "0.75007", "0.7485397", "0.74781585", "0.74781585", "0.74598426", "0.74330425", "0.74295586"...
0.87279296
0
Returns the quaternion product
def quaternion_product(q1, q2): Wa = q1[0] Wb = q2[0] Xa = q1[1] Xb = q2[1] Ya = q1[2] Yb = q2[2] Za = q1[3] Zb = q2[3] x = Xa * Wb + Ya * Zb - Za * Yb + Wa * Xb y = -Xa * Zb + Ya * Wb + Za * Xb + Wa * Yb z = Xa * Yb - Ya * Xb + Za * Wb + Wa * Zb w = -Xa * Xb ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(self, q: np.ndarray) -> np.ndarray:\n if isinstance(q, Quaternion):\n qw, qx, qy, qz = q\n elif isinstance(q, (np.ndarray, list, tuple)):\n qw, qx, qy, qz = Quaternion(q)\n else:\n raise TypeError(f\"q must be a Quaternion or an array, not {type(q)}...
[ "0.77504045", "0.7210473", "0.71107423", "0.7068177", "0.70024896", "0.69102615", "0.68782955", "0.6862836", "0.67189115", "0.6666304", "0.66502774", "0.658127", "0.65783346", "0.6556263", "0.65469915", "0.6516602", "0.6494177", "0.64497936", "0.64464974", "0.64440626", "0.64...
0.73401606
1
Rotates vector xyz by quaternion wxyz
def point_rotation_by_quaternion(v, q): r = [0] + v q_conj = [q[0], -q[1], -q[2], -q[3]] return quaternion_product(quaternion_product(q, r), q_conj)[1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rotate_vec_z(self):\n\n quat = Quat.from_axis_angle_deg(Vec3(0, 0, 1), 90.)\n vec = Vec3(1, 1, 1)\n\n rotated_vec = quat.rotate_vec(vec)\n\n # 90 deg around z moves x from positive to negative\n self.assertAlmostEqual(-1.0, rotated_vec.x)\n self.assertAlmostEqual(...
[ "0.70170164", "0.698487", "0.6981486", "0.69387877", "0.69113785", "0.6902339", "0.6857792", "0.6597977", "0.65789545", "0.65615094", "0.6493876", "0.6478198", "0.6469963", "0.642127", "0.64010155", "0.6395416", "0.6367804", "0.63655335", "0.63624156", "0.6346277", "0.6292973...
0.6648088
7
Takes turn stack, flip corresponding edge flag to true and check if all edges are occupied. Returns true if occupied.
def update(self, stack): # the following two lines are a hack so that one can't overwrite squares if self.occupied == 1 or self.occupied == 2 or self.occupied == 3: return False if (stack[0].pos == self.rect.topleft and stack[1].pos == self.rect.topright) or \ (stack[1].pos == self.rect.topleft and stack[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_grid_full(self):\n for row in self.game_state:\n for e in row:\n if e is None:\n return False\n return True", "def has_connection_down(tile):\n return is_kth_bit_set(tile, 4)", "def has_connection_up(tile):\n return is_kth_bit_set(tile,...
[ "0.6199984", "0.6153463", "0.6123684", "0.60984546", "0.60943526", "0.6075924", "0.6004335", "0.6004335", "0.6004335", "0.5949942", "0.5886926", "0.5857642", "0.5847547", "0.5838338", "0.5836865", "0.5832117", "0.58263874", "0.5821103", "0.581889", "0.5814659", "0.5811703", ...
0.6480664
0
Create filename for data shard.
def shard_filename(path, tag, shard_num, total_shards): return os.path.join( path, "%s-%s-%.5d-of-%.5d" % (_PREFIX, tag, shard_num, total_shards))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_filename_create(movie_filename):\n path, filename = os.path.split(movie_filename)\n filename_stub, ext = os.path.splitext(filename)\n if os.path.splitext(movie_filename)[1] in ['.png','.jpg','.tiff','.JPG']: \n data_filename = os.path.join(path, ''.join([letter for letter in filename_stu...
[ "0.71882224", "0.71347773", "0.7064838", "0.69381607", "0.6875004", "0.67602825", "0.6755242", "0.6698934", "0.665635", "0.6625433", "0.66191363", "0.66055256", "0.6593376", "0.6592142", "0.6582782", "0.65421116", "0.6518978", "0.650782", "0.64858466", "0.6454506", "0.6381873...
0.706266
3
Converts a dictionary of string>int to a tf.Example.
def dict_to_example(dictionary): features = {} for k, v in six.iteritems(dictionary): features[k] = tf.train.Feature(int64_list=tf.train.Int64List(value=v)) return tf.train.Example(features=tf.train.Features(feature=features))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_example(self, tensor_dict):\n image = tensor_dict['image']\n image = image.tobytes()\n label = tensor_dict['label']\n return tf.train.Example(\n features=tf.train.Features(\n feature={\n 'image':\n tf.train.Feature(bytes_list=tf.train.BytesList(v...
[ "0.72307324", "0.6855185", "0.67302984", "0.67302984", "0.67268705", "0.67055607", "0.6690847", "0.668516", "0.6626223", "0.65431654", "0.65431654", "0.6477947", "0.6472604", "0.6464817", "0.6451474", "0.64475596", "0.63921565", "0.63173705", "0.6086282", "0.60430026", "0.602...
0.84548163
0
Yield successive nsized chunks from lst.
def chunks(lst, n): for i in range(0, len(lst), n): yield lst[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]", "def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "de...
[ "0.8305801", "0.8192371", "0.81896204", "0.81896204", "0.8188763", "0.8125368", "0.8120533", "0.8120533", "0.807605", "0.80513006", "0.80513006", "0.80513006", "0.80513006", "0.80513006", "0.8002998", "0.7869975", "0.78449064", "0.78277224", "0.78258467", "0.78124744", "0.780...
0.80520135
15
The set of arguments for constructing a PrivateCloud resource.
def __init__(__self__, *, location: pulumi.Input[str], management_cluster: pulumi.Input['PrivateCloudManagementClusterArgs'], network_config: pulumi.Input['PrivateCloudNetworkConfigArgs'], description: Optional[pulumi.Input[str]] = None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n args: PrivateCloudArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...", "def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = None,\n ...
[ "0.7701864", "0.6640795", "0.6597265", "0.6475078", "0.62686265", "0.6059364", "0.60563135", "0.5994978", "0.59276193", "0.5912271", "0.58158076", "0.5810898", "0.57922196", "0.57377315", "0.5733888", "0.5678828", "0.56522614", "0.564133", "0.5630807", "0.5628696", "0.5626725...
0.6284509
4
The ID of the PrivateCloud.
def name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id(self):\n if self.cloudserver:\n return self.cloudserver.id\n else:\n return None", "def id(self): \n if self.cloudnet:\n return self.cloudnet.id\n else:\n return None", "def internal_id(self) -> str:\n return pulumi.get(self...
[ "0.756143", "0.737348", "0.68891376", "0.6430862", "0.6344769", "0.6309909", "0.6309909", "0.6291323", "0.62905484", "0.62905484", "0.6290242", "0.6290242", "0.6290242", "0.6290242", "0.6290242", "0.6290242", "0.6290242", "0.6290242", "0.6290242", "0.6290242", "0.6290242", ...
0.0
-1
The ID of the PrivateCloud.
def name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id(self):\n if self.cloudserver:\n return self.cloudserver.id\n else:\n return None", "def id(self): \n if self.cloudnet:\n return self.cloudnet.id\n else:\n return None", "def internal_id(self) -> str:\n return pulumi.get(self...
[ "0.75614274", "0.73734045", "0.68891054", "0.6430752", "0.63447815", "0.6309729", "0.6309729", "0.62912863", "0.6290541", "0.6290541", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "...
0.0
-1
Get an existing PrivateCloud resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None, description: Optional[pulumi.Input[str]] = None, hcxes: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['PrivateCloudHcxArgs']]]]] = None, location: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n config: Optional[pulumi.Input[str]] = None,\n description: Optional[pulumi.Input[str]] = None,\n metadata: Optional[pulumi.Input[pulumi.InputType['Synthetic...
[ "0.65079397", "0.60180366", "0.5631492", "0.5520025", "0.5516253", "0.5478971", "0.5461587", "0.5423228", "0.54021776", "0.5391341", "0.53576255", "0.5346516", "0.534531", "0.53248453", "0.5313847", "0.5311084", "0.52749074", "0.5260175", "0.52535284", "0.5236298", "0.5212986...
0.71614945
0
The ID of the PrivateCloud.
def name(self) -> pulumi.Output[str]: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id(self):\n if self.cloudserver:\n return self.cloudserver.id\n else:\n return None", "def id(self): \n if self.cloudnet:\n return self.cloudnet.id\n else:\n return None", "def internal_id(self) -> str:\n return pulumi.get(self...
[ "0.75614274", "0.73734045", "0.68891054", "0.6430752", "0.63447815", "0.6309729", "0.6309729", "0.62912863", "0.6290541", "0.6290541", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "0.62901795", "...
0.0
-1
Return a colored time stamp as str.
def prefix_for_issue(self): if not self.show_message_times: return '' # absolute time now_str = dt.datetime.now().strftime('%H:%M:%S') # difference to last message diff = self.last_message_timer.get('s') diff_str_inner = utils.nice_time_string(diff) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeStamp():\n import time\n return str(time.strftime(\"%a %d %b %Y %I:%M:%S %p\"))", "def timestamp(style=False):\r\n\r\n if not style:\r\n return time.strftime('%H:%M:%S%p %D', time.localtime())\r\n else:\r\n return time.strftime(style, time.localtime())", "def skrTimeStamp(styl...
[ "0.7243191", "0.7215947", "0.7168577", "0.7142945", "0.70724404", "0.6846711", "0.68410975", "0.68303", "0.6802723", "0.6773432", "0.67650586", "0.668286", "0.6644579", "0.6617341", "0.66012836", "0.6599197", "0.6581608", "0.6563026", "0.6519783", "0.6512448", "0.64942485", ...
0.65204114
18
Expands the random field as a finite linear combination of the KL eigen functions with coefficients sampled from a distribution given by the array sample_point. If attr is log, then the random field is the exponentiated.
def expandRandField(self, num_kl, sample_point, attr): # By default it is CG space of order 1 function_space = FunctionSpace(self._mesh, "CG", 1) # Instantiate the random field as an element of the function space rand_field = Function(function_space) # create a temp field array ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sampler(self, mean, log_var):\n eps = torch.randn_like(mean).to(self.device)\n z = torch.exp(0.5*log_var) * eps + mean\n return z", "def reparameterize(self, mu, logvar):\n eps = torch.randn_like(mu)\n return mu + eps*torch.exp(0.5 * logvar)", "def reparameterize(self, mu...
[ "0.5443033", "0.54332983", "0.54332983", "0.54332983", "0.54332983", "0.54048586", "0.5266122", "0.51295024", "0.50889564", "0.50773805", "0.5043628", "0.5043628", "0.50307107", "0.5029842", "0.5000028", "0.4991507", "0.49862686", "0.49857447", "0.494048", "0.49280787", "0.49...
0.77260077
0
Returns the maximum number of readings the ammeter can hold
def get_max_readings( self ): return 2500
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_device_readings_max(self):\n request = self.client().get('/devices/{}/readings/max/'.format(self.device_uuid))\n\n self.assertEqual(request.json.get('value', None), 100)", "def getMaxMancount(self):\n return self.__size * 20", "def max_count(self):\n return self.config.get(...
[ "0.7064799", "0.6876236", "0.6795457", "0.67838174", "0.66716325", "0.6647795", "0.6529371", "0.65090114", "0.64929694", "0.6491466", "0.64898306", "0.6473247", "0.6473247", "0.6473247", "0.6473247", "0.6473247", "0.64692223", "0.64664495", "0.6463778", "0.64474916", "0.64243...
0.825167
0
Get a chunk of audio. The first time this reads the full number of samples required for the FFT. Subsequent calls give a major latter chunk of the previous output plus the new samples required to fill the rest of the buffer.
def get_audio(): buf = None num_new_bytes = BUFFER_SIZE // REFRESH_BUFFER_FACTOR with open(INFILE) as fifo: while True: if buf is None: buf = fifo.read(BUFFER_SIZE) else: buf = buf[num_new_bytes:] + fifo.read(num_new_bytes) yield buf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_chunk(self):\n data = self.stream.read(nFFT)\n data_array = bytearray(data)\n self.cur_input = []\n for i in range(nFFT):\n amp = struct.unpack('H', data_array[:2])\n for _ in range(2):\n data_array.pop(0)\n self.cur_input.appen...
[ "0.72874796", "0.6661119", "0.6434563", "0.6308734", "0.62464464", "0.61685735", "0.615072", "0.60862964", "0.6053902", "0.60050607", "0.5975894", "0.5926335", "0.5798063", "0.5788498", "0.5782724", "0.57610863", "0.57597136", "0.5758252", "0.57539314", "0.5749107", "0.574910...
0.6912398
1
Adds custom gradients in the backprop stage.
def add_custom_gradients(self, clst_weights, weights): override_weights = tf.sign(tf.reshape(weights, shape=(-1,)) + 1e+6) z = clst_weights * override_weights def grad(dz): return dz, dz return z, grad
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_gradients(self,\n grads_and_vars,\n global_step=None,\n name=None,\n decay_var_list=None):\n self._decay_var_list = set(decay_var_list) if decay_var_list else False\n return super(DecoupledWeightDecayExtension, self...
[ "0.66081387", "0.64641005", "0.6413468", "0.6412344", "0.641107", "0.63822436", "0.6311049", "0.6250906", "0.6238698", "0.62230843", "0.61751586", "0.61376643", "0.6113364", "0.6110002", "0.6089549", "0.6067444", "0.6067444", "0.60644275", "0.60598946", "0.6058577", "0.604347...
0.69161004
0
The account identifier to target for the resource.
def account_id(self) -> pulumi.Input[str]: return pulumi.get(self, "account_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def account_id(self) -> str:\n return pulumi.get(self, \"ac...
[ "0.81525457", "0.81525457", "0.81525457", "0.81525457", "0.81525457", "0.81525457", "0.81525457", "0.81525457", "0.80785906", "0.8056882", "0.79521817", "0.79379904", "0.79216164", "0.79014987", "0.77820086", "0.77820086", "0.77820086", "0.77820086", "0.77820086", "0.7753671", ...
0.7650948
25
The name of the branch that is used for the production environment.
def production_branch(self) -> pulumi.Input[str]: return pulumi.get(self, "production_branch")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def production_branch(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"production_branch\")", "def get_branch():\n if os.getenv('GIT_BRANCH'):\n # Travis\n branch = os.getenv('GIT_BRANCH')\n elif os.getenv('BRANCH_NAME'):\n # Jenkins 2\n br...
[ "0.7910726", "0.7822266", "0.7593047", "0.7455047", "0.74435496", "0.7324827", "0.71299386", "0.70948887", "0.7066308", "0.70112336", "0.70112336", "0.69671506", "0.69460595", "0.6899111", "0.6779219", "0.6728212", "0.6720825", "0.6720825", "0.6673321", "0.66697365", "0.66602...
0.778484
2
The account identifier to target for the resource.
def account_id(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "account_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def account_id(self) -> str:\n return pulumi.get(self, \"ac...
[ "0.81525457", "0.81525457", "0.81525457", "0.81525457", "0.81525457", "0.81525457", "0.81525457", "0.81525457", "0.80785906", "0.8056882", "0.79521817", "0.79379904", "0.79216164", "0.79014987", "0.77820086", "0.77820086", "0.77820086", "0.77820086", "0.77820086", "0.7753671", ...
0.7420867
33
The name of the branch that is used for the production environment.
def production_branch(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "production_branch")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def production_branch(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"production_branch\")", "def get_branch():\n if os.getenv('GIT_BRANCH'):\n # Travis\n branch = os.getenv('GIT_BRANCH')\n elif os.getenv('BRANCH_NAME'):\n # Jenkins 2\n br...
[ "0.7910726", "0.7822266", "0.778484", "0.7455047", "0.74435496", "0.7324827", "0.71299386", "0.70948887", "0.7066308", "0.70112336", "0.70112336", "0.69671506", "0.69460595", "0.6899111", "0.6779219", "0.6728212", "0.6720825", "0.6720825", "0.6673321", "0.66697365", "0.666029...
0.7593047
3
The Cloudflare subdomain associated with the project.
def subdomain(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "subdomain")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subdomain(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"subdomain\")", "def getSubdomain(self):\n\t\treturn self.Subdomain", "def get_domain():\n domain=\"\"\n for item in re.split(\"\\.\", env.host)[1:]:\n domain = domain + \".\" + item\n return domain.lstrip(\".\")", "...
[ "0.78226054", "0.7576885", "0.7433715", "0.7431048", "0.74264306", "0.7259316", "0.7250373", "0.72070515", "0.7137395", "0.70844424", "0.7071613", "0.7071613", "0.70686567", "0.70640665", "0.7058208", "0.7052028", "0.70419145", "0.7022579", "0.699674", "0.6892024", "0.6882206...
0.76161826
1
The account identifier to target for the resource.
def account_id(self) -> pulumi.Output[str]: return pulumi.get(self, "account_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def account_id(self) -> str:\n return pulumi.get(self, \"ac...
[ "0.8154262", "0.8154262", "0.8154262", "0.8154262", "0.8154262", "0.8154262", "0.8154262", "0.8154262", "0.8080623", "0.805934", "0.7953823", "0.7940875", "0.7923217", "0.7903534", "0.77834684", "0.77834684", "0.77834684", "0.77834684", "0.77834684", "0.77558345", "0.7653298"...
0.7720449
21
The name of the branch that is used for the production environment.
def production_branch(self) -> pulumi.Output[str]: return pulumi.get(self, "production_branch")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_branch():\n if os.getenv('GIT_BRANCH'):\n # Travis\n branch = os.getenv('GIT_BRANCH')\n elif os.getenv('BRANCH_NAME'):\n # Jenkins 2\n branch = os.getenv('BRANCH_NAME')\n else:\n branch = check_output(\n \"git rev-pa...
[ "0.78230476", "0.7784668", "0.75930625", "0.74560213", "0.7444226", "0.7325169", "0.713063", "0.70959663", "0.7066538", "0.70117944", "0.70117944", "0.69680023", "0.69465566", "0.6899448", "0.67798585", "0.6728735", "0.67215997", "0.67215997", "0.66739136", "0.6670546", "0.66...
0.7910732
0
The Cloudflare subdomain associated with the project.
def subdomain(self) -> pulumi.Output[str]: return pulumi.get(self, "subdomain")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subdomain(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"subdomain\")", "def getSubdomain(self):\n\t\treturn self.Subdomain", "def get_domain():\n domain=\"\"\n for item in re.split(\"\\.\", env.host)[1:]:\n domain = domain + \".\" + item\n return domain.lstrip(\"....
[ "0.7618404", "0.7578766", "0.74346465", "0.7433089", "0.742805", "0.72598284", "0.72509205", "0.72080994", "0.71380097", "0.7086173", "0.7072636", "0.7072636", "0.70698726", "0.70644397", "0.7059106", "0.7052774", "0.7043056", "0.70237607", "0.69971645", "0.6892797", "0.68827...
0.78243244
0
Create a circle mask.
def circle_mask(width, ratio): # taken from Paul's code mask = np.zeros((width, width), dtype=np.float32) center = width // 2 radius = ratio * center y, x = np.ogrid[-center:width - center, -center:width - center] mask_check = x * x + y * y <= radius * radius mask[mask_check] = 1.0 retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_circle_mask(center_y, center_x, radius):\n\n circle = draw.circle(center_y, center_x, radius)\n\n return circle", "def createCircularMask(shape, radius=4, center=None):\n w = shape[0]\n h = shape[1]\n if center is None: \n center = [int(w/2), int(h/2)]\n ...
[ "0.8766884", "0.81500834", "0.7790507", "0.7766674", "0.76388115", "0.76090956", "0.75531393", "0.7359383", "0.72413415", "0.7224996", "0.72002417", "0.6873268", "0.68332684", "0.68059593", "0.6794593", "0.67885506", "0.67329526", "0.67173964", "0.6679737", "0.66779953", "0.6...
0.77203965
4
Render the main Github stats view
def index(request): if request.method == 'POST': form = AddGitHubUserForm(request.POST) if form.is_valid(): # TODO(itamar): make this async to avoid request timeout user = GitHubUser.make_user(form.cleaned_data['username']) else: form = AddGitHubUserForm() al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statistics():\n return render_template('statistics.html'), 200", "def stats(request):\n \n return render(request, 'stats.html')", "def index(request):\n copy = '2018 ' + author\n\n context = dict(author=author, copyright=copy, repo_url=repo_url)\n\n return render(request, 'index.html', co...
[ "0.6819067", "0.6787305", "0.638312", "0.6342737", "0.6268916", "0.6253234", "0.61611587", "0.6131109", "0.6124636", "0.6092433", "0.6048323", "0.6030266", "0.6009829", "0.5985238", "0.59847295", "0.5966748", "0.5959749", "0.59556603", "0.5896294", "0.5896294", "0.5890848", ...
0.0
-1
Computes the sampling probability for scheduled sampling using inverse sigmoid.
def _compute_sampling_threshold(global_step, k): return k / (k + math.exp(global_step / k))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(t):\n\tprecLim = 10\n\t\n\tt[t<=-precLim] = 0\n\tt[t>-precLim] = 1/ (1 + np.exp(-t))\n\n\treturn t", "def sigmoid(x):\n return 1 / (1 - (power(e,-x)))", "def sigmoid(t):\n return 1 / (1 + np.exp(-t))", "def _sigmoid(x):\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\r\n return 1 /...
[ "0.64867145", "0.6486586", "0.64809066", "0.64515716", "0.64411783", "0.64293915", "0.640807", "0.640807", "0.63982797", "0.6397821", "0.6390894", "0.6390894", "0.6390894", "0.6390894", "0.6390894", "0.6390894", "0.63685536", "0.6368346", "0.63604724", "0.6358248", "0.6357634...
0.0
-1
Returns a list of notifier classes in the registry.
def notifiers(self): return self.registry.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_notifiers(self):\n _notifiers = []\n for notifier in (self.notifiers or\n settings.ACTIVITIES_DEFAULT_NOTIFIERS):\n if isinstance(notifier, str):\n notifier = notifier_registry.get(notifier)\n else:\n notifier = notif...
[ "0.71155614", "0.6832109", "0.6798664", "0.6798664", "0.6798664", "0.6798664", "0.6798664", "0.6798664", "0.67130214", "0.66954243", "0.65584815", "0.64868057", "0.6474896", "0.64188045", "0.6377732", "0.6322927", "0.63071007", "0.6266645", "0.62628615", "0.6260661", "0.62599...
0.67288476
8
If the current user is authenticated, directly route to dashboard.
def index(): if current_user.is_authenticated: return redirect(url_for('home')) return render_template('index.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_dashboard():\n if current_user.is_admin:\n return render_template(\"home/admin_dashboard.html\", title=\"Admin Dashboard\")\n\n abort(403)", "def get(self):\n user = self.get_active_user()\n if user:\n self.render_newpage(user=user)\n else:\n self...
[ "0.6823933", "0.66756296", "0.66665274", "0.6544777", "0.6541027", "0.6535879", "0.6492684", "0.64501256", "0.6395559", "0.6356666", "0.6342406", "0.6320861", "0.6308646", "0.62974495", "0.62781143", "0.6276214", "0.6276214", "0.62467945", "0.6242847", "0.62306714", "0.622544...
0.61880785
27
Registers the user and sets a hashed password.
def register(): form = RegistrationForm(request.form) if request.method == 'POST' and form.validate(): hash_var = pbkdf2_sha256.encrypt(form.password.data, rounds=200000, salt_size=16) user = Users(form.email.data, hash_var) db.session.add(user) db.session.commit() login_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_user(self):\n User.add_user(User(self.email.data, self.password.data))", "def set_password(self, user, password):\n hashed_password = self.hash_password(password)\n server_name = self.get_server_name()\n hookenv.log(\"Storing hash: {}\".format(hashed_password), hookenv.DE...
[ "0.77806985", "0.7229552", "0.70409644", "0.7012111", "0.69044983", "0.68274784", "0.6786985", "0.67286086", "0.6728315", "0.67100847", "0.67041004", "0.6647833", "0.6639575", "0.6607124", "0.6585375", "0.65755326", "0.6562504", "0.6557068", "0.6555503", "0.6551017", "0.65487...
0.648321
26
Given user_id, return the associated User object.
def user_loader(user_id): return Users.query.get(user_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_by_id(user_id):\n\n return User.query.get(user_id)", "def get(self, user_id):\n return User.get(user_id)", "def get_user_from_id(user_id):\n return Users.query.filter_by(id=user_id).first()", "def get_user(self, user_id):\n User = get_user_model()\n try:\n ...
[ "0.84712285", "0.83936065", "0.8368699", "0.82852244", "0.8246819", "0.82448286", "0.8243413", "0.822687", "0.8179028", "0.8177211", "0.8177211", "0.81507134", "0.81507134", "0.81507134", "0.81507134", "0.7941718", "0.7908995", "0.7870521", "0.78473383", "0.78203225", "0.7785...
0.0
-1
Return the bool of whether RSTP is enabled.
def ms_get_rstp_enabled(self): self.open_route('/configure/switch_settings', "Switch") dropdown_value = page_utils.get_dropdown_value( self.get_page(), var_id='node_group_use_stp') return dropdown_value == 'Enable RSTP'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_enabled(self) -> pulumi.Output[bool]:\n return pulumi.get(self, \"is_enabled\")", "def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")", "def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")", "def enabled(self) -> bool:\n return pulumi.get(self, ...
[ "0.7194349", "0.7160575", "0.7160575", "0.7160575", "0.7160575", "0.7160575", "0.7160575", "0.71315926", "0.71315926", "0.71315926", "0.71315926", "0.71315926", "0.71315926", "0.71315926", "0.71315926", "0.70494854", "0.700399", "0.69757503", "0.69751245", "0.6972934", "0.696...
0.79867226
0
Register a LinkCallback providing the implementation for the Link for a particular backend.
def register_callback(cls, backend, callback): cls._callbacks[backend][cls] = callback
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, callback):\n self.callback = callback", "def register_callback(self, callback):\n self.callbacks.add(callback)", "def registerCallback(self, cb, *args):\n\n conn = len(self.callbacks)\n self.callbacks[conn] = (cb, args)\n return conn", "def add_callback(s...
[ "0.6438172", "0.640721", "0.6394827", "0.6273493", "0.62365454", "0.6154329", "0.60415494", "0.6038855", "0.60354584", "0.6029309", "0.60273", "0.59802276", "0.5931468", "0.59200925", "0.5892719", "0.58862734", "0.5883498", "0.5853362", "0.58272624", "0.5738057", "0.5736773",...
0.6965264
0
SparseSparse matrix multiplication. Output will be copied into dense `out` matrix. This function can be applied to CPU or CUDA tensors (but all tensors must be on the same device).
def sparse_matmul(A: SparseTensor, B: SparseTensor, out: torch.Tensor) -> torch.Tensor: if A.nnz() == 0 or B.nnz() == 0: return out if A.is_cuda: return _sparse_matmul_cuda(A, B, out) else: return _sparse_matmul_cpu(A, B, out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sparse_matmul_cuda(A: SparseTensor, B: SparseTensor, out: torch.Tensor):\n from falkon.sparse.sparse_helpers import spspmm, csr2dense\n\n if not A.is_csr:\n raise ValueError(\"A must be CSR matrix\")\n if not B.is_csr:\n raise ValueError(\"B must be CSR matrix\")\n\n # 2. MatMul\n ...
[ "0.6860165", "0.6649118", "0.64669234", "0.60196674", "0.6008235", "0.5968241", "0.5790825", "0.57601863", "0.5711573", "0.5655556", "0.55956006", "0.5584358", "0.5581835", "0.5581835", "0.55582434", "0.54979575", "0.5485175", "0.5448889", "0.54334295", "0.54320043", "0.54174...
0.72344065
0
Rowwise squared l2 norm of a sparse 2D matrix. The operation is equivalent to squaring all elements of the matrix, and summing up the rows.
def sparse_square_norm(A: SparseTensor, out: torch.Tensor) -> torch.Tensor: if not A.is_csr: raise RuntimeError("Squared norm can only be applied on CSR tensors") if not check_same_dtype(A, out): raise ValueError("All data-types must match") if A.shape[0] != out.shape[0]: raise Value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inner_product_to_L2_square(matrix):\n\n length = matrix.shape[0]\n squared_norm = np.reshape(np.diag(matrix), (length, 1))\n\n return squared_norm + np.transpose(squared_norm) - 2 * matrix", "def inner_product_to_normalized_L2_square(matrix):\n\n length = matrix.shape[0]\n norm = np.divide(1, ...
[ "0.7117264", "0.69637316", "0.6779424", "0.67528653", "0.67504", "0.67504", "0.66562766", "0.6592972", "0.6575342", "0.6449741", "0.6425728", "0.63997", "0.62898177", "0.6270818", "0.6267802", "0.6229614", "0.6200041", "0.6199835", "0.6168866", "0.6168839", "0.61506224", "0...
0.6634474
7
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def calc_dist(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat / 2) ** 2 + cos(lat1) * cos(lat2) * sin(dlon / 2) ** 2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.81444913", "0.78628397", "0.76311773", "0.7604652", "0.75954515", "0.75949824", "0.7592846", "0.757015", "0.75629693", "0.7554376", "0.752855", "0.7515809", "0.7492531", "0.7465686", "0.7450806", "0.74330103", "0.73909706", "0.73566103", "0.73473287", "0.7329735", "0.73278...
0.7028556
49
2D gaussian mask should give the same result as MATLAB's fspecial('gaussian',[shape],[sigma])
def matlab_style_gauss2D(shape,sigma): m,n = [(ss-1.)/2. for ss in shape] y,x = np.ogrid[-m:m+1,-n:n+1] h = np.exp( -(x*x + y*y) / (2.*sigma*sigma) ) h[ h < np.finfo(h.dtype).eps*h.max() ] = 0 sumh = h.sum() if sumh != 0: h /= sumh return h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian(size,sigma):\n a,b=np.ogrid[-size/2:size/2,-size/2:size/2]\n mask = a**2+b**2\n mask = np.exp(-mask.astype('float')/(2*float(sigma**2)))\n return mask", "def fspecial_gaussian(shape=(3, 3), sigma=0.5):\n m, n = [(ss - 1.) / 2. for ss in shape]\n y, x = np.ogrid[-m:m + 1, -n:n + 1]\...
[ "0.7830456", "0.756351", "0.72270316", "0.7156208", "0.6948441", "0.6849707", "0.6788711", "0.67704195", "0.675055", "0.675055", "0.6715782", "0.67129564", "0.66879165", "0.66752213", "0.66421515", "0.66121954", "0.6583791", "0.65671456", "0.6559635", "0.6506034", "0.6504701"...
0.66812015
13
Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts.
def merge_dicts(*dicts): result = {} for d in dicts: result.update(d) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)", "def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)", "def merge_dict(lhs, rhs, override=True):\n if not isinstance(lhs, dict) or not isinstance(rhs, dict):\n if override:\n retur...
[ "0.76666087", "0.7660024", "0.7477783", "0.7452349", "0.7452349", "0.7452349", "0.73742205", "0.734022", "0.7306342", "0.7278467", "0.72731894", "0.72538626", "0.72516036", "0.72516036", "0.72516036", "0.72516036", "0.72516036", "0.72516036", "0.72314394", "0.72206295", "0.72...
0.71577954
26
Gets model's features on the given inputs.
def get_model_feature( model, batch_x ): features = model.get_feature(batch_x, training=False) return features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_features_for_input(self, inputs):\n inputs = inputs.to(self.device)\n with torch.no_grad():\n features = self.model.encode(inputs)\n return features", "def extract_features(self, inputs):\n pass", "def extract_features(self, inputs):\n x = self.conv1(inputs...
[ "0.8400616", "0.7977793", "0.77038205", "0.7677214", "0.72801375", "0.7212278", "0.701948", "0.6908011", "0.67576694", "0.6663368", "0.66137624", "0.65661025", "0.64933974", "0.6492246", "0.6443386", "0.6392165", "0.62720567", "0.6254876", "0.6237003", "0.62164605", "0.620948...
0.73535985
4
Gets model's margins on the given inputs.
def get_model_margin( model, batch_x ): outputs = model(batch_x, training=False) sorted_outputs = tf.sort(outputs, direction='DESCENDING', axis=1) margins = sorted_outputs[:, 0] - sorted_outputs[:, 1] return margins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def margins(self) -> tuple[int, int, int, int]:\n return self._widget._mgui_get_margins()", "def margin(self) -> Tuple[int, int, int, int]:\n return (self.imargin[0].to_pixels(self.parent.width),\n self.imargin[1].to_pixels(self.parent.width),\n self.imargin[2].to_pixe...
[ "0.6920656", "0.643909", "0.6386788", "0.6292267", "0.6149117", "0.60865736", "0.6047428", "0.5895864", "0.58437055", "0.5739422", "0.57305235", "0.56391114", "0.554308", "0.5465631", "0.53215337", "0.52851737", "0.52745605", "0.5225098", "0.52216154", "0.51884097", "0.512918...
0.7220013
0
Gets ensemble model's features on the given inputs.
def get_ensemble_model_feature( models, batch_x ): batch_feature_list = [] for model in models: batch_feature = model.get_feature(batch_x, training=False) batch_feature_list.append(batch_feature) # Concatenates the features of the models in the ensemble. concat_batch_feature = tf.concat(batch_fe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_features_for_input(self, inputs):\n inputs = inputs.to(self.device)\n with torch.no_grad():\n features = self.model.encode(inputs)\n return features", "def extract_features(self, inputs):\n x = self.conv1(inputs)\n x = self.bn1(x)\n x = self.relu(x)\n ...
[ "0.7796322", "0.7563362", "0.7558548", "0.7492285", "0.7176713", "0.7004927", "0.6809105", "0.6694236", "0.66772443", "0.6660724", "0.6561689", "0.65109205", "0.65109193", "0.64722025", "0.644351", "0.63942045", "0.63567543", "0.635088", "0.63312244", "0.63093793", "0.6271999...
0.7077079
5
Evaluates model's crossentropy loss on the dataset.
def evaluate_loss( model, ds, loss_func_name = 'CE' ): loss = 0 if loss_func_name == 'CE': loss_func = tf.keras.losses.SparseCategoricalCrossentropy( reduction=tf.keras.losses.Reduction.SUM ) else: raise ValueError(f'Not supported loss function {loss_func_name}!') n = 0 for bat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, X, y):\n y_pred = self.predict(X)\n return self.cross_entropy_loss(y, y_pred)", "def evaluate(self, dataset, *args, **kwargs):\n\n losses = []\n for sample in dataset:\n output = self.predict(sample, *args, **kwargs)\n losses.append(self.metric...
[ "0.7403949", "0.70643187", "0.6998887", "0.69025266", "0.68017304", "0.67919713", "0.6778915", "0.67183614", "0.6715214", "0.67043793", "0.66702735", "0.6664677", "0.6636489", "0.66291314", "0.65847474", "0.65713906", "0.6568213", "0.65642107", "0.6563219", "0.65564483", "0.6...
0.69415814
3
Load a Mopedmodeling YAML config file.
def load(self, config_file): try: with open(config_file, 'r') as fp: data = yaml.load(fp) for key in data: if hasattr(self, key): setattr(self, key, data[key]) # If we didn't assign a name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(yaml_name):\n print('training network configuration file is {0}'.format(yaml_name))\n util.check_file_exist(yaml_name)\n config = util.load_yaml_file(yaml_name)\n return config", "def load_config():\n proj_dir = os.path.dirname(os.path.abspath(__file__))\n config_path = os.path.jo...
[ "0.69565684", "0.69238794", "0.6858291", "0.6841398", "0.67981935", "0.67842054", "0.6782866", "0.67827344", "0.6774935", "0.6700422", "0.6685077", "0.6682819", "0.6668596", "0.6664087", "0.6659172", "0.6658441", "0.6657666", "0.6643049", "0.6639861", "0.65983355", "0.6592095...
0.0
-1
Initialize PointInfo with locs, desc, cam_id.
def __init__(self, locs = None, desc = None, cam_id = None): self.locs = locs self.desc = desc self.cam_id = cam_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, points):\n self.points = points\n self.init()", "def __init__(self, point=None):\n\t\tif point is None:\n\t\t\tpoint = (0,0)\n\t\tself.x = point[0]\n\t\tself.y = point[1]", "def __init__(self, lon: float = 0, lat: float = 0):\n super(Point2D, self).__init__(lon, lat)", ...
[ "0.6181243", "0.61438036", "0.61338145", "0.59951645", "0.5963096", "0.5951045", "0.594447", "0.5933753", "0.5880865", "0.5866702", "0.5815802", "0.58104825", "0.577835", "0.577663", "0.5720085", "0.568429", "0.56764793", "0.56727016", "0.56654525", "0.56629884", "0.5600262",...
0.7010697
0
Apply rigid 3D transformation to model. This function is useful to align a MOPED model (arbitrary axes) so that it corresponds to a known scale and axis. The fields 'pts3D' and 'cam_poses' are updated.
def transform(self, R, t, scale = 1): # Build 4-by-4 projection matrix from args ---------------------------- # This is what we are doing internally: # Proj = np.r_[ scale * np.c_[R, t], [[0, 0, 0, 1]] ] # InvProj = np.r_[ scale * np.c_[R.T, -np.dot(R.T, t)], [[0,0,0,scale]] ] P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center3d():\n # Get selected transform list\n selTransformList = mc.ls(selection=True, long=True)\n if len(selTransformList) == 0:\n mc.warning(\"Select one or more Transform Nodes\")\n return\n\n # Check if imagePlane is in selection list\n for selTransform in selTransformList:\n ...
[ "0.6069621", "0.6068405", "0.58936274", "0.5847731", "0.57482713", "0.57323974", "0.572919", "0.5695031", "0.566867", "0.566494", "0.566323", "0.56565136", "0.5645098", "0.5555037", "0.55501115", "0.5531103", "0.552245", "0.5509203", "0.5508304", "0.5491474", "0.5486474", "...
0.63741857
0
convert node to string
def __str__(self): return str(self.__data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodeToString(cls, node):\n return lxml.etree.tostring(node, method='html').decode()", "def as_str(node):\n node_string = ' '.join(k for k, _ in node.leaves())\n return u' '.join(node_string.split())", "def test_node_to_str(self):\n f = lws.node_to_str\n # normal\n ...
[ "0.8331965", "0.82182574", "0.76223266", "0.72551405", "0.72269905", "0.71409893", "0.7045778", "0.69267035", "0.69236785", "0.690379", "0.6856993", "0.6812192", "0.6744112", "0.6740997", "0.6740996", "0.67264885", "0.66993773", "0.6690935", "0.66826755", "0.66760933", "0.667...
0.0
-1
initialize a singly linked list
def __init__(self): self.__head = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, lst=[]):\n self.__length = 0 # current length of the linked list\n self.__head = None # pointer to the first node in the list\n for e in lst: # initialize the list,\n self.add(e) # by adding elements one by one", "def __init__(self):\n node = ListNode...
[ "0.78083444", "0.76586807", "0.7582945", "0.7520789", "0.74281234", "0.74161446", "0.7382752", "0.73798484", "0.7359489", "0.73444897", "0.7321385", "0.73171395", "0.7315219", "0.7302377", "0.7302377", "0.7271583", "0.72462326", "0.7244291", "0.7244291", "0.7244291", "0.72442...
0.6875056
74
Reset trainable network parameters (factorized gaussian noise).
def reset_parameters(self): mu_range = 1 / math.sqrt(self.in_features) self.weight_mu.data.uniform_(-mu_range, mu_range) self.weight_sigma.data.fill_( self.std_init / math.sqrt(self.in_features) ) self.bias_mu.data.uniform_(-mu_range, mu_range) self.bias_sigma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_parameters(self) -> None:\n std = math.sqrt(3 / self.in_features)\n self.weight.data.uniform_(-std, std)\n self.bias.data.uniform_(-std, std)", "def reset_parameters(self):\n model_utils.truncated_normal_(self.weight, mean=0.0, std=0.1)\n model_utils.truncated_normal_...
[ "0.7617915", "0.7508924", "0.7274491", "0.72522336", "0.7234711", "0.72258276", "0.72258276", "0.72258276", "0.7135332", "0.7124662", "0.71216637", "0.7103422", "0.70747775", "0.70641387", "0.70641387", "0.7062052", "0.7049134", "0.70391566", "0.70145386", "0.6930886", "0.690...
0.727579
2
remove duplicates from a list of hashables, keeping order
def unique(li): seen = set() seen_add = seen.add return [x for x in li if not (x in seen or seen_add(x))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_duplicates(input_list):\n return list(OrderedDict.fromkeys(input_list))", "def remove_duplicates(input_list):\n return list(dict.fromkeys(input_list))", "def _uniq(self, lst):\n h = {}\n for e in lst:\n h[e] = 1\n return sorted(h.keys())", "def removeDups(lst...
[ "0.791706", "0.7821127", "0.76029545", "0.75960547", "0.7431756", "0.7401797", "0.73761046", "0.7348887", "0.73096263", "0.73010904", "0.7271795", "0.724598", "0.72449076", "0.719822", "0.717741", "0.7099763", "0.70880127", "0.7035358", "0.69921213", "0.6941157", "0.69064134"...
0.72240907
13
Return the output tensor at the given index.
def _get_output_tensor(self, index): output_details = self._interpreter.get_output_details()[index] tensor = np.squeeze(self._interpreter.get_tensor(output_details['index'])) return tensor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_tensor(index):\n output_details = interpreter.get_output_details()[index]\n tensor = np.squeeze(interpreter.get_tensor(output_details['index']))\n return tensor", "def get_output_tensor(self, index):\n output_details = self.model.get_output_details()[index]\n tensor = np.squ...
[ "0.87351835", "0.87322223", "0.8662991", "0.8395132", "0.8366491", "0.8366491", "0.8366491", "0.7527034", "0.7176715", "0.67831147", "0.6718036", "0.6621825", "0.65628904", "0.6528218", "0.65079767", "0.6489946", "0.6340246", "0.6294931", "0.6201866", "0.6177447", "0.6152569"...
0.85986006
3
Resolve a given relative path against the base directory given by config. Return path unchanged, if it is absolute.
def resolve_config_path(config: Mapping[str, Any], path: str) -> str: if is_absolute_path(path): abs_path = path else: base_dir = get_base_dir(config) abs_path = f"{base_dir}/{path}" # Resolve ".." and "." in path if "://" in abs_path: scheme, host_path = abs_path.split("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_relative_path(path):\n if os.path.isabs(path):\n return path\n root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))\n return os.path.join(root_dir, path)", "def resolve(self, path=''):\n path = self._sep.join([self.root] + path.split('/'))\n ...
[ "0.7482547", "0.7424582", "0.73036957", "0.7032041", "0.6941662", "0.67737186", "0.67696434", "0.66793716", "0.66403276", "0.66340953", "0.6595137", "0.65875256", "0.64567816", "0.6435037", "0.6383054", "0.6301616", "0.62616", "0.62280864", "0.62003714", "0.6192767", "0.61619...
0.75381917
0
Convert a corpus to a list of lowercase words using white space as the delimiter, preserving the order of words. Insert start(s) at start of sentences according to the size of the ngram, replace punctuation that terminates a sentence with end. Remove all other punctuation.
def tokenize(self, corpus: str, n: int): corpus = self._parse_punctuation(corpus) corpus = corpus.lower() tokenized_corpus = corpus.split() for i in range(n - 1): tokenized_corpus.insert(0, self.TOKENS.STRT.value) if tokenized_corpus[len(tokenized_corpus) - 1] != self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_corpus(corpus): \n \n # print 'preprocessing words'\n # remove space\n # text = re.findall(r'\\w+', corpus) # for [a-zA-Z0-9_]\n text = re.findall(r'[a-zA-Z]+', corpus) # for [a-zA-Z] keep words only no numbers and '_' \n words = [w.lower() for w in text]\n # print words \n ...
[ "0.6909934", "0.69004166", "0.67835337", "0.670156", "0.6674127", "0.6670297", "0.6616926", "0.65456074", "0.6537721", "0.65121937", "0.65082383", "0.65044063", "0.6475626", "0.64646393", "0.64249426", "0.6413282", "0.6395923", "0.6351571", "0.6337604", "0.63112503", "0.63021...
0.6212141
34
Make list of words that make up an ngram according to size of n. Can also make the ngram preceding each word.
def _make_ngrams(self, tokenized_corpus: list, corpus_token_index: int, n: int, make_pre_word_ngram=False): ngrams = [] end_i = 0 if make_pre_word_ngram else -1 for i in range(n - 1, end_i, -1): ngrams.append(tokenized_corpus[corpus_token_index - i]) return tuple(ngrams)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ngrams(word_list, n):\n yield zip(*[word_list[i:] for i in range(n)])", "def word2ngrams(text, n=3):\n return [text[i:i+n] for i in range(len(text)-n+1)]", "def n_gram(list, n):\n ngrams = zip(*[list[i:] for i in range(n)])\n return [\" \".join(ngram) for ngram in ngrams]", "def ng...
[ "0.8449973", "0.83471453", "0.81231475", "0.8114405", "0.81035113", "0.8102586", "0.7990484", "0.78982997", "0.7888925", "0.78723454", "0.783445", "0.7809138", "0.76951313", "0.7678311", "0.7665776", "0.76310253", "0.76204985", "0.7593198", "0.75571394", "0.7436135", "0.74361...
0.7774178
12
Compute a list of probabilities of ngrams in a corpus, sampled with a sliding window of one word, in the normal lefttoright direction of English text. Can employ Laplacian smoothing by assigning occurrence of ngram ending with UNK to 1 (sum of 0 + 1).
def compute_probabilities_per_word(self, corpus: str, n: int, use_Lap_smooth=False): tokenized_corpus = self.tokenize(corpus, n) ngrams_and_pre_word_ngrams = self.make_ngrams_and_pre_word_ngrams(tokenized_corpus, n) ngram_occurrences = self._count_occurrences(tokenized_corpus, n) pre_ngr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ngramlogprobs_fromcorpus(tokenizedseqs, n):\n return", "def get_ngramlogprobs(freqdict):\n return", "def word2ngrams(text, n=3):\n return [text[i:i+n] for i in range(len(text)-n+1)]", "def estimate_probabilities(previous_n_gram, n_gram_counts, n_plus1_gram_counts, vocabulary, k=1.0):\r\n ...
[ "0.67714757", "0.6585946", "0.6475615", "0.6426006", "0.64133203", "0.6354042", "0.62784386", "0.6261772", "0.6257932", "0.6204315", "0.61938274", "0.61527073", "0.6150367", "0.610769", "0.6086413", "0.6074309", "0.6053449", "0.6048103", "0.6026025", "0.6015344", "0.59995276"...
0.5818031
37
Calculate vocabulary size of corpus (for training), as the number of distinct tokens including UNK (not including start and end tokens, divided by the total number of words in the corpus.
def calculate_vocabulary_size(self, corpus: str): corpus_tokens_less = self._tokenize_less_start_end(corpus) Lap_smooth_suppl = 1 num_of_distinct_tokens = len(set(corpus_tokens_less)) V = num_of_distinct_tokens + Lap_smooth_suppl return V
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vocabulary_size(self):\n return len(self.vocab)", "def vocabularySize(self):\n return len(self.vocab.keys())", "def corpus_size():\n return ix.doc_count()", "def vocab_size(self) -> int:\n return len(self.vocabulary)", "def vocab_size(self):\n return self._vocab_size", "def...
[ "0.746306", "0.7352853", "0.73325956", "0.73102176", "0.72555244", "0.7233731", "0.7233731", "0.7225566", "0.68752635", "0.6861664", "0.6849121", "0.6811493", "0.67795384", "0.67564076", "0.667587", "0.6654501", "0.6632594", "0.66219085", "0.6594525", "0.6588352", "0.6576736"...
0.8674432
0
Calculates RMSD from initial state s0 along trajectory state_trajectory
def calculate_rmsd(s0, state_trajectory): return np.sqrt(calculate_msd(s0, state_trajectory))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_msd(s0, state_trajectory):\n s_0 = np.array(s0)\n st = np.asarray(state_trajectory)\n msd = np.sum((st-s_0)**2, axis=-1)\n return msd", "def get_S_r(self):\n\n S_r = np.sum((self.eta_model - self.eta_exp) ** 2.)\n\n return S_r", "def target_state(self, s):\n if s > self.t...
[ "0.7728926", "0.6006215", "0.593627", "0.5880853", "0.57791704", "0.5741547", "0.57397133", "0.570762", "0.57024056", "0.5694547", "0.56476945", "0.5642655", "0.5597415", "0.55889314", "0.5553222", "0.5542348", "0.5539058", "0.5537539", "0.55282885", "0.54779816", "0.54578626...
0.8236417
0
Convert index from flattened upper triangular matrix to pair subindex.
def ind_to_sub(n, ix): k = 0 for i in range(n-1): for j in range(i+1,n): if k==ix: return (i,j) k += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub2ind(self, ix, iy):\n idx = np.ravel_multi_index((ix, iy), self.shape)\n return idx", "def encode_to_flat_array_index(row, column, matrix):\n return row * matrix.cols + column", "def sub2ind(matrixSize, rowSub, colSub):\n m, n = matrixSize\n return rowSub * (n-1) + colSub - 1", ...
[ "0.6220416", "0.61667466", "0.6098016", "0.6017521", "0.5988121", "0.5958607", "0.5939187", "0.5852096", "0.58470243", "0.58125377", "0.5743587", "0.570285", "0.56947595", "0.5629406", "0.56276226", "0.56131756", "0.5583333", "0.5571509", "0.55649775", "0.55596757", "0.555272...
0.59909457
4
Return unique rows indices of a numeric numpy array.
def unique_rows(mat, return_inverse=False): b = np.ascontiguousarray(mat).view(np.dtype((np.void, mat.dtype.itemsize * mat.shape[1]))) if not return_inverse: _, idx = np.unique(b, return_index=True) else: _, idx = np.unique(b, return_inverse=True) return idx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_rows(array):\n array = np.ascontiguousarray(array)\n # Combine all the rows into a single element of the flexible void datatype\n dtype = np.dtype((np.void, array.dtype.itemsize * array.shape[1]))\n combined_array = array.view(dtype=dtype)\n # Get all the unique rows of the combined array...
[ "0.72966653", "0.71330875", "0.7110418", "0.69618964", "0.6924001", "0.676073", "0.6613013", "0.6507103", "0.64443994", "0.63791454", "0.62952435", "0.6287125", "0.62635094", "0.62058926", "0.6077665", "0.5984382", "0.59432054", "0.5889493", "0.5865529", "0.5755482", "0.57410...
0.6901177
5
Generate all possible binary spin states.
def bin_states(n, sym=False): if n<0: raise Exception("n cannot be <0") if n>30: raise Exception("n is too large to enumerate all states.") v = np.array([list(np.binary_repr(i,width=n)) for i in range(2**n)]).astype(int) if sym is False: return v return v*2-1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_all_states(self):\n self.clingo = ClingoBridge() # reset clingo\n\n base = ('base', '')\n self.clingo.add_file('initial-states.lp')\n self.clingo.run([base])\n output = self.clingo.output\n\n num_states = int(len(output) / 2)\n\n states = np.full(num_s...
[ "0.6314658", "0.5993469", "0.5704833", "0.5702639", "0.5698927", "0.56279147", "0.55876994", "0.5559703", "0.55584943", "0.54852873", "0.5464381", "0.54571587", "0.5377787", "0.53361166", "0.5330843", "0.53244656", "0.52789825", "0.5269117", "0.5269117", "0.5268354", "0.52683...
0.5745846
2
Generator for iterating through all states for Potts model with k distinct states. This is a faster version of calling xbin_states(n, False) except with strings returned as elements instead of integers.
def xpotts_states(n, k): assert n>0, "n cannot be <0" assert k>=2, "k cannot be <2" for i in range(k**n): state = base_repr(i, k) yield ['0']*(n-len(state)) + state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xbin_states(n, sym=False):\n\n assert n>0, \"n cannot be <0\"\n \n def v():\n for i in range(2**n):\n if sym is False:\n yield np.array(list(np.binary_repr(i,width=n))).astype('int')\n else:\n yield np.array(list(np.binary_repr(i,width=n))).as...
[ "0.657001", "0.6036281", "0.6008307", "0.5839257", "0.56808233", "0.55150694", "0.5509951", "0.54692584", "0.54639053", "0.54587126", "0.54567873", "0.5440125", "0.54118186", "0.5400484", "0.5395248", "0.5382987", "0.5379463", "0.5348208", "0.532136", "0.5314528", "0.5309149"...
0.7672833
0
Get probability of unique states. There is an option to allow for weighted counting.
def state_probs(v, allstates=None, weights=None, normalized=True): if v.ndim==1: v = v[:,None] n = v.shape[1] j = 0 return_all_states = False # switch to keep track of whether or not allstates were given if allstates is None: allstates = v[unique_rows(v)] uniqIx = unique_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_probs(self, states, actions):\n # YOUR CODE HERE\n \n probs = np.ones(len(states))/2\n return probs", "def uniform_start_probs(self) -> np.ndarray:\n return np.ones(self.n_states) / self.n_states", "def get_probs(self, states, actions):\n # YOUR CODE HERE\n ...
[ "0.72098875", "0.68719506", "0.681885", "0.66933316", "0.64928764", "0.646415", "0.6455021", "0.6451709", "0.64341277", "0.64116365", "0.63906914", "0.6369575", "0.6304875", "0.62995815", "0.62764776", "0.62749606", "0.6260037", "0.62496746", "0.62049574", "0.620298", "0.6185...
0.6863431
2
Replace diagonal entries of square matrix.
def replace_diag(mat, newdiag): if newdiag.ndim>1: raise Exception("newdiag should be 1-dimensional") if not (mat.shape[0]==mat.shape[1]==newdiag.size): raise Exception("Incorrect dimensions.") return mat - np.diag(mat.diagonal()) + np.diag(newdiag)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero_diag(mat):\n\n return replace_diag(mat, np.zeros(mat.shape[0]))", "def diagonalize(width,height):\r\n A = createBoard(height, width) \r\n \r\n for row in range(height):\r\n for col in range(width):\r\n if row == col:\r\n A[row][col] = 1\r\n else:\r...
[ "0.6818765", "0.6663469", "0.66334283", "0.6589273", "0.6532726", "0.6294296", "0.619446", "0.618863", "0.61355823", "0.6104683", "0.6051159", "0.59297997", "0.5877385", "0.58515203", "0.5838582", "0.58321714", "0.5830014", "0.5796444", "0.5772605", "0.5766806", "0.57219243",...
0.66665506
1
Replace diagonal entries of square matrix with zeros.
def zero_diag(mat): return replace_diag(mat, np.zeros(mat.shape[0]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero_matrix(matrix):\n rows = set()\n columns = set()\n m = len(matrix)\n n = len(matrix[0])\n for i in range(m):\n for j in range(n):\n if matrix[i][j] == 0:\n rows.add(i)\n columns.add(j)\n\n for i in range(m):\n for j in range(n):\n ...
[ "0.76364577", "0.741482", "0.72098637", "0.72076064", "0.7194845", "0.7187605", "0.7179795", "0.71545714", "0.71404755", "0.7116813", "0.71061784", "0.7101403", "0.70931053", "0.7078037", "0.707109", "0.7050938", "0.7049955", "0.70301324", "0.70263463", "0.70243907", "0.70221...
0.7914989
0
This function stores the 10 users in descending order of their weekly scores. While displaying weekly leaderboard users are selected from this table. It remains static for a week
def update_weekly_leaderboard(request): """NOTE:Always execute this after executing Overall leader board""" try: user = UserProfile.objects.order_by('-prev_week_score') count = UserProfile.objects.order_by('-prev_week_score').count() if count > 10: count = 10 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def userboard(self, user):\n reviewed_documents = self.get_reviewed_documents_count_for_user(user)\n count = self.leaderboard().filter(num_entries__gte = reviewed_documents).count()\n count_top = count -3 if count -3 >= 0 else 0\n user_top = self.leaderboard().filter(num_entries__gte = rev...
[ "0.6518284", "0.62911123", "0.62114656", "0.613538", "0.5977623", "0.5976624", "0.59152174", "0.58882964", "0.58437175", "0.573525", "0.57267207", "0.56890243", "0.5650607", "0.563731", "0.56155074", "0.55836856", "0.5561299", "0.5559957", "0.55426884", "0.5540046", "0.553987...
0.6733844
0
Tests the API endpoint to Redeem BLVT without tokenName
def test_redeem_blvt_without_tokenName(): client = Client(key, secret) client.redeem_blvt.when.called_with("", "1").should.throw(ParameterRequiredError)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_access_methods_without_token(self):\n\n print(\" --------------------------- Test 4 - Try Access without token ----------------------------\")\n\n user_id = uuid.uuid4()\n password = \"my-precious\"\n currency = \"EUR\"\n\n register_user(user_id, password, currency)\n\n ...
[ "0.69678366", "0.6823835", "0.68079174", "0.65782005", "0.64727575", "0.64182734", "0.6410921", "0.6350603", "0.6330735", "0.6295604", "0.62089884", "0.6203766", "0.6167417", "0.6161279", "0.61465585", "0.6144366", "0.6102332", "0.6088465", "0.6072441", "0.6067823", "0.606568...
0.77624285
0
Generate random string of given length
def generate_string(str_length): letters = string.ascii_uppercase + ' ' return ''.join(random.choice(letters) for i in range(str_length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length):\r\n return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))", "def generate_random_...
[ "0.8844503", "0.8726719", "0.85819155", "0.85577863", "0.85499674", "0.85491097", "0.8543545", "0.8523494", "0.8522387", "0.8517031", "0.85046446", "0.85040534", "0.84566855", "0.84562707", "0.84507287", "0.8443748", "0.84064084", "0.8395912", "0.8389881", "0.8321455", "0.830...
0.83249706
19
Replace a given character in a string with 5% probability
def mutate_string(s): new_s = '' letters = string.ascii_uppercase + ' ' s = list(s) for i in range(len(s)): if roll_dice(): new_s = new_s + random.choice(letters) else: new_s = new_s + s[i] return new_s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutate(strDna):\n \n strGene = strDna\n for iCount in range(len(strDna)):\n cRandChar = getGeneLetter()\n cReplace = random.choice(strGene)\n\n strGene = strGene.replace(cReplace, cRandChar, 1)\n return strGene", "def replace_char_candidate_typo(self, char):\n i = np....
[ "0.6311851", "0.6193895", "0.61363345", "0.60909975", "0.6055487", "0.5938125", "0.5891487", "0.58658195", "0.5823957", "0.5822421", "0.5802144", "0.57907736", "0.57653373", "0.5752115", "0.56485534", "0.5641217", "0.5561156", "0.55560714", "0.55560714", "0.555528", "0.554232...
0.58330303
8
Compute dot product of ``x`` and ``y``.
def measure(x, y): return dotc_gpu(x, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(x,y):\n\treturn sum([xi*yi for (xi,yi) in zip(x,y)])", "def dot(x, y):\n res = x[0] * y[0]\n for a, b in zip(x, y):\n res += a * b\n return res", "def dotproduct(x, y):\n return sum(imap(operator.mul, x, y))", "def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))", "de...
[ "0.8491295", "0.8296241", "0.8229306", "0.80518425", "0.79082066", "0.75913566", "0.75577414", "0.75301313", "0.7527398", "0.7515738", "0.75053287", "0.74667364", "0.7382237", "0.7381008", "0.73807794", "0.73807794", "0.7375743", "0.73670745", "0.73506725", "0.7253983", "0.72...
0.0
-1
isList(obj) > Returns true if obj is a Python list. This function does not return true if the object supplied is a UserList object.
def isList(obj): return type(obj)==types.ListType
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_list(obj):\n return type(obj) is list", "def is_list(s_list):\n return isa(s_list, List)", "def isList(data):\n\ttry:\n\t\tfrom types import ListType\n\t\tif type(data) == ListType:\n\t\t\treturn True\n\texcept ImportError:\n\t\tif type(data) == type([]):\n\t\t\treturn True\n\treturn False", "de...
[ "0.9034523", "0.7945225", "0.78491604", "0.7847296", "0.7833444", "0.7789604", "0.77525455", "0.7666976", "0.76357245", "0.7575635", "0.7540054", "0.75367045", "0.74248445", "0.7335114", "0.7294102", "0.7270129", "0.7133863", "0.70564574", "0.69643503", "0.6943497", "0.689898...
0.88559943
1
Get the instantaneous velocity of the vehicle
def get_pos_dt(self) -> WAVector: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_velocity(self):\n return self.momentum/self.mass", "def getVelocity(self):\n return self.v", "def velocity(self):\n return self._velocity", "def velocity(self):\n return self._velocity", "def get_velocity(self):\n return (self._I85_msg_from_device(self.node.sdo[0x606c...
[ "0.81550604", "0.8021493", "0.7824219", "0.7824219", "0.773878", "0.7615091", "0.75660264", "0.75613755", "0.7361096", "0.7292588", "0.7203171", "0.71959347", "0.7185026", "0.71544135", "0.71415496", "0.7092134", "0.7079417", "0.70488185", "0.6977106", "0.6965514", "0.6953223...
0.0
-1
Get the angular velocity of the vehicle
def get_rot_dt(self) -> WAQuaternion: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angular_velocity(self):\n trig = gyro_trigger_mode.GET_ANGULAR_VELOCITY_TRIGGER_READ\n if self.__trigger == trig:\n self.read_and_update_angle()\n\n adjusted = (self.__angle - self.__offset)\n if self.__factorSet:\n return adjusted / self.__degPerSecondFactor\n...
[ "0.8059321", "0.7897727", "0.7807798", "0.7697948", "0.7674692", "0.76417446", "0.76417446", "0.76398784", "0.7620011", "0.74393064", "0.71774113", "0.7153626", "0.70817024", "0.7072808", "0.7031192", "0.70142263", "0.70040464", "0.69933337", "0.6984637", "0.69648975", "0.695...
0.0
-1
Calculate mortgage amortization (monthly, yearly)
def amortization_schedule( cls, mortgage_term: int, mortgage_amount: float, interest_rate: float ) -> AmortizationSchedule: monthly_data = [] annual_data = [] payment = cls.payment_calc( years=mortgage_term, interest=interest_rate, mortgage_amount=mortgage_amount ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_calc(mortgage_amount: float, years: int, interest: float) -> float:\n number_months = years * 12\n\n interest_monthly = interest / 100 / 12\n\n numerator = interest_monthly * ((1 + interest_monthly) ** number_months)\n denominator = (1 + interest_monthly) ** number_months - ...
[ "0.6487584", "0.6259489", "0.61939764", "0.61643493", "0.60776573", "0.6062495", "0.6021848", "0.5995979", "0.5958701", "0.5955507", "0.59300846", "0.5859633", "0.5859509", "0.57057583", "0.56838846", "0.5666902", "0.5646642", "0.56455237", "0.5642566", "0.5628647", "0.562696...
0.68517774
0
Removes all the rows and columns that are full of zeros.
def trim_race(self, race): race = race[np.any(race != NOTHING, axis=1), :] # Rows race = race[:, np.any(race != NOTHING, axis=0)] # Columns return race
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_zeros(x):\n assert len(x.shape) == 2\n return x[~np.all(x == 0, axis=1)]", "def zero_matrix(matrix):\n rows = set()\n columns = set()\n m = len(matrix)\n n = len(matrix[0])\n for i in range(m):\n for j in range(n):\n if matrix[i][j] == 0:\n rows.add(...
[ "0.74536926", "0.74197286", "0.71336657", "0.7104906", "0.6959379", "0.6938438", "0.69152904", "0.687545", "0.68144846", "0.6814092", "0.6744852", "0.67090714", "0.66147745", "0.66117287", "0.6605634", "0.659063", "0.65819573", "0.6578627", "0.65643966", "0.65231234", "0.6514...
0.0
-1
Datetime in a format suitable for generating fake XML files to feed timeplot.
def datetime_timeplotxml(self): if self.time: return self.date.strftime("%b %d %Y") + " " + self.time.strftime("%H:%M:%S") + " GMT" else: return self.date.strftime("%b %d %Y") + " " + "00:00:00" + " GMT"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_timeplotxml(self):\n return self.date.strftime(\"%b %d %Y\") + \" \" + \"00:00:00\" + \" GMT\"", "def date_timeplot(self):\n return str(self.date)", "def date_timeplot(self):\n return str(self.date)", "def date_timeplot(self):\n return str(self.date)", "def xmldatet...
[ "0.761962", "0.71846664", "0.71846664", "0.71846664", "0.70496804", "0.68589175", "0.6773855", "0.6747785", "0.67126924", "0.6637275", "0.65375906", "0.6527248", "0.6506784", "0.65020233", "0.649874", "0.6492056", "0.64541537", "0.6443951", "0.6443528", "0.64197046", "0.64103...
0.7601324
1
Datetime in a format suitable for generating fake XML files to feed timeplot.
def datetime_timeplotxml(self): return self.date.strftime("%b %d %Y") + " " + "00:00:00" + " GMT"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_timeplotxml(self):\n if self.time:\n return self.date.strftime(\"%b %d %Y\") + \" \" + self.time.strftime(\"%H:%M:%S\") + \" GMT\"\n else:\n return self.date.strftime(\"%b %d %Y\") + \" \" + \"00:00:00\" + \" GMT\"", "def date_timeplot(self):\n return str(s...
[ "0.7600319", "0.71850157", "0.71850157", "0.71850157", "0.7048055", "0.6858682", "0.67739093", "0.6748223", "0.6713253", "0.66371894", "0.6537068", "0.6527517", "0.650657", "0.65000445", "0.64990854", "0.6491356", "0.6452532", "0.64425963", "0.64421767", "0.6419546", "0.64092...
0.76186186
0
Sets up the optimization scheme
def configure_optimizers(self): optimizer = torch.optim.Adam(self.parameters(), lr=1e-3) return optimizer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_solver(self):\n option = Options()\n if logger.getEffectiveLevel() == logging.DEBUG:\n # option.printLevel = PrintLevel.HIGH\n option.printLevel = PrintLevel.NONE\n else:\n option.printLevel = PrintLevel.NONE\n self.solver_minimizing = SQProble...
[ "0.68792874", "0.66135776", "0.66088444", "0.66001785", "0.65226376", "0.64388984", "0.6419879", "0.6399884", "0.6379564", "0.6320737", "0.63067204", "0.62696296", "0.6252122", "0.62463", "0.6210827", "0.61129", "0.6106012", "0.61041033", "0.60489315", "0.60441214", "0.603058...
0.0
-1
Sets up the optimization scheme
def configure_optimizers(self): optimizer = torch.optim.Adam( self.parameters(), lr=self.hparams["learning_rate"] ) return optimizer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_solver(self):\n option = Options()\n if logger.getEffectiveLevel() == logging.DEBUG:\n # option.printLevel = PrintLevel.HIGH\n option.printLevel = PrintLevel.NONE\n else:\n option.printLevel = PrintLevel.NONE\n self.solver_minimizing = SQProble...
[ "0.68792874", "0.66135776", "0.66088444", "0.66001785", "0.65226376", "0.64388984", "0.6419879", "0.6399884", "0.6379564", "0.6320737", "0.63067204", "0.62696296", "0.6252122", "0.62463", "0.6210827", "0.61129", "0.6106012", "0.61041033", "0.60489315", "0.60441214", "0.603058...
0.0
-1
Return a unicode representation of the exception message.
def __unicode__(self): return unicode(self.args[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception_message(self):\n # type: () -> string_types\n return self._exception_message", "def exception_message(self) -> str:\n return pulumi.get(self, \"exception_message\")", "def exception_msg(exception):\n if hasattr(exception, 'message'):\n return str(exception.message)\...
[ "0.79872286", "0.78442556", "0.7642504", "0.7578385", "0.7256937", "0.70916015", "0.7055222", "0.694551", "0.6903667", "0.6896262", "0.6838885", "0.67391044", "0.6725241", "0.6694937", "0.6658766", "0.6658766", "0.6658766", "0.6638548", "0.6631082", "0.6630395", "0.6621789", ...
0.0
-1
Cut out Values of a given dataset beginning from "fromValue" to "toValue". This function assumes that the first dimension of the dataset is orderd ascending and reflects the xAxis values.
def cut_samples_out( dataSet, fromValue, toValue ): newData = [] for data in dataSet: newData.append( [] ) for tup in zip(*dataSet): if fromValue <= tup[0] and tup[0] <= toValue: for i, val in enumerate( tup ): newData[i].append( val ) return newData
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cut_dataframe(start, end):\n data = get_dataframe(start, end)\n nrow = data.shape[0]\n data.loc[0, 'from'] = start\n data.loc[0, 'delta'] = data.loc[0, 'to'] - start\n if data.loc[nrow-1, 'to'] > end:\n data.loc[nrow-1, 'to'] = end\n data.loc[nrow-1, 'delta'] = end - data.loc[n...
[ "0.5697572", "0.5638063", "0.5602279", "0.5498198", "0.5466695", "0.5385294", "0.5322709", "0.5322709", "0.53112674", "0.52842146", "0.5242307", "0.5133078", "0.5100356", "0.5086364", "0.5063078", "0.49841172", "0.49736372", "0.49708834", "0.49494633", "0.4945881", "0.4935054...
0.75804305
0
Get the color of a node in the tree
def get_node_color(node_label): for NODE_KEY in list(NODE_TYPES.keys()): if node_label in NODE_TYPES[NODE_KEY]: return NODE_COLOR_DICT[NODE_KEY] try: x = int(node_label) return NODE_COLOR_DICT['Terminals'] except: try: x = float(node_label) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color(self, node: Node) -> str:\n\n idx = hash(node.get_kind_name()) % len(self.colors_)\n return self.colors_[idx]", "def get_color(node, color_map):\r\n if node in color_map:\r\n return color_map[node]\r\n return \"black\"", "def get_node_color(self, origin_node_id):\n ...
[ "0.76955146", "0.7130979", "0.7075502", "0.69564354", "0.6928769", "0.67350966", "0.67350966", "0.67350966", "0.6679222", "0.6679088", "0.66723704", "0.66622853", "0.66622853", "0.66622853", "0.66622853", "0.6660124", "0.66277707", "0.6614305", "0.6598142", "0.65887123", "0.6...
0.6891435
5
Initialize a matchList object
def __init__(self): self.matches = {} self.usersInLobby = [] self.lastID = 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, matches=None):\n super(MatchWarehouse, self).__init__()\n\n if matches is None:\n matches = []\n\n self.matches = matches", "def __init__(self, matches, number, start_date=None, end_date=None):\n\n self.matches = matches\n self.number = number\n ...
[ "0.74445736", "0.6776817", "0.6419827", "0.64026994", "0.6393391", "0.63497096", "0.6235516", "0.61387926", "0.61284995", "0.60810715", "0.60534924", "0.5999657", "0.5992352", "0.5936301", "0.59003556", "0.58667624", "0.58600235", "0.58493406", "0.58215636", "0.5792449", "0.5...
0.6554051
2
Call to schedule current learning rate
def __call__(self, num_update): if num_update > self.count: self.base_lr = self.origin_lr * pow((1 - 1.0*num_update/self.max_samples), self.factor) if self.base_lr < self.stop_factor_lr: self.base_lr = self.stop_factor_lr logging.info("Update[%d]: now lear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_learning_rate(self):\r\n self.scheduler.step(self.clock.epoch)", "def __call__(self, epoch):\n # Compute the new dynamic learning rate, log in onto TensorBoard and\n # return the result for the training process\n learning_rate = self.schedule(epoch)\n tf.summary.scal...
[ "0.8229549", "0.8019128", "0.7837845", "0.7581702", "0.7561924", "0.7470505", "0.739445", "0.712", "0.70963514", "0.7093816", "0.7089851", "0.7062276", "0.705441", "0.70389843", "0.7028878", "0.6979073", "0.6951482", "0.69390315", "0.69213116", "0.69197434", "0.69094574", "...
0.65652806
37
The user should be able to make a booking
def test_make_a_booking(self): date = datetime(2030, 3, 1, 11) response = self.client.post(reverse('bookings', kwargs={'facility': 'g'}), { 'book': str(date.timestamp())}) context = response.context bookings = context["bookings"] self.assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_can_not_reserve_booked_block(self):\n booking_other = create_test_booking(self.someone, self.first_day, 11)\n\n response = self.client.post(\n reverse('bookings', kwargs={'facility': 'g'}), {'book': str(booking_other.date.timestamp())})\n\n context = response.context\n ...
[ "0.65733033", "0.6262309", "0.6248513", "0.6232085", "0.6199877", "0.61662143", "0.61391747", "0.6104352", "0.6103857", "0.6099108", "0.609168", "0.6081628", "0.60685664", "0.6051172", "0.6045759", "0.6043005", "0.60311186", "0.6024618", "0.601339", "0.6009465", "0.5926087", ...
0.65740085
0
Should display bookings for selected facility
def test_only_display_bookings_for_selected_facility(self): booking = create_test_booking( self.user, self.first_day, 8, facility='g') response = self.client.get( reverse('bookings', kwargs={'facility': 'g'})) context = response.context bookings = context["booki...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_should_display_selected_facility(self):\n response = self.client.get(\n reverse('bookings', kwargs={'facility': 'h'}))\n\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response.context[\"is_g\"], False)", "def test_do_not_show_bookings_from_unselected_fa...
[ "0.70730275", "0.6802688", "0.628358", "0.607653", "0.6069607", "0.60472393", "0.60439026", "0.5952408", "0.591294", "0.56381917", "0.5492407", "0.5451856", "0.5418347", "0.5402953", "0.53849506", "0.53067315", "0.5282332", "0.52819073", "0.51773065", "0.51677585", "0.5137756...
0.76715374
0
Computes the accuracy over the k top predictions for the specified values of k
def accuracy(output, target, topk=(1,)): with torch.no_grad(): 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).floa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)", "def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua...
[ "0.8331214", "0.8284662", "0.82381004", "0.8229767", "0.82202226", "0.81864446", "0.81847763", "0.8175173", "0.8171541", "0.81699467", "0.81664646", "0.81645083", "0.81637454", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "...
0.78614724
74
parses requirements from requirements.txt
def read_requirements(): reqs_path = os.path.join(__location__, 'requirements.txt') with open(reqs_path, encoding='utf8') as f: reqs = [line.strip() for line in f if not line.strip().startswith('#')] names = [] links = [] for req in reqs: if '://' in req: links.append(re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_requirements_txt():\n root = os.path.dirname(os.path.abspath(__file__))\n\n requirements = []\n dependencies = []\n\n with open(os.path.join(root, 'requirements.txt'), 'r') as f:\n for line in f.readlines():\n line = line.rstrip()\n if not line or line.startswith(...
[ "0.8261331", "0.773876", "0.75876206", "0.75540644", "0.75315946", "0.7514253", "0.7495916", "0.7487109", "0.7451425", "0.7450626", "0.7389462", "0.7381643", "0.7373195", "0.73333806", "0.73200643", "0.72835296", "0.728088", "0.72645885", "0.7158073", "0.71071446", "0.7093100...
0.7664683
2
Remove duplicated words from tokenized data.
def remove_duplicated_words(tokens): return sorted(set(tokens))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_duplicate_words(words):\n clean_words = []\n state = np.ones(len(words))\n while state.any():\n base_idx = state.nonzero()[0][0]\n for idx in range(len(words)):\n base_word = words[base_idx]\n new_word = words[idx]\n\n ...
[ "0.71445256", "0.70917296", "0.6874571", "0.67319804", "0.66220075", "0.65991855", "0.6592135", "0.65364367", "0.6517979", "0.6513646", "0.6507246", "0.6475281", "0.6441893", "0.6431872", "0.6426122", "0.64167345", "0.6391357", "0.6341155", "0.63387936", "0.63320225", "0.6325...
0.83719915
0
Remove stopwords (and, the, unless, about, etc.) from tokenized data.
def remove_stopwords(tokens): return [t for t in tokens if t not in stopwords.words('english')]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stopwords(data):\n stop_words = stopwords.words('english')\n words = word_tokenize(str(data))\n new = \"\"\n for word in words:\n if word not in stop_words and len(word) > 1:\n new = new + \" \" + word\n return new", "def remove_stopwords_fun(self):\n tokens = s...
[ "0.8169409", "0.80082494", "0.7991079", "0.7704265", "0.77015567", "0.7681213", "0.7666058", "0.76279706", "0.76223654", "0.7577843", "0.7562546", "0.75536466", "0.7500464", "0.74909294", "0.7476891", "0.74767596", "0.7466664", "0.74162275", "0.7406267", "0.74060184", "0.7392...
0.78416765
3
Converts single form of word into its plural form.
def convert_single_word_into_plural_form(word): if word.endswith('y'): return word[:-1] + 'ies' elif word[-1] in 'sx' or word[-2:] in ['sh', 'ch']: return word + 'es' elif word.endswith('an'): return word[:-2] + 'en' else: return word + 's'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pluralize(word):\n\n assert word\n assert isinstance(word, basestring)\n assert len(word) > 0\n\n second_last = word[-2]\n last = word[-1]\n if last in ['s', 'z','x']:\n return word + \"es\"\n elif last == 'h':\n if second_last in ['s', 'c']:\n return word + \"es\"...
[ "0.790306", "0.762722", "0.74138546", "0.73063236", "0.7224289", "0.68215835", "0.6714078", "0.6651951", "0.65788925", "0.6479883", "0.64093316", "0.63903713", "0.6383846", "0.63624036", "0.6352076", "0.6330327", "0.63197696", "0.616359", "0.61491525", "0.6075423", "0.6028547...
0.822852
0
Returns element x from X which maximizes function value
def argmax(function, X, tiesolve=None): return argmin(lambda x: -function(x), X, tiesolve)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_max_x(self, Ns=50):\n with self.fix_evaluator():\n x0 = brute(lambda x: -self(x[0])[0], [[0, np.pi]], Ns=Ns,\n finish=None)\n res = minimize_scalar(\n lambda x: -self(x)[0],\n bracket=(x0, np.pi/Ns), bounds=(0, np.pi), method...
[ "0.7010033", "0.70056397", "0.683527", "0.68305373", "0.6755575", "0.6747582", "0.6747582", "0.6736222", "0.67086214", "0.6695453", "0.668586", "0.6672674", "0.66649336", "0.66649336", "0.66649336", "0.66649336", "0.66649336", "0.66649336", "0.66649336", "0.66649336", "0.6664...
0.67547315
5
Returns a default group name for an entry.
def _get_group_name(entry: _MemberDocumenterEntry) -> str: group_name = MEMBER_NAME_TO_GROUP_NAME_MAP.get(entry.name) if group_name is None: if entry.documenter.objtype == 'class': group_name = 'Classes' else: group_name = 'Public members' return group_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStrGroup(self, groupname, default=None):\n \n try:\n value = self.match.group(groupname)\n if value is None: return default\n return value\n except: return default", "def group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self,...
[ "0.7011084", "0.68847287", "0.68847287", "0.6837681", "0.68362194", "0.6744566", "0.668549", "0.6632096", "0.6627966", "0.660757", "0.65161395", "0.65044737", "0.64735377", "0.63730216", "0.63730216", "0.6335591", "0.6314184", "0.6313359", "0.6308101", "0.62939095", "0.629390...
0.75292665
0
Reset the state of the algorithm based on the given state_dict
def set_state(self, state_dict): super().set_state(copy.deepcopy(state_dict)) self._client_state = copy.deepcopy(state_dict.get("_client_state")) self._trials_map = copy.deepcopy(state_dict.get("_trials_map"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset_state(self):\n self.state = self.start_state.copy()", "def reset(self):\n # Sample random state from initial state distribution\n self._cur_state = self._sample_state(self._mdp.I)\n self._prev_state = self._cur_state", "def reset_program_state_dict(args, model, state_dict...
[ "0.73989797", "0.7273473", "0.7268481", "0.7188341", "0.71106577", "0.71034837", "0.71034837", "0.71034837", "0.71034837", "0.71034837", "0.71034837", "0.71034837", "0.71034837", "0.71034837", "0.71034837", "0.71034837", "0.7072804", "0.7072408", "0.6955266", "0.6913521", "0....
0.6637174
37
Get first input name
def first_input(self) -> Optional[str]: try: return next(self.iter_inputs()) except StopIteration: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"first_name\")", "def first_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"first_name\")", "def get_first_name(self):\n element = self.driver.find_element(*self.firstname_textbox_selecto...
[ "0.7944009", "0.7944009", "0.7787763", "0.7275141", "0.7229786", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "0.7216724", "...
0.0
-1
Freeze the node and reduce memory footprint. No further graph construction manipulations are possible after the freezing.
def freeze(self) -> None: self.description = None self.bound_inputs = None # Only for charting purposes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _Freeze(self) -> None:\n self._SetNodes(_FROZEN_NODE_COUNT)", "def Freeze(self):\r\n\r\n self._freezeCount = self._freezeCount + 1", "def freeze(self,):\n pass", "def freeze(self):\n self.collect_params().setattr('grad_req', 'null')", "def unfreeze(self) -> None:\n self._...
[ "0.8140439", "0.6738785", "0.66114765", "0.6468904", "0.64180017", "0.63292307", "0.616592", "0.6103365", "0.5980842", "0.59622616", "0.59428704", "0.5780639", "0.56979173", "0.56715304", "0.5659152", "0.56315184", "0.56121135", "0.560236", "0.55595154", "0.55475754", "0.5524...
0.5246686
31
Returns the filtered queryset based on the query string value.
def queryset(self, request, queryset): states_in_region = [k.upper() for k, v in settings.STATE_NAMES.items()] if self.value() == slugify(settings.REGION_NAME): # e.g. 'New England' return queryset.filter(state__in=states_in_region)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n qs = super().get_queryset()\n search_value = self.request.GET.get('search_box')\n\n if search_value is not None:\n qs = qs.search_by(search_value)\n\n return qs", "def get_queryset(self):\n\n # Get the keyword URL parameter value. Return emp...
[ "0.7303569", "0.67871463", "0.6773138", "0.6759081", "0.6737882", "0.66412413", "0.66301274", "0.6627799", "0.6622906", "0.65955704", "0.65433896", "0.65407723", "0.64867747", "0.647158", "0.64439607", "0.64315325", "0.64268696", "0.63893616", "0.6373919", "0.63686645", "0.63...
0.6069736
41
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): plt.imshow(cm, interpolation='nearest', cmap=cmap) plt.title(title) plt.colorbar() tick_marks = np.arange(len(classes)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81922984", "0.80933887", "0.80272716", "0.8016492", "0.79913706", "0.79885876", "0.79777396", "0.79729784", "0.7958926", "0.7954523", "0.79347897", "0.7931899", "0.7931772", "0.7928666", "0.7923684", "0.7921764", "0.79213995", "0.7920191", "0.792016", "0.7919876", "0.79153...
0.7913632
21
Function to perform a circular shift of a list to the left by a given number of elements
def shift(array: List[int], num: int) -> List[int]: if num > len(array): raise ValueError started_slice = array[0:num] rest_list = array[num::] return [*rest_list, *started_slice]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_left(L):\n\n\t# store the first item of the list\n\tfirst_item = L[0]\n\n\t# Start the loop from the second item\n\tfor i in range(1, len(L)):\n\t\t# Takes the item at i position and move to i-1 position\n\t\tL[i - 1] = L[i]\n\t# Take the item at index 0 and move to the last position\n\tL[-1] = first_ite...
[ "0.736864", "0.72583044", "0.7041001", "0.70302767", "0.6981906", "0.6979766", "0.6979766", "0.69791937", "0.6920969", "0.68633217", "0.682043", "0.6810421", "0.6725489", "0.67117625", "0.66969717", "0.66084194", "0.66018736", "0.6596936", "0.65745115", "0.6548643", "0.651213...
0.6476862
25
Convert datetime to timestamp
def to_timestamp(value): if not isinstance(value, datetime.date): return None return time.mktime(value.timetuple())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _datetime_to_timestamp(self, dt):\n return time.mktime(dt.timetuple())", "def dateToTimeStamp(dt):\n timestamp = dt.timestamp()\n timestamp = int(timestamp)\n return timestamp", "def to_timestamp(dt):\n return time.mktime(dt.timetuple())", "def datetime_to_timestamp(dt):\n return ca...
[ "0.80794185", "0.7690546", "0.75856304", "0.75487113", "0.7529122", "0.7385298", "0.73818004", "0.73589486", "0.7252668", "0.7231751", "0.72240937", "0.7200384", "0.7149287", "0.70919484", "0.7059883", "0.7046437", "0.70334876", "0.6989898", "0.6968598", "0.68879336", "0.6882...
0.7278026
8