Link Search Menu Expand Document

DepthwiseConv2dNative


tensorflow C++ API

tensorflow::ops::DepthwiseConv2dNative

Computes a 2-D depthwise convolution given 4-Dinputandfiltertensors.


Summary

Given an input tensor of shape[batch, in_height, in_width, in_channels]and a filter / kernel tensor of shape[filter_height, filter_width, in_channels, channel_multiplier], containingin_channelsconvolutional filters of depth 1,depthwise_conv2dapplies a different filter to each input channel (expanding from 1 channel tochannel_multiplierchannels for each), then concatenates the results together. Thus, the output hasin_channels * channel_multiplierchannels.

``` for k in 0..in_channels-1 for q in 0..channel_multiplier-1 output[b, i, j, k * channel_multiplier + q] = sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] * filter[di, dj, k, q] ```

Must havestrides[0] = strides[3] = 1. For the most common case of the same horizontal and vertices strides,strides = [1, stride, stride, 1].

Arguments:

  • scope: A Scope object
  • strides: 1-D of length 4. The stride of the sliding window for each dimension ofinput.
  • padding: The type of padding algorithm to use.

Optional attributes (seeAttrs):

  • data_format: Specify the data format of the input and output data. With the default format “NHWC”, the data is stored in the order of: [batch, height, width, channels]. Alternatively, the format could be “NCHW”, the data storage order of: [batch, channels, height, width].

Returns:


DepthwiseConv2dNative block

Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_nn.cpp

Argument:

  • Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
  • Input input: connect Input node.
  • Input filter: connect Input node.
  • gtl::ArraySlice< int > strides: Input strides in value ex)1,2,2,1
  • StringPiece padding: Input paddingin value ex)SAME
  • DepthwiseConv2dNative ::Attrs attrs : Input attrs in value. ex) data_format_ = NHWC;

Return:

  • Output output : Output object of DepthwiseConv2dNative class object.

Result:

  • std::vector(Tensor) result_output : Returned object of executed result by calling session.

Using Method