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日

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿