2016-08-21 13 views

答えて

1

tf.select() OPは今tf.where()(TensorFlow 1.0)と呼ばれているなどの条件を同じ形状を作るためにtf.tileを使用することができます。 tf.where() opの形状は、conditionの形状がやや奇妙で、2つのブランチとは異なる形状を持つことができますが、その長さが0番目のディメンションと同じサイズのベクトルの場合にのみteです。したがって、次のようにプログラムを動作させることができます:

condition = ... # scalar 
t = ...   # shape = [4, 9, 2] 
e = ...   # shape = [4, 9, 2] 

# Tile `condition` as a vector whose length matches the 0th dimension of `t`. 
condition_vector = tf.tile([condition], [tf.shape(t)[0]]) 

result = tf.where(condition_vector, t, e) 
1

あなたはt

+0

正確に説明できますか? conditionがスカラーのプレースホルダーまたは変数であり、tおよびeがshape(4,9,2)であるとします。 –

関連する問題