when do you use Input shape vs batch_shape in keras?

不想你离开。 提交于 2020-01-03 16:35:29

问题


I don't find API that explains keras Input.

When should you use shape attribute vs batch_shape attribute?


回答1:


From the Keras source code:

Arguments

    shape: A shape tuple (integer), not including the batch size.
        For instance, `shape=(32,)` indicates that the expected input
        will be batches of 32-dimensional vectors.
    batch_shape: A shape tuple (integer), including the batch size.
        For instance, `batch_shape=(10, 32)` indicates that
        the expected input will be batches of 10 32-dimensional vectors.
        `batch_shape=(None, 32)` indicates batches of an arbitrary number
        of 32-dimensional vectors.

The batch size is how many examples you have in your training data.

You can use any. Personally I never used "batch_shape". When you use "shape", your batch can be any size, you don't have to care about it.

shape=(32,) means exactly the same as batch_shape=(None,32)



来源:https://stackoverflow.com/questions/44792106/when-do-you-use-input-shape-vs-batch-shape-in-keras

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!