Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::DepthwiseConv2dNative
#include <nn_ops.h>
Computes a 2-D depthwise convolution given 4-D input
and filter
tensors.
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]
, containing in_channels
convolutional filters of depth 1, depthwise_conv2d
applies a different filter to each input channel (expanding from 1 channel to channel_multiplier
channels for each), then concatenates the results together. Thus, the output has in_channels * channel_multiplier
channels.
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 have strides[0] = strides[3] = 1
. For the most common case of the same horizontal and vertices strides, strides = [1, stride, stride, 1]
.
Args:
- scope: A Scope object
- strides: 1-D of length 4. The stride of the sliding window for each dimension of
input
.
- padding: The type of padding algorithm to use.
Optional attributes (see Attrs
):
- 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].
- dilations: 1-D tensor of length 4. The dilation factor for each dimension of
input
. If set to k > 1, there will be k-1 skipped cells between each filter element on that dimension. The dimension order is determined by the value of data_format
, see above for details. Dilations in the batch and depth dimensions must be 1.
Returns:
Public attributes
Public functions
node
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Public static functions
Attrs DataFormat(
StringPiece x
)
Dilations
Attrs Dilations(
const gtl::ArraySlice< int > & x
)
ExplicitPaddings
Attrs ExplicitPaddings(
const gtl::ArraySlice< int > & x
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tensorflow::ops::DepthwiseConv2dNative Class Reference\n\ntensorflow::ops::DepthwiseConv2dNative\n======================================\n\n`#include \u003cnn_ops.h\u003e`\n\nComputes a 2-D depthwise convolution given 4-D `input` and `filter` tensors.\n\nSummary\n-------\n\nGiven 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]`, containing `in_channels` convolutional filters of depth 1, `depthwise_conv2d` applies a different filter to each input channel (expanding from 1 channel to `channel_multiplier` channels for each), then concatenates the results together. Thus, the output has `in_channels * channel_multiplier` channels.\n\n\n```scdoc\nfor k in 0..in_channels-1\n for q in 0..channel_multiplier-1\n output[b, i, j, k * channel_multiplier + q] =\n sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] *\n filter[di, dj, k, q]\n```\n\n\u003cbr /\u003e\n\nMust have `strides[0] = strides[3] = 1`. For the most common case of the same horizontal and vertices strides, `strides = [1, stride, stride, 1]`.\n\nArgs:\n\n- scope: A [Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- strides: 1-D of length 4. The stride of the sliding window for each dimension of `input`.\n- padding: The type of padding algorithm to use.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/depthwise-conv2d-native/attrs#structtensorflow_1_1ops_1_1_depthwise_conv2d_native_1_1_attrs)):\n\n- 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\\].\n- dilations: 1-D tensor of length 4. The dilation factor for each dimension of `input`. If set to k \\\u003e 1, there will be k-1 skipped cells between each filter element on that dimension. The dimension order is determined by the value of `data_format`, see above for details. Dilations in the batch and depth dimensions must be 1.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): The output tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [DepthwiseConv2dNative](#classtensorflow_1_1ops_1_1_depthwise_conv2d_native_1a50c225536301350d0a2a4e15f11bb1e8)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` filter, const gtl::ArraySlice\u003c int \u003e & strides, StringPiece padding)` ||\n| [DepthwiseConv2dNative](#classtensorflow_1_1ops_1_1_depthwise_conv2d_native_1a1403cd12618eaad516b1e553b99a2dec)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` filter, const gtl::ArraySlice\u003c int \u003e & strides, StringPiece padding, const `[DepthwiseConv2dNative::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/depthwise-conv2d-native/attrs#structtensorflow_1_1ops_1_1_depthwise_conv2d_native_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_depthwise_conv2d_native_1af4279f97302c2185f1577d3cee105837) | [Operation](/versions/r2.14/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_depthwise_conv2d_native_1a787a2254c323c4cc73067daa11e2b646) | `::`[tensorflow::Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|-----------------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_depthwise_conv2d_native_1ab6d86ff41ea2b1ec8b84bd58bda5b4c7)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_depthwise_conv2d_native_1ab08d7fc817e77e96f3d713f9c4536ccd)`() const ` | |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_depthwise_conv2d_native_1aaa32a9f3e246eae5adc3000f23eb8e88)`() const ` | |\n\n| ### Public static functions ||\n|------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [DataFormat](#classtensorflow_1_1ops_1_1_depthwise_conv2d_native_1a51fe0b98bda9604c4dcb4ce5156714df)`(StringPiece x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/depthwise-conv2d-native/attrs#structtensorflow_1_1ops_1_1_depthwise_conv2d_native_1_1_attrs) |\n| [Dilations](#classtensorflow_1_1ops_1_1_depthwise_conv2d_native_1a36765465f25da5bb2ff97249302c8806)`(const gtl::ArraySlice\u003c int \u003e & x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/depthwise-conv2d-native/attrs#structtensorflow_1_1ops_1_1_depthwise_conv2d_native_1_1_attrs) |\n| [ExplicitPaddings](#classtensorflow_1_1ops_1_1_depthwise_conv2d_native_1a73ae4e50791a90681f92a54719605f21)`(const gtl::ArraySlice\u003c int \u003e & x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/depthwise-conv2d-native/attrs#structtensorflow_1_1ops_1_1_depthwise_conv2d_native_1_1_attrs) |\n\n| ### Structs ||\n|----------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::DepthwiseConv2dNative::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/depthwise-conv2d-native/attrs) | Optional attribute setters for [DepthwiseConv2dNative](/versions/r2.14/api_docs/cc/class/tensorflow/ops/depthwise-conv2d-native#classtensorflow_1_1ops_1_1_depthwise_conv2d_native). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### DepthwiseConv2dNative\n\n```gdscript\n DepthwiseConv2dNative(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input filter,\n const gtl::ArraySlice\u003c int \u003e & strides,\n StringPiece padding\n)\n``` \n\n### DepthwiseConv2dNative\n\n```gdscript\n DepthwiseConv2dNative(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input filter,\n const gtl::ArraySlice\u003c int \u003e & strides,\n StringPiece padding,\n const DepthwiseConv2dNative::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### DataFormat\n\n```text\nAttrs DataFormat(\n StringPiece x\n)\n``` \n\n### Dilations\n\n```gdscript\nAttrs Dilations(\n const gtl::ArraySlice\u003c int \u003e & x\n)\n``` \n\n### ExplicitPaddings\n\n```gdscript\nAttrs ExplicitPaddings(\n const gtl::ArraySlice\u003c int \u003e & x\n)\n```"]]