예제 #1
0
trainMidData = tf.placeholder(tf.float32, shape=(batch_siz,en_mid_siz,1),
        name="trainMidData")
trainMidNorm = tf.placeholder(tf.float32, shape=(batch_siz),
        name="trainMidNorm")
trainOutData = tf.placeholder(tf.float32, shape=(batch_siz,out_siz//2,1),
        name="trainOutData")
trainOutNorm = tf.placeholder(tf.float32, shape=(batch_siz),
        name="trainOutNorm")
global_steps=tf.Variable(0, trainable=False)

#=========================================================
#----- Training Preparation

if de:
    en_butterfly_net = ButterflyLayer(N, in_siz, en_mid_siz, False,
        channel_siz, en_nlvl, -1, True,
        in_range, en_mid_range)
else:
    en_butterfly_net = ButterflyLayer(2*N, in_siz, en_mid_siz, False,
        channel_siz, en_nlvl, -1, True,
        in_range, en_mid_range)


middle_net = MiddleLayer(in_siz, en_mid_siz, de_mid_siz, sine = True,
                        a = a[::(2**10//N)], prefixed = 2, std = 0.03)

de_butterfly_net = ButterflyLayer(N, de_mid_siz, out_siz, False,
        channel_siz, de_nlvl, 1, True,
        de_mid_range, out_range)

y_train_en_mid = en_butterfly_net(trainInData)
예제 #2
0
testMidNorm = tf.placeholder(tf.float32, shape=(test_siz),
        name="testMidNorm")
testOutData = tf.placeholder(tf.float32, shape=(test_siz,out_siz//2,1),
        name="testOutData")
testOutNorm = tf.placeholder(tf.float32, shape=(test_siz),
        name="testOutNorm")
global_steps=tf.Variable(0, trainable=False)

#=========================================================
#----- Training Preparation

middle_net = MiddleLayer(in_siz, en_mid_siz, de_mid_siz, False)

if butterfly:
    en_butterfly_net = ButterflyLayer(N, in_siz, en_mid_siz, False,
        channel_siz, en_nlvl, -1, prefixed,
        in_range, en_mid_range,0.45)
    de_butterfly_net = ButterflyLayer(N, de_mid_siz, out_siz, False,
        channel_siz, de_nlvl, 1, prefixed,
        de_mid_range, out_range,0.45)
    
    y_train_en_mid = en_butterfly_net(trainInData)
    y_train_de_mid = middle_net(y_train_en_mid)
    train_output = de_butterfly_net(y_train_de_mid)/N
    x_train_output = train_output[:,::2]
    
    y_test_en_mid = en_butterfly_net(testInData)
    y_test_de_mid = middle_net(y_test_en_mid)
    test_output = de_butterfly_net(y_test_de_mid)/N
    x_test_output = test_output[:,::2]
else: