Note for tensorflow API

tf.split

tf.split(
    value,
    num_or_size_splits,
    axis=0,
    num=None,
    name='split'
)

If num_or_size_splits is an integer, then value is split along dimension axis into num_split smaller tensors. This requires that num_split evenly divides value.shape[axis].

If num_or_size_splits is a 1-D Tensor (or list), we call it size_splits and value is split into len(size_splits) elements. The shape of the i-th element has the same size as the value except along dimension axis where the size is size_splits[i].

Returns:

if num_or_size_splits is a scalar returns num_or_size_splits Tensor objects; if num_or_size_splits is a 1-D Tensor returns num_or_size_splits.get_shape[0] Tensor objects resulting from splitting value.

tf.squeeze

tf.squeeze(
    input,
    axis=None,
    name=None,
    squeeze_dims=None
)

Returns:

A Tensor. Has the same type as input. Contains the same data as input, but has one or more dimensions of size 1 removed.

tf.nn.depth_to_space VS. torch.nn.PixelShuffle

they aplly the same upsample function,which is stream from this paper:https://arxiv.org/abs/1609.05158

tf.nn.depth_to_space(
    input,
    block_size,
    name=None,
    data_format='NHWC'
)

For example, given an input of shape [1, 1, 1, 4], data_format = "NHWC" and block_size = 2:

x = [[[[1, 2, 3, 4]]]]
This operation will output a tensor of shape:[1,2,2,1]
   [[[[1], [2]],
     [[3], [4]]]]

Here, the input has a batch of 1 and each batch element has shape [1, 1, 4], the corresponding output will have 2x2 elements and will have a depth of 1 channel (1 = 4 / (block_size * block_size)). The output element shape is [2, 2, 1].

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值