当前位置: 首页>>代码示例>>Python>>正文


Python ndarray.pad方法代码示例

本文整理汇总了Python中mxnet.ndarray.pad方法的典型用法代码示例。如果您正苦于以下问题:Python ndarray.pad方法的具体用法?Python ndarray.pad怎么用?Python ndarray.pad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mxnet.ndarray的用法示例。


在下文中一共展示了ndarray.pad方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: forward

# 需要导入模块: from mxnet import ndarray [as 别名]
# 或者: from mxnet.ndarray import pad [as 别名]
def forward(self, x):
        return F.pad(x, mode='reflect', pad_width=self.pad_width) 
开发者ID:awslabs,项目名称:dynamic-training-with-apache-mxnet-on-aws,代码行数:4,代码来源:net.py

示例2: __init__

# 需要导入模块: from mxnet import ndarray [as 别名]
# 或者: from mxnet.ndarray import pad [as 别名]
def __init__(self, in_channels, out_channels, kernel_size, stride):
        super(ConvLayer, self).__init__()
        padding = int(np.floor(kernel_size / 2))
        self.pad = ReflectancePadding(pad_width=(0,0,0,0,padding,padding,padding,padding))
        self.conv2d = nn.Conv2D(in_channels=in_channels, channels=out_channels, 
                                kernel_size=kernel_size, strides=(stride,stride),
                                padding=0) 
开发者ID:awslabs,项目名称:dynamic-training-with-apache-mxnet-on-aws,代码行数:9,代码来源:net.py

示例3: hybrid_forward

# 需要导入模块: from mxnet import ndarray [as 别名]
# 或者: from mxnet.ndarray import pad [as 别名]
def hybrid_forward(self, F, x):
        x = x.transpose(axes=(0, 2, 1, 3))
        x = F.pad(x, mode="constant", pad_width=(0, 0, 0, 0, 0, self.padding, 0, 0), constant_value=0)
        x = x.transpose(axes=(0, 2, 1, 3))
        return x 
开发者ID:osmr,项目名称:imgclsmob,代码行数:7,代码来源:irevnet.py

示例4: __init__

# 需要导入模块: from mxnet import ndarray [as 别名]
# 或者: from mxnet.ndarray import pad [as 别名]
def __init__(self,
                 in_channels,
                 out_channels,
                 strides,
                 bn_use_global_stats,
                 preactivate,
                 **kwargs):
        super(IRevUnit, self).__init__(**kwargs)
        if not preactivate:
            in_channels = in_channels // 2

        padding = 2 * (out_channels - in_channels)
        self.do_padding = (padding != 0) and (strides == 1)
        self.do_downscale = (strides != 1)

        with self.name_scope():
            if self.do_padding:
                self.pad = IRevInjectivePad(padding)
            self.bottleneck = IRevBottleneck(
                in_channels=in_channels,
                out_channels=out_channels,
                strides=strides,
                bn_use_global_stats=bn_use_global_stats,
                preactivate=preactivate)
            if self.do_downscale:
                self.psi = IRevDownscale(strides) 
开发者ID:osmr,项目名称:imgclsmob,代码行数:28,代码来源:irevnet.py

示例5: inverse

# 需要导入模块: from mxnet import ndarray [as 别名]
# 或者: from mxnet.ndarray import pad [as 别名]
def inverse(self, x2, y1):
        import mxnet.ndarray as F

        if self.do_downscale:
            x2 = self.psi.inverse(x2)
        fx2 = - self.bottleneck(x2)
        x1 = fx2 + y1
        if self.do_downscale:
            x1 = self.psi.inverse(x1)
        if self.do_padding:
            x = F.concat(x1, x2, dim=1)
            x = self.pad.inverse(x)
            x1, x2 = F.split(x, axis=1, num_outputs=2)
        return x1, x2 
开发者ID:osmr,项目名称:imgclsmob,代码行数:16,代码来源:irevnet.py


注:本文中的mxnet.ndarray.pad方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。