이것은 완전히 직선적 인 것입니다. "하나 개의 입력"을 위해 당신은 같은 것이다 :
def build_column(x, input_size):
w = tf.Variable(tf.random_normal([input_size, 20]))
b = tf.Variable(tf.random_normal([20])
processing1 = tf.nn.sigmoid(tf.matmul(x, w) + b)
w = tf.Variable(tf.random_normal([20, 3]))
b = tf.Variable(tf.random_normal([3])
return tf.nn.sigmoid(tf.matmul(x, w) + b)
input1 = tf.placeholder(tf.float32, [None, 2])
output1 = build_column(input1, 2) # 2-20-3 network
을하고 당신은 단순히 더 예 : "열"을 추가하고
input1 = tf.placeholder(tf.float32, [None, 2])
output1 = build_column(input1, 2)
input2 = tf.placeholder(tf.float32, [None, 10])
output2 = build_column(input1, 10)
input3 = tf.placeholder(tf.float32, [None, 5])
output3 = build_column(input1, 5)
whole_model = output1 + output2 + output3 # since they are all the same size
원하는 언제든지 병합하고처럼 보이는 네트워크를 얻을 수 있습니다 :
2-20-3\
\
10-20-3--SUM (dimension-wise)
/
5-20-3/
또는 단일 값 출력을 할
w1 = tf.Variable(tf.random_normal([3, 1]))
w2 = tf.Variable(tf.random_normal([3, 1]))
w3 = tf.Variable(tf.random_normal([3, 1]))
whole_model = tf.matmul(output1, w1) + tf.matmul(output2, w2) + tf.matmul(output3, w3)
,691,363 이 2 년 전이지만210
나는 윈의 실행에 관한 질문이,
2-20-3\
\
10-20-3--1---
/
5-20-3/
를 얻을 수 있습니다. 입력이 여러 개인 경우 nn을 실행하려면 어떻게해야합니까? 각각의 입력이 공급되는 단순한 sess.run (옵티 마이저, {input1 : getBatch1, input2 : getBatch2, input3 : getBatch3})입니까? 그리고 최적화 프로그램이 트레이닝되면 TF는 자동으로 다른 감사합니다. – Luna
질문이 있으면 @Luna입니다. 답변에 대한 의견을 게시하는 대신 질문하십시오. – lejlot