stacked_autoencoder.py 文件源码

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

项目:deep-learning-theano 作者: aidiary 项目源码 文件源码
def pretraining_functions(self, train_set_x, batch_size):
        """???????????pre-training??????????
        ?????????x?????"""
        # ?????????????????
        index = T.lscalar('index')

        # ??????????????????????????????
        corruption_level = T.scalar('corruption')
        learning_rate = T.scalar('lr')

        batch_begin = index * batch_size
        batch_end = batch_begin + batch_size

        # ????????????????
        # ????????????????
        pretrain_functions = []
        for autoencoder in self.autoencoder_layers:
            # ??????????????????
            cost, updates = autoencoder.get_cost_updates(corruption_level, learning_rate)
            fn = theano.function(
                inputs=[
                    index,
                    # Param????????????????????Python????????
                    # Tensor???????corruption, lr???????
                    theano.Param(corruption_level, default=0.2),
                    theano.Param(learning_rate, default=0.1)
                ],
                outputs=cost,
                updates=updates,
                givens={
                    self.x: train_set_x[batch_begin:batch_end]
                }
            )
            pretrain_functions.append(fn)

        return pretrain_functions
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号