Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
dòng chảy căng:: ôi:: Theo chiều sâuConv2dBản địa
#include <nn_ops.h>
Tính toán tích chập theo chiều sâu 2-D cho input
4-D và filter
tensor.
Bản tóm tắt
Cho một tensor đầu vào có hình dạng [batch, in_height, in_width, in_channels]
và một tensor bộ lọc/nhân có hình dạng [filter_height, filter_width, in_channels, channel_multiplier]
, chứa các bộ lọc tích chập in_channels
có độ sâu 1, depthwise_conv2d
áp dụng một bộ lọc khác nhau cho mỗi kênh đầu vào (mở rộng từ 1 kênh sang kênh channel_multiplier
cho mỗi kênh), sau đó ghép các kết quả lại với nhau. Do đó, đầu ra có các kênh in_channels * channel_multiplier
.
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]
Phải có strides[0] = strides[3] = 1
. Đối với trường hợp phổ biến nhất của cùng một bước tiến ngang và đỉnh, strides = [1, stride, stride, 1]
.
Lập luận:
- phạm vi: Một đối tượng Phạm vi
- bước tiến: 1-D có chiều dài 4. Bước tiến của cửa sổ trượt cho từng chiều của
input
. - phần đệm: Loại thuật toán đệm sẽ sử dụng.
Thuộc tính tùy chọn (xem Attrs
):
- data_format: Chỉ định định dạng dữ liệu của dữ liệu đầu vào và đầu ra. Với định dạng mặc định "NHWC", dữ liệu được lưu trữ theo thứ tự: [lô, chiều cao, chiều rộng, kênh]. Ngoài ra, định dạng có thể là "NCHW", thứ tự lưu trữ dữ liệu là: [lô, kênh, chiều cao, chiều rộng].
- độ giãn nở: tensor 1-D có chiều dài 4. Hệ số giãn nở cho từng chiều của
input
. Nếu được đặt thành k > 1, sẽ có k-1 ô bị bỏ qua giữa mỗi phần tử bộ lọc trên thứ nguyên đó. Thứ tự thứ nguyên được xác định bởi giá trị của data_format
, xem chi tiết ở trên. Độ giãn nở của kích thước lô và độ sâu phải bằng 1.
Trả về:
Thuộc tính công khai
Chức năng công cộng
nút
::tensorflow::Node * node() const
operator::tensorflow::Input() const
toán tử::tenorflow::Đầu ra
operator::tensorflow::Output() const
Các hàm tĩnh công khai
Attrs DataFormat(
StringPiece x
)
Sự giãn nở
Attrs Dilations(
const gtl::ArraySlice< int > & x
)
Đệm rõ ràng
Attrs ExplicitPaddings(
const gtl::ArraySlice< int > & x
)
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-27 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\nArguments:\n\n- scope: A [Scope](/versions/r2.3/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.3/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.3/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.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.3/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.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/api_docs/cc/struct/tensorflow/ops/depthwise-conv2d-native/attrs) | Optional attribute setters for [DepthwiseConv2dNative](/versions/r2.3/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```"]]