how to obtain the runtime batch size of a Keras model

后端 未结 1 482
日久生厌
日久生厌 2021-01-16 05:44

Based on this post. I need some basic implementation help. Below you see my model using a Dropout layer. When using the noise_shape parameter, it happens that the last batch

相关标签:
1条回答
  • 2021-01-16 06:11

    The current implementation does adjust the according to the runtime batch size. From the Dropout layer implementation code:

    symbolic_shape = K.shape(inputs)
    noise_shape = [symbolic_shape[axis] if shape is None else shape
                   for axis, shape in enumerate(self.noise_shape)]
    

    So if you give noise_shape=(None, 1, features) the shape will be (runtime_batchsize, 1, features) following the code above.

    0 讨论(0)
提交回复
热议问题