def load_data(collection, n=100): #2d indexes FTW max_x = 180 max_y = 180 for j, d in load_data_file(n): d['rand'] = [random.randint(-max_x, max_x), random.randint(-max_y, max_y)] collection.insert( d ) collection.create_index( [('rand', '2d')])
def load_data(collection, n=100): #let's skip some elements skiplist = [10, 12, 231 , 2 , 4] for i,d in load_data_file(n): d['i'] = i if i in skiplist: continue collection.insert( d )
def load_data(collection, n=100): #let's skip some elements skiplist = [10, 12, 231, 2, 4] for i, d in load_data_file(n): d['i'] = i if i in skiplist: continue collection.insert(d)
def test_graph_cut(): adj = load_data_file("test_data.txt") pca = PCA(256) data = pca.fit_transform(adj.numpy()) data = torch.Tensor(data).cuda() adj = adj.cuda() model = GAP(4, data, 128) parameter = torch.load("simple_test.pth") model.load_state_dict(parameter) model.cuda()
def load_data(collection, n=100): #2d indexes FTW max_x = 180 max_y = 180 for j, d in load_data_file(n): d['rand'] = [ random.randint(-max_x, max_x), random.randint(-max_y, max_y) ] collection.insert(d) collection.create_index([('rand', '2d')])
def __init__(self, path): # Load data self.path = path self.collections = data.load_data_file(path) # Initialize the menu self.widget = urwid.Padding([], left = 2, right = 2) self.top = urwid.Overlay(self.widget, urwid.SolidFill(u'\N{MEDIUM SHADE}'), align = 'center', width = ('relative', 60), valign = 'middle', height = ('relative', 60), min_width = 20, min_height = 9) # Enter the main menu self.main()
def load_data(collection, n=100): #fixed number of marks max_i = 10 for j, d in load_data_file(n): d['i'] = random.randint(0, max_i) collection.insert(d)
from data import load_data_file from torch_sparse import SparseTensor import torch from torch_geometric.nn import SAGEConv adj = load_data_file() adj_sparse = SparseTensor.from_torch_sparse_coo_tensor(adj) x = torch.randn((5, 10)) sage_conv = SAGEConv(10, 9, True) out = sage_conv(x, adj_sparse) print(out) print(type(out))
def load_data(collection, n=100): #for each element we will insert the `i` value for i,d in load_data_file(n): d['i'] = i collection.insert( d )