簡體   English   中英

將輸入打印到Keras型號

[英]Printing the input to a Keras model

有什么方法可以將輸入打印到我的Keras模型中嗎? 我不確定“batch_size”是指樣本數量,還是每個樣本的數據點數量。 如果我可以將輸入打印到我的Keras模型中,那將是很棒的。

批量大小是一步通過網絡的樣本數。 因此,將步數乘以批量大小得出樣本總數。

batch_size = number_of_samples / number_of_steps

要獲得Keras模型的輸入張量:

input_tensor = model.input

要從input_tensor獲取形狀張量:

shape_tensor = tf.shape( input_tensor )

通過向input_tensor 提供一些輸入 ,在tf.Session()運行shape_tensor

with tf.Session() as session:
    print( session( shape_tensor , feed_dict={ input_tensor:some_input } ) )

那將打印出形狀。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM