เทนเซอร์โฟลว์:: ออปส์:: คอนโวลูชัน2ดี
#include <nn_ops.h> คำนวณคอนโวลูชัน 2 มิติ โดยใช้ input และเทนเซอร์ filter 4 มิติ
สรุป
เมื่อกำหนดเทนเซอร์อินพุตที่มีรูปร่าง [batch, in_height, in_width, in_channels] และเทนเซอร์ตัวกรอง/เคอร์เนลที่มีรูปร่าง [filter_height, filter_width, in_channels, out_channels] แล้ว การดำเนินการนี้จะทำสิ่งต่อไปนี้:
- แปลงตัวกรองให้เป็นเมทริกซ์ 2 มิติที่มีรูปร่าง
[filter_height * filter_width * in_channels, output_channels] - ดึงส่วนย่อยของภาพจากเทนเซอร์อินพุตเพื่อสร้างเทนเซอร์ เสมือน ที่มีรูปร่าง
[batch, out_height, out_width, filter_height * filter_width * in_channels] - สำหรับแต่ละส่วนย่อย จะทำการคูณเมทริกซ์ตัวกรองกับเวกเตอร์ส่วนย่อยของภาพทางด้านขวา
โดยละเอียดแล้ว ในรูปแบบ NHWC มาตรฐาน มีดังนี้
output[b, i, j, k] =
sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] *
filter[di, dj, q, k] ต้องมี strides[0] = strides[3] = 1 สำหรับกรณีทั่วไปที่ strides ในแนวนอนและจุดยอดเหมือนกัน strides = [1, stride, stride, 1]
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- อินพุต: เทนเซอร์ 4 มิติ ลำดับมิติจะถูกตีความตามค่าของ
data_formatโปรดดูรายละเอียดด้านล่าง - ตัวกรอง: เทนเซอร์ 4 มิติที่มีรูปร่าง
[filter_height, filter_width, in_channels, out_channels] - strides: เทนเซอร์ 1 มิติ ความยาว 4 ค่า stride ของหน้าต่างเลื่อนสำหรับแต่ละมิติของ
inputอินพุต ลำดับของมิติถูกกำหนดโดยค่าของdata_formatดูรายละเอียดเพิ่มเติมด้านล่าง - การเติมช่องว่าง: ประเภทของอัลกอริทึมการเติมช่องว่างที่จะใช้
คุณลักษณะเสริม (ดูที่ Attrs ):
- explicit_paddings: หาก
paddingเป็น"EXPLICIT"รายการปริมาณ padding ที่ระบุอย่างชัดเจน สำหรับมิติที่ i ปริมาณ padding ที่แทรกก่อนและหลังมิตินั้นคือexplicit_paddings[2 * i]และexplicit_paddings[2 * i + 1]ตามลำดับ หากpaddingไม่ใช่"EXPLICIT"explicit_paddingsจะต้องว่างเปล่า - data_format: ระบุรูปแบบข้อมูลของข้อมูลขาเข้าและขาออก โดยรูปแบบเริ่มต้นคือ "NHWC" ข้อมูลจะถูกจัดเก็บในลำดับ: [ชุดข้อมูล, ความสูง, ความกว้าง, ช่องสัญญาณ] หรืออาจใช้รูปแบบ "NCHW" ซึ่งลำดับการจัดเก็บข้อมูลจะเป็น: [ชุดข้อมูล, ช่องสัญญาณ, ความสูง, ความกว้าง]
- การขยาย: เทนเซอร์ 1 มิติ ความยาว 4 ปัจจัยการขยายสำหรับแต่ละมิติของ
inputหากตั้งค่าเป็น k > 1 จะมีการข้ามเซลล์ k-1 เซลล์ระหว่างแต่ละองค์ประกอบตัวกรองในมิตินั้น ลำดับของมิติจะถูกกำหนดโดยค่าของdata_formatดูรายละเอียดเพิ่มเติมด้านบน การขยายในมิติแบทช์และมิติความลึกต้องเป็น 1
การส่งคืนสินค้า:
-
Output: เทนเซอร์ 4 มิติ ลำดับมิติถูกกำหนดโดยค่าของdata_formatโปรดดูรายละเอียดด้านล่าง
ตัวสร้างและตัวทำลาย | |
|---|---|
Conv2D (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input filter, const gtl::ArraySlice< int > & strides, StringPiece padding) | |
Conv2D (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input filter, const gtl::ArraySlice< int > & strides, StringPiece padding, const Conv2D::Attrs & attrs) |
คุณลักษณะสาธารณะ | |
|---|---|
operation | |
output | |
หน้าที่สาธารณะ | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
ฟังก์ชันคงที่สาธารณะ | |
|---|---|
DataFormat (StringPiece x) | |
Dilations (const gtl::ArraySlice< int > & x) | |
ExplicitPaddings (const gtl::ArraySlice< int > & x) | |
UseCudnnOnGpu (bool x) | |
โครงสร้าง | |
|---|---|
| tensorflow::ops::Conv2D::Attrs | ตัวเลือกการตั้งค่าแอตทริบิวต์สำหรับ Conv2D ( ไม่จำเป็น) |
คุณลักษณะสาธารณะ
การดำเนินการ
Operation operation
เอาต์พุต
::tensorflow::Output output
หน้าที่สาธารณะ
คอนวีที2ดี
Conv2D( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input filter, const gtl::ArraySlice< int > & strides, StringPiece padding )
คอนวีที2ดี
Conv2D( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input filter, const gtl::ArraySlice< int > & strides, StringPiece padding, const Conv2D::Attrs & attrs )
โหนด
::tensorflow::Node * node() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::อินพุต
operator::tensorflow::Input() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
รูปแบบข้อมูล
Attrs DataFormat( StringPiece x )
การขยาย
Attrs Dilations( const gtl::ArraySlice< int > & x )
ExplicitPaddings
Attrs ExplicitPaddings( const gtl::ArraySlice< int > & x )
ใช้ Cudnn บน GPU
Attrs UseCudnnOnGpu( bool x )