base.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:somber 作者: stephantul 项目源码 文件源码
def _create_batches(self, X, batch_size, shuffle_data=True):
        """
        Create batches out of a sequence of data.

        This function will append zeros to the end of your data to ensure that
        all batches are even-sized. These are masked out during training.
        """
        if shuffle_data:
            X = shuffle(X)

        if batch_size > X.shape[0]:
            batch_size = X.shape[0]

        max_x = int(np.ceil(X.shape[0] / batch_size))
        X = np.resize(X, (max_x, batch_size, X.shape[-1]))

        return X
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号