theano_backend.py 文件源码

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

项目:deeplift 作者: kundajelab 项目源码 文件源码
def conv2d_grad(topgrad, output_shape, filters, border_mode, strides):
    if (border_mode==BorderMode.same):
        #'half' kernel width padding results in outputs of the same
        #dimensions as input
        border_mode=BorderMode.half
        assert filters.shape[2]%2 == 1 and filters.shape[3]%2 == 1,\
            "haven't handled even filter shapes for border mode 'half'"
    op = T.nnet.abstract_conv.AbstractConv2d_gradInputs(
            imshp=output_shape,
            kshp=filters.shape,
            subsample=strides,
            border_mode=border_mode,
            filter_flip=True)
    topgrad=T.cast(topgrad, dtype=theano.config.floatX)
    belowgrad = op(kern=filters, topgrad=topgrad, shape=output_shape[2:]) 
    return belowgrad
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号