Functional API: Execution environment agnostic function
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 928
- Fork
- 227
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
cc @karllessard
This is somewhat of a sub-task of #181. The biggest pain I've ran into when using ConcreteFunction is that it only has tensor call methods, when it's mostly going to be used with Operand. This is a fairly simple issue on the surface. But, there's no way to execute ConcreteFunction in graph mode, i.e. if they are nested. The function used to generate the graph-mode outputs (which are wrapped in Signature) isn't saved. Now, it's easy enough to do this Java-side, in a sub class so that ConcreteFunction still supports loading. However, there's other issues such as supporting inputs with different shapes and dtypes that made me realize that what I'm trying to do here is closer to Python's Function and we may want to handle it with a new abstraction. There's also TF_Function and TF_GraphCopyFunction and TFE_ContextAddFunction which seems like it would allow attaching a ConcreteFunction to a graph without having to re-execute the builder in a new graph.
So I'd propose two things:
- Implement Graph-mode and Eager-mode use of
ConcreteFunctions using the nativeTF_FunctionAPIs (the fact that the eager one doesn't mention gradients makes me a little worried, but I would think we can handle that manually later if necessary). - Add a
Functionclass that acts liketf.function, in that it createsConcreteFunctions as necessary for the argument shapes and dtypes. Additionally, since this will save the graph-creator lambda, we can have adebugflag that re-runs the lambda.
We also need to do something with variable handling, although that will probably need to wait on #179. Python seems to use an implicit variable-creation context to create them at the call-site and only allows it on the first call. I'd be fine with throwing errors and forcing the user to extract them, I think. I need to look into the details a bit more before I propose anything for this though. Variable scopes might be worth doing anyways for freezing, although hopefully explicit as part of Ops/Scope.
We'll need to pay attention to Graph states, like random seeds, too.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với ConcreteFunction và các API TF_Function, TF_GraphCopyFunction và TFE_ContextAddFunction native được nêu trong issue; so sánh cách biểu diễn việc thực thi eager và ở chế độ graph. Đọc ngữ cảnh liên quan của #181 và #179 trước khi xác định phạm vi. Phần hoàn thành cần bao quát abstraction Function đã thống nhất, việc chuyên biệt hóa theo shape và dtype, xử lý biến và hành vi của trạng thái graph.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java, tensorflow
- Lĩnh vực
- backend-api-design, machine-learning
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100