Cảnh báo: API này không được dùng nữa và sẽ bị xóa trong phiên bản tương lai của TensorFlow sau khi thay thế ổn định.
GraphOperation
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.
Việc triển khai một Operation
được thêm dưới dạng nút vào Graph
.
Các phiên bản GraphOperation chỉ hợp lệ miễn là Graph
mà chúng là một phần trong đó hợp lệ. Do đó, nếu Graph.close()
đã được gọi thì các phương thức trên phiên bản GraphOperation có thể bị lỗi với IllegalStateException
.
Các phiên bản GraphOperation là bất biến và an toàn theo luồng.
Phương pháp công khai
boolean | |
int | |
int | inputListLength (Tên chuỗi) Trả về kích thước của danh sách đầu vào đã cho của Tensors cho thao tác này. |
Sợi dây | tên () Trả về tên đầy đủ của Operation. |
int | numOutputs () Trả về số tensor được tạo ra bởi thao tác này. |
<T> Đầu ra <T> | đầu ra (int idx) Trả về một điều khiển tượng trưng cho một trong các tensor được tạo ra bởi thao tác này. |
Đầu ra[] <?> | Danh sách đầu ra (int idx, int length) Trả về các điều khiển tượng trưng cho danh sách các tensor được tạo bởi thao tác này. |
int | đầu raListLength (Tên chuỗi) Trả về kích thước của danh sách Tensors được tạo ra bởi thao tác này. |
Sợi dây | |
Sợi dây | kiểu () Trả về loại thao tác, tức là tên của phép tính được thực hiện bởi thao tác đó. |
Phương pháp kế thừa
Từ lớp java.lang.Object boolean | bằng (Đối tượng arg0) |
Lớp cuối cùng<?> | getClass () |
int | Mã Băm () |
khoảng trống cuối cùng | thông báo () |
khoảng trống cuối cùng | thông báoTất cả () |
Sợi dây | toString () |
khoảng trống cuối cùng | chờ đã (arg0 dài, int arg1) |
khoảng trống cuối cùng | chờ đã (arg0 dài) |
khoảng trống cuối cùng | Chờ đợi () |
Từ giao diện org.tensorflow.Operation int trừu tượng | inputListLength (Tên chuỗi) Trả về kích thước của danh sách đầu vào đã cho của Tensors cho thao tác này. |
chuỗi trừu tượng | tên () Trả về tên đầy đủ của Operation. |
int trừu tượng | numOutputs () Trả về số tensor được tạo ra bởi thao tác này. |
trừu tượng <T> Đầu ra <T> | đầu ra (int idx) Trả về một điều khiển tượng trưng cho một trong các tensor được tạo ra bởi thao tác này. |
Đầu ra trừu tượng[] <?> | Danh sách đầu ra (int idx, int length) Trả về các điều khiển tượng trưng cho danh sách các tensor được tạo bởi thao tác này. |
int trừu tượng | đầu raListLength (Tên chuỗi) Trả về kích thước của danh sách Tensors được tạo ra bởi thao tác này. |
chuỗi trừu tượng | kiểu () Trả về loại thao tác, tức là tên của phép tính được thực hiện bởi thao tác đó. |
Phương pháp công khai
boolean công khai bằng (Đối tượng o)
Trả về kích thước của danh sách đầu vào đã cho của Tensors cho thao tác này.
Một Phép toán có nhiều đầu vào được đặt tên, mỗi đầu vào chứa một tensor đơn hoặc một danh sách các tensor. Phương thức này trả về kích thước của danh sách các tensor cho một đầu vào được đặt tên cụ thể của thao tác.
Thông số
tên | mã định danh danh sách các tensor (trong đó có thể có nhiều) đầu vào cho thao tác này. |
---|
Trả lại
- kích thước của danh sách Tensors được tạo bởi đầu vào có tên này.
tên chuỗi công khai ()
Trả về tên đầy đủ của Operation.
công khai int numOutputs ()
Trả về số tensor được tạo ra bởi thao tác này.
Đầu ra công khai đầu ra <T> (int idx)
Trả về một điều khiển tượng trưng cho một trong các tensor được tạo ra bởi thao tác này.
Cảnh báo: Không kiểm tra xem loại tensor có khớp với T hay không. Bạn nên gọi phương thức này với tham số loại rõ ràng thay vì để nó được suy ra, ví dụ như operation.<Integer>output(0)
Thông số
idx | Chỉ số đầu ra trong số các đầu ra được tạo ra bởi hoạt động này. |
---|
public Output[] <?> list list (int idx, int length)
Trả về các điều khiển tượng trưng cho danh sách các tensor được tạo bởi thao tác này.
Thông số
idx | chỉ số của tensor đầu tiên của danh sách |
---|
chiều dài | số tensor trong danh sách |
---|
public int outListLength (Tên chuỗi)
Trả về kích thước của danh sách Tensors được tạo ra bởi thao tác này.
Một Operation có nhiều đầu ra được đặt tên, mỗi đầu ra tạo ra một tensor đơn hoặc một danh sách các tensor. Phương thức này trả về kích thước của danh sách các tensor cho một đầu ra được đặt tên cụ thể của thao tác.
Thông số
tên | mã định danh danh sách các tensor (trong đó có thể có nhiều) được tạo ra bởi thao tác này. |
---|
Trả lại
- kích thước của danh sách Tensors được tạo ra bởi đầu ra được đặt tên này.
Chuỗi công khai toString ()
kiểu chuỗi công khai ()
Trả về loại thao tác, tức là tên của phép tính được thực hiện bởi thao tác đó.
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-26 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[],[],null,["# GraphOperation\n\npublic final class **GraphOperation** \nImplementation for an [Operation](/api_docs/java/org/tensorflow/Operation) added as a node to a [Graph](/api_docs/java/org/tensorflow/Graph).\n\nGraphOperation instances are valid only as long as the [Graph](/api_docs/java/org/tensorflow/Graph) they are a part of is\nvalid. Thus, if [Graph.close()](/api_docs/java/org/tensorflow/Graph#close()) has been invoked, then methods on the GraphOperation\ninstance may fail with an `IllegalStateException`.\n\nGraphOperation instances are immutable and thread-safe.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Public Methods\n\n|-----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| boolean | [equals](/api_docs/java/org/tensorflow/GraphOperation#equals(java.lang.Object))(Object o) |\n| int | [hashCode](/api_docs/java/org/tensorflow/GraphOperation#hashCode())() |\n| int | [inputListLength](/api_docs/java/org/tensorflow/GraphOperation#inputListLength(java.lang.String))(String name) Returns the size of the given inputs list of Tensors for this operation. |\n| String | [name](/api_docs/java/org/tensorflow/GraphOperation#name())() Returns the full name of the Operation. |\n| int | [numOutputs](/api_docs/java/org/tensorflow/GraphOperation#numOutputs())() Returns the number of tensors produced by this operation. |\n| \\\u003cT\\\u003e [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e | [output](/api_docs/java/org/tensorflow/GraphOperation#output(int))(int idx) Returns a symbolic handle to one of the tensors produced by this operation. |\n| [Output\\[\\]](/api_docs/java/org/tensorflow/Output)\\\u003c?\\\u003e | [outputList](/api_docs/java/org/tensorflow/GraphOperation#outputList(int,%20int))(int idx, int length) Returns symbolic handles to a list of tensors produced by this operation. |\n| int | [outputListLength](/api_docs/java/org/tensorflow/GraphOperation#outputListLength(java.lang.String))(String name) Returns the size of the list of Tensors produced by this operation. |\n| String | [toString](/api_docs/java/org/tensorflow/GraphOperation#toString())() |\n| String | [type](/api_docs/java/org/tensorflow/GraphOperation#type())() Returns the type of the operation, i.e., the name of the computation performed by the operation. |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface [org.tensorflow.Operation](/api_docs/java/org/tensorflow/Operation) \n\n|--------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract int | [inputListLength](/api_docs/java/org/tensorflow/Operation#inputListLength(java.lang.String))(String name) Returns the size of the given inputs list of Tensors for this operation. |\n| abstract String | [name](/api_docs/java/org/tensorflow/Operation#name())() Returns the full name of the Operation. |\n| abstract int | [numOutputs](/api_docs/java/org/tensorflow/Operation#numOutputs())() Returns the number of tensors produced by this operation. |\n| abstract \\\u003cT\\\u003e [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e | [output](/api_docs/java/org/tensorflow/Operation#output(int))(int idx) Returns a symbolic handle to one of the tensors produced by this operation. |\n| abstract [Output\\[\\]](/api_docs/java/org/tensorflow/Output)\\\u003c?\\\u003e | [outputList](/api_docs/java/org/tensorflow/Operation#outputList(int,%20int))(int idx, int length) Returns symbolic handles to a list of tensors produced by this operation. |\n| abstract int | [outputListLength](/api_docs/java/org/tensorflow/Operation#outputListLength(java.lang.String))(String name) Returns the size of the list of Tensors produced by this operation. |\n| abstract String | [type](/api_docs/java/org/tensorflow/Operation#type())() Returns the type of the operation, i.e., the name of the computation performed by the operation. |\n\nPublic Methods\n--------------\n\n#### public boolean\n**equals**\n(Object o)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| o | |\n|---|---|\n\n#### public int\n**hashCode**\n()\n\n\u003cbr /\u003e\n\n#### public int\n**inputListLength**\n(String name)\n\nReturns the size of the given inputs list of Tensors for this operation.\n\nAn Operation has multiple named inputs, each of which contains either a single tensor or a\nlist of tensors. This method returns the size of the list of tensors for a specific named input\nof the operation.\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| name | identifier of the list of tensors (of which there may be many) inputs to this operation. |\n|------|------------------------------------------------------------------------------------------|\n\n##### Returns\n\n- the size of the list of Tensors produced by this named input. \n\n#### public String\n**name**\n()\n\nReturns the full name of the Operation. \n\n#### public int\n**numOutputs**\n()\n\nReturns the number of tensors produced by this operation. \n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e\n**output**\n(int idx)\n\nReturns a symbolic handle to one of the tensors produced by this operation.\n\nWarning: Does not check that the type of the tensor matches T. It is recommended to call\nthis method with an explicit type parameter rather than letting it be inferred, e.g. `operation.<Integer>output(0)`\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| idx | The index of the output among the outputs produced by this operation. |\n|-----|-----------------------------------------------------------------------|\n\n#### public [Output\\[\\]](/api_docs/java/org/tensorflow/Output)\\\u003c?\\\u003e\n**outputList**\n(int idx, int length)\n\nReturns symbolic handles to a list of tensors produced by this operation. \n\n##### Parameters\n\n| idx | index of the first tensor of the list |\n| length | number of tensors in the list |\n|--------|---------------------------------------|\n\n##### Returns\n\n- array of `Output` \n\n#### public int\n**outputListLength**\n(String name)\n\nReturns the size of the list of Tensors produced by this operation.\n\nAn Operation has multiple named outputs, each of which produces either a single tensor or a\nlist of tensors. This method returns the size of the list of tensors for a specific named\noutput of the operation.\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| name | identifier of the list of tensors (of which there may be many) produced by this operation. |\n|------|--------------------------------------------------------------------------------------------|\n\n##### Returns\n\n- the size of the list of Tensors produced by this named output. \n\n#### public String\n**toString**\n()\n\n\u003cbr /\u003e\n\n#### public String\n**type**\n()\n\nReturns the type of the operation, i.e., the name of the computation performed by the\noperation."]]