Best Python code snippet using autotest_python
graphClusterSampler.py
Source:graphClusterSampler.py
...28 if os.path.exists(fn):29 self.par_li = np.load(fn, allow_pickle=True)30 else:31 os.makedirs('./datasets/', exist_ok=True)32 self.par_li = get_partition_list(g, psize)33 np.save(fn, self.par_li)34 else:35 self.par_li = get_partition_list(g, psize)36 par_list = []37 total_nodes = 038 for p in self.par_li:39 total_nodes = total_nodes + len(p)40 par = torch.Tensor(p)41 par_list.append(par)42 self.par_list = par_list43 print('Partition number = {} over {} nodes on graph with {} nodes'.format(len(par_list), total_nodes, g.num_nodes()))44 def __len__(self):45 return self.psize46 def __getitem__(self, idx):47 return self.par_li[idx]48def subgraph_collate_fn(g, batch):49 nids = np.concatenate(batch).reshape(-1).astype(np.int64)...
sampler.py
Source:sampler.py
...13 if os.path.exists(fn):14 self.par_li = np.load(fn, allow_pickle=True)15 else:16 os.makedirs('./partitions/', exist_ok=True)17 self.par_li = get_partition_list(g, psize)18 np.save(fn, self.par_li)19 else:20 self.par_li = get_partition_list(g, psize)21 par_list = []22 for p in self.par_li:23 par = torch.Tensor(p)24 par_list.append(par)25 self.par_list = par_list26 def __len__(self):27 return self.psize28 def __getitem__(self, idx):29 return self.par_li[idx]30def subgraph_collate_fn(g, batch):31 nids = np.concatenate(batch).reshape(-1).astype(np.int64)32 g1 = g.subgraph(nids)33 return g134def ClusterIter(dn, g, psize, batch_size, seed_nid=None):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!