コード例 #1
0
    def setUp(self):
        gen_data()
        self.data_dir = "system"
        coord = np.load(os.path.join(self.data_dir, "set.000/coord.npy"))
        box = np.load(os.path.join(self.data_dir, "set.000/box.npy"))
        self.atype = np.loadtxt(os.path.join(self.data_dir, "type.raw"))
        self.coord = np.vstack([coord, coord])
        self.box = np.vstack([box, box])
        self.freq = 10

        self.pbtxts = [
            os.path.join(tests_path, "infer/deeppot.pbtxt"),
            os.path.join(tests_path, "infer/deeppot-1.pbtxt")
        ]
        self.graph_dirs = [
            pbtxt.replace("pbtxt", "pb") for pbtxt in self.pbtxts
        ]
        for pbtxt, pb in zip(self.pbtxts, self.graph_dirs):
            convert_pbtxt_to_pb(pbtxt, pb)
        self.graphs = [DeepPotential(pb) for pb in self.graph_dirs]
        self.output = os.path.join(tests_path, "model_devi.out")
        self.expect = np.array([
            0, 1.670048e-01, 4.182279e-04, 8.048649e-02, 5.095047e-01,
            4.584241e-01, 4.819783e-01
        ])
コード例 #2
0
ファイル: data.py プロジェクト: Hsveh/CS420_final_hw
def op0():
    """
    generate lowest 15000 confident images
    :return: none
    """
    data = common.Data("mnist/mnist_train/train_data.npy",
                       "mnist/mnist_train/mnist_train_label",
                       "mnist/mnist_test/test_data.npy",
                       "mnist/mnist_test/mnist_test_label", 1, 28)

    res = common.predict('model/1.4.0', 60000, data.train_x, 28)
    common.gen_data(res, data.train_x, data.train_y_no_one_hot, 15000)
コード例 #3
0
 def setUp(self):
     gen_data()
コード例 #4
0
import common as c
import torch
import torch.nn as nn
import torchkeras as tk
import torch.utils.data as tud

epochs = 10000
LOAD = False
TRAIN = True
SAVE = False

torch.manual_seed(0)

x, y = c.gen_data()


class NetWork3(tk.Model):
    def __init__(self):
        super(NetWork3, self).__init__()
        self.line = nn.Linear(1, 20)
        self.active = nn.ReLU()
        self.line2 = nn.Linear(20, 20)
        self.active2 = nn.ReLU()
        self.line3 = nn.Linear(20, 20)
        self.active3 = nn.ReLU()
        self.out = nn.Linear(20, 1)

        nn.init.normal_(self.line.weight)
        nn.init.normal_(self.line2.weight)
        nn.init.normal_(self.line3.weight)
        # for i in range(2000):
コード例 #5
0
 def setUp(self):
     gen_data(nframes=2)
コード例 #6
0
 def setUp(self) :
     gen_data()
     _make_tab(2)