bilateral_slice

paddle.fluid.contrib.layers.nn. bilateral_slice ( x, guide, grid, has_offset, name=None ) [source]
Alias_main

paddle.nn.functional.bilateral_slice :alias: paddle.nn.functional.bilateral_slice,paddle.nn.functional.vision.bilateral_slice :old_api: paddle.fluid.layers.bilateral_slice

This operation implements bilateral slicing on the input according to the guide map. For more information of bilateral slicing, please refer to Deep Bilateral Learning for Real-Time Image Enhancement <https://groups.csail.mit.edu/graphics/hdrnet/data/hdrnet.pdf>_

Parameters
  • x (Variable) – The input tensor, which is a 4-D tensor with shape [N, C, H, W], N is the batch size, C is the channel number, H and W is the feature height and width. The data type is float32 and float64.

  • guide (Variable) – Input grid tensor of shape [N, H, W]. The data type is float32 and float64.

  • grid (Variable) – Input grid tensor of shape [N, C, D, H, W]. The data type is float32 and float64.

  • has_offset (bool) – Whether to slice with affine offset.

  • name (str, optional) – For detailed information, please refer to Name. Usually name is no need to set and None by default.

Returns

Output of shape [N, C, H, W]. The data type is same as input tensor.

Return type

Variable

Examples

import paddle.fluid as fluid

x = fluid.data(name='x', shape=[None, 3, 101, 60], dtype='float32')
guide = fluid.data(name='guide', shape=[None, 101, 60], dtype='float32')
grid = fluid.data(name='grid', shape=[None, 12, 8, 10, 6], dtype='float32')

# without offset
output = fluid.contrib.bilateral_slice(x, guide, grid, has_offset=False)

# has offset
output = fluid.contrib.bilateral_slice(x, guide, grid, has_offset=True)