slim.flatten——將輸入扁平化但保留batch_size,假設第一維是batch


slim.flatten(inputs,outputs_collections=None,scope=None)

(注:import tensorflow.contrib.slim as slim)
將輸入扁平化但保留batch_size,假設第一維是batch。
Args:
inputs: a tensor of size [batch_size, …].
outputs_collections: collection to add the outputs.
scope: Optional scope for name_scope.
如:

test=([[[1,2,3],[4,5,6],[7,8,9]],[[10,11,12],[13,14,15],[16,17,27]],[[18,19,20],[21,22,23],[24,25,26]]]) #shape is (3,3,3) test=slim.fatten(test) test.eval() array([[ 1, 2, 3, ..., 7, 8, 9], [10, 11, 12, ..., 16, 17, 27], [18, 19, 20, ..., 24, 25, 26]], dtype=int32) test.get_shape() TensorShape([Dimension(3), Dimension(9)]) #(3,9)



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM