MaybeRichard 2022-10-21 08:36 采纳率: 0%
浏览 8

Python类的使用问题

问题遇到的现象和发生背景

Github上的一个开源框架

用代码块功能插入代码,请勿粘贴截图
im_warped = vxm.layers.SpatialTransformer()([im_keras, aff_keras])
运行结果及报错内容

vxm.layers.SpatialTransformer()是一个类,内容大体如下:

class SpatialTransformer(Layer):
    """
    ND spatial transformer layer

    Applies affine and dense transforms to images. A dense transform gives
    displacements (not absolute locations) at each voxel.

    If you find this layer useful, please cite:

      Unsupervised Learning for Fast Probabilistic Diffeomorphic Registration
      Adrian V. Dalca, Guha Balakrishnan, John Guttag, Mert R. Sabuncu
      MICCAI 2018.

    Originally, this code was based on voxelmorph code, which 
    was in turn transformed to be dense with the help of (affine) STN code 
    via https://github.com/kevinzakka/spatial-transformer-network.

    Since then, we've re-written the code to be generalized to any 
    dimensions, and along the way wrote grid and interpolation functions.
    """

    def __init__(self,
                 interp_method='linear',
                 indexing='ij',
                 single_transform=False,
                 fill_value=None,
                 shift_center=True,
                 **kwargs):
我想要达到的结果

为什么调用这个类,后面有使用括号单独放入两个参数,这样做的目的是什么?
PS:后面两个参数都是尺寸为(1, 48, 48, 1)的两个矩阵

  • 写回答

2条回答 默认 最新

  • 爱晚乏客游 2022-10-21 09:05
    关注

    这种的看它的forward函数,一般是网络层的前向传播的参数

    评论 编辑记录

报告相同问题?

问题事件

  • 创建了问题 10月21日