示例#1
0
 def test_ftz(self):
     daz.set_ftz()
     np.testing.assert_equal(self.normal / self.scale, 0)
     np.testing.assert_equal(self.denormal * self.scale, self.normal)
     assert np.all(self.denormal != 0)
     daz.unset_ftz()
     self.check_normal()
示例#2
0
 def test_ftz(self):
     daz.set_ftz()
     assert self.normal / self.scale == 0
     assert self.denormal * self.scale == self.normal
     assert self.denormal != 0
     daz.unset_ftz()
     self.check_normal()
示例#3
0
文件: c2w3.py 项目: thirionjl/chains
    ),
                 training=MiniBatchTraining(batch_size=32,
                                            optimizer=AdamOptimizer(0.0001),
                                            listener=CostListener()))


def show_image(i, x, y):
    plt.imshow(x[i])
    plt.show()
    print("y = " + str(np.squeeze(y[:, i])))


if __name__ == "__main__":
    import daz

    daz.set_ftz()
    np.seterr(under='warn')

    plt.rcParams['figure.figsize'] = (7.0, 4.0)
    plt.rcParams['image.interpolation'] = 'nearest'
    plt.rcParams['image.cmap'] = 'gray'

    # load image dataset: blue/red dots in circles
    train_x_orig, train_y_orig, test_x_orig, test_y_orig, classes = \
        load_dataset()
    # show_image(0, train_x_orig, train_y_orig)

    # Pre-processing
    train_x_flat = train_x_orig.reshape(train_x_orig.shape[0], -1).T
    test_x_flat = test_x_orig.reshape(test_x_orig.shape[0], -1).T
    train_x = train_x_flat / 255.