text stringlengths 1 93.6k |
|---|
else:
|
usage()
|
baud = Baudrate(port, threshold=threshold, timeout=timeout, name=name, verbose=verbose, auto=auto)
|
if display:
|
print ""
|
for rate in baud.BAUDRATES:
|
print "\t%s" % rate
|
print ""
|
else:
|
print ""
|
print "Starting baudrate detection on %s, turn on your serial device now." % port
|
print "Press Ctl+C to quit."
|
print ""
|
baud.Open()
|
try:
|
rate = baud.Detect()
|
print "\nDetected baudrate: %s" % rate
|
if name is None:
|
print "\nSave minicom configuration as: ",
|
name = sys.stdin.readline().strip()
|
print ""
|
(ok, config) = baud.MinicomConfig(name)
|
if name and name is not None:
|
if ok:
|
if not run:
|
print "Configuration saved. Run minicom now [n/Y]? ",
|
yn = sys.stdin.readline().strip()
|
print ""
|
if yn == "" or yn.lower().startswith('y'):
|
run = True
|
if run:
|
subprocess.call(["minicom", name])
|
else:
|
print config
|
else:
|
print config
|
except KeyboardInterrupt:
|
pass
|
baud.Close()
|
main()
|
# <FILESEP>
|
from tqdm import tqdm
|
import sys, os
|
from shutil import copy
|
import random
|
import pdb
|
import argparse
|
import time
|
import numpy as np
|
import networkx as nx
|
import matplotlib
|
matplotlib.use("Agg")
|
import matplotlib.pyplot as plt
|
import torch
|
import torch.optim as optim
|
import torch.nn.functional as F
|
from torch_geometric.transforms import Compose
|
from torch_geometric.utils import to_networkx
|
from torch_geometric.data import DataListLoader
|
from ogb.graphproppred import Evaluator
|
from dataset_pyg import PygGraphPropPredDataset # customized to support data list
|
from dataloader import DataLoader # use a custom dataloader to handle subgraphs
|
from utils import create_subgraphs, return_prob
|
from ogb_mol_gnn import GNN, PPGN
|
from modules.gine_operations import ClassifierNetwork
|
cls_criterion = torch.nn.BCEWithLogitsLoss
|
reg_criterion = torch.nn.MSELoss
|
multicls_criterion = torch.nn.CrossEntropyLoss
|
def train(model, device, loader, optimizer, task_type):
|
model.train()
|
total_loss = 0
|
for step, batch in enumerate(tqdm(loader, desc="Iteration", ncols=70)):
|
if type(batch) == dict:
|
batch = {key: data_.to(device) for key, data_ in batch.items()}
|
skip_epoch = (batch[args.h[0]].x.shape[0] == 1 or
|
batch[args.h[0]].batch[-1] == 0)
|
else:
|
batch = batch.to(device)
|
skip_epoch = batch.x.shape[0] == 1 or batch.batch[-1] == 0
|
if skip_epoch:
|
pass
|
if task_type == 'binary classification':
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.