Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
aliran tensor:: operasi:: DekodePng
#include <image_ops.h>
Dekode gambar berkode PNG menjadi tensor uint8 atau uint16.
Ringkasan
channels
attr menunjukkan jumlah saluran warna yang diinginkan untuk gambar yang didekodekan.
Nilai yang diterima adalah:
- 0: Gunakan jumlah saluran dalam gambar berkode PNG.
- 1: menampilkan gambar skala abu-abu.
- 3: mengeluarkan gambar RGB.
- 4: menampilkan gambar RGBA.
Jika diperlukan, gambar berkode PNG diubah agar sesuai dengan jumlah saluran warna yang diminta.
Operasi ini juga mendukung decoding JPEG dan GIF non-animasi karena antarmukanya sama, meskipun lebih bersih menggunakan tf.image.decode_image
.
Argumen:
- ruang lingkup: Objek Lingkup
- isi: 0-D. Gambar berkode PNG.
Atribut opsional (lihat Attrs
):
- saluran: Jumlah saluran warna untuk gambar yang didekodekan.
Pengembalian:
-
Output
: 3-D dengan bentuk [height, width, channels]
.
Atribut publik
Fungsi publik
simpul
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Keluaran
operator::tensorflow::Output() const
Fungsi statis publik
Saluran
Attrs Channels(
int64 x
)
Tipe D
Attrs Dtype(
DataType x
)
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[],[],null,["# tensorflow::ops::DecodePng Class Reference\n\ntensorflow::ops::DecodePng\n==========================\n\n`#include \u003cimage_ops.h\u003e`\n\nDecode a PNG-encoded image to a uint8 or uint16 tensor.\n\nSummary\n-------\n\nThe attr `channels` indicates the desired number of color channels for the decoded image.\n\nAccepted values are:\n\n\n- 0: Use the number of channels in the PNG-encoded image.\n- 1: output a grayscale image.\n- 3: output an RGB image.\n- 4: output an RGBA image.\n\n\u003cbr /\u003e\n\nIf needed, the PNG-encoded image is transformed to match the requested number of color channels.\n\nThis op also supports decoding JPEGs and non-animated GIFs since the interface is the same, though it is cleaner to use `tf.image.decode_image`.\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- contents: 0-D. The PNG-encoded image.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs)):\n\n- channels: Number of color channels for the decoded image.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): 3-D with shape `[height, width, channels]`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [DecodePng](#classtensorflow_1_1ops_1_1_decode_png_1ab7adeeb5aa6b10893fb6063ee8d6fc87)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` contents)` ||\n| [DecodePng](#classtensorflow_1_1ops_1_1_decode_png_1aa2df55e8e1eed056df69f127ca4cba25)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` contents, const `[DecodePng::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [image](#classtensorflow_1_1ops_1_1_decode_png_1a493e0f58c502e83895b5ab8df3ed277c) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_decode_png_1ac11da6e89a194ee86e7a82442fb33ed4) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\n| ### Public functions ||\n|----------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_decode_png_1adea6247b44969accb1513a6b237bd2d3)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_decode_png_1a1449fe5081528b4cb081cb224ba20d96)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_decode_png_1a19025343d7746c9091afcf01dbba03fd)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|\n| [Channels](#classtensorflow_1_1ops_1_1_decode_png_1ac0322c095dfd2d11bca81c46b421847a)`(int64 x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs) |\n| [Dtype](#classtensorflow_1_1ops_1_1_decode_png_1a656dedb17c75247c916d54efef9fb4f6)`(DataType x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs) |\n\n| ### Structs ||\n|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::DecodePng::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/decode-png/attrs) | Optional attribute setters for [DecodePng](/versions/r1.15/api_docs/cc/class/tensorflow/ops/decode-png#classtensorflow_1_1ops_1_1_decode_png). |\n\nPublic attributes\n-----------------\n\n### image\n\n```text\n::tensorflow::Output image\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### DecodePng\n\n```gdscript\n DecodePng(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input contents\n)\n``` \n\n### DecodePng\n\n```gdscript\n DecodePng(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input contents,\n const DecodePng::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### Channels\n\n```text\nAttrs Channels(\n int64 x\n)\n``` \n\n### Dtype\n\n```carbon\nAttrs Dtype(\n DataType x\n)\n```"]]