Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit 939397f

Browse files
committed
Addressing the comments and adding a helper function.
1 parent dd3c876 commit 939397f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

rfcs/20210504-kernel-extension-variable-ops.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:-------------- |:---------------------------------------------------- |
55
| **RFC #** | [20210504-kernel-extension-variable-ops](https://github.com/tensorflow/community/pull/20210504-kernel-extension-variable-ops) |
66
| **Author(s)** | Kulin Seth (Apple), Charles Brissart (Apple) |
7-
| **Sponsor** | Saurabh Saksena ([email protected]) |
7+
| **Sponsor** | Saurabh Saxena ([email protected]) |
88
| **Updated** | 2021-05-04 |
99

1010
## Objective
@@ -92,6 +92,7 @@ TF_CAPI_EXPORT extern void TF_GetInputTensorFromVariable(
9292
TF_OpKernelContext* ctx,
9393
int input,
9494
bool lock_held,
95+
bool isVariantType,
9596
bool sparse,
9697
void (*copyFunc)(
9798
TF_OpKernelContext * ctx,
@@ -138,24 +139,32 @@ TF_CAPI_EXPORT extern void TF_AssignVariable(TF_OpKernelContext* ctx,
138139
139140
// Expose higher level AssignUpdate operation for Pluggable vendors to implement
140141
// 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
142143
// pluggable vendor to perform these operations respectively.
143144
TF_CAPI_EXPORT extern void TF_AssignUpdateVariable(
144145
TF_OpKernelContext* ctx,
145146
int input_index,
146147
int value_index,
147148
int Op,
148-
int isVariantType,
149-
void (*copyFunc)(TF_OpKernelContext * ctx,
150-
TF_Tensor *source,
151-
TF_Tensor *dest),
149+
bool isVariantType,
152150
void (*updateFunc)(TF_OpKernelContext *ctx,
153151
TF_Tensor *tensor,
154152
TF_Tensor *value, int Op),
155153
TF_Status* status);
156154
157155
```
158156

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+
159168
### Alternatives Considered
160169

161170
We considered two different ways to add support for resource variables and

0 commit comments

Comments
 (0)