|
4 | 4 | :-------------- |:---------------------------------------------------- | |
5 | 5 | | **RFC #** | [20210504-kernel-extension-variable-ops](https://github.com/tensorflow/community/pull/20210504-kernel-extension-variable-ops) | |
6 | 6 | | **Author(s)** | Kulin Seth (Apple), Charles Brissart (Apple) | |
7 | | -| **Sponsor ** | Saurabh Saksena ( [email protected]) | |
| 7 | +| **Sponsor ** | Saurabh Saxena ( [email protected]) | |
8 | 8 | | **Updated** | 2021-05-04 | |
9 | 9 |
|
10 | 10 | ## Objective |
@@ -92,6 +92,7 @@ TF_CAPI_EXPORT extern void TF_GetInputTensorFromVariable( |
92 | 92 | TF_OpKernelContext* ctx, |
93 | 93 | int input, |
94 | 94 | bool lock_held, |
| 95 | + bool isVariantType, |
95 | 96 | bool sparse, |
96 | 97 | void (*copyFunc)( |
97 | 98 | TF_OpKernelContext * ctx, |
@@ -138,24 +139,32 @@ TF_CAPI_EXPORT extern void TF_AssignVariable(TF_OpKernelContext* ctx, |
138 | 139 |
|
139 | 140 | // Expose higher level AssignUpdate operation for Pluggable vendors to implement |
140 | 141 | // in the plugin for Training. The API takes in the context with indices for |
141 | | -// the input and value tensors. It also accepts the copy/update functor provided by |
| 142 | +// the input and value tensors. It also accepts the update functor provided by |
142 | 143 | // pluggable vendor to perform these operations respectively. |
143 | 144 | TF_CAPI_EXPORT extern void TF_AssignUpdateVariable( |
144 | 145 | TF_OpKernelContext* ctx, |
145 | 146 | int input_index, |
146 | 147 | int value_index, |
147 | 148 | int Op, |
148 | | - int isVariantType, |
149 | | - void (*copyFunc)(TF_OpKernelContext * ctx, |
150 | | - TF_Tensor *source, |
151 | | - TF_Tensor *dest), |
| 149 | + bool isVariantType, |
152 | 150 | void (*updateFunc)(TF_OpKernelContext *ctx, |
153 | 151 | TF_Tensor *tensor, |
154 | 152 | TF_Tensor *value, int Op), |
155 | 153 | TF_Status* status); |
156 | 154 |
|
157 | 155 | ``` |
158 | 156 |
|
| 157 | +*Helper Function* |
| 158 | + |
| 159 | +We are proposing to add simple helper function which allows plugins to get the Tensor by providing an input_name. |
| 160 | + |
| 161 | +``` |
| 162 | +// Allows plugin to get TF_Tensor when passed its input_name |
| 163 | +TF_CAPI_EXPORT extern void TF_GetInputByName(TF_OpKernelContext* ctx, const char *input_name, |
| 164 | + TF_Tensor** tensor, TF_Status* status); |
| 165 | +
|
| 166 | +``` |
| 167 | + |
159 | 168 | ### Alternatives Considered |
160 | 169 |
|
161 | 170 | We considered two different ways to add support for resource variables and |
|
0 commit comments