diff options
author | Mingsheng Hong <hongm@google.com> | 2018-09-14 14:15:05 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-14 14:19:20 -0700 |
commit | b5594e6121e902f8dd2d5127653a1ec5f97daccd (patch) | |
tree | 5c17dc342ace8fb5c30ff44adafcb4fcb81ba718 /tensorflow/c/eager | |
parent | 19d66a950e2091bb598c6a2d375e14208f5773b2 (diff) |
Added TFE_OpSetAttrTensor() to eager C API.
Also added some experimental C APIs for facilitate the use of eager C APIs in
S4TF compiler.
PiperOrigin-RevId: 213041780
Diffstat (limited to 'tensorflow/c/eager')
-rwxr-xr-x | tensorflow/c/eager/c_api.cc | 7 | ||||
-rwxr-xr-x | tensorflow/c/eager/c_api.h | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tensorflow/c/eager/c_api.cc b/tensorflow/c/eager/c_api.cc index 349d9bcd7c..6f86ea80e5 100755 --- a/tensorflow/c/eager/c_api.cc +++ b/tensorflow/c/eager/c_api.cc @@ -567,6 +567,13 @@ void TFE_OpSetAttrFunction(TFE_Op* op, const char* attr_name, op->operation.MutableAttrs()->Set(attr_name, attr_value); } +void TFE_OpSetAttrTensor(TFE_Op* op, const char* attr_name, TF_Tensor* tensor, + TF_Status* status) { + tensorflow::Tensor t; + status->status = TF_TensorToTensor(tensor, &t); + if (status->status.ok()) op->operation.MutableAttrs()->Set(attr_name, t); +} + void TFE_OpSetAttrStringList(TFE_Op* op, const char* attr_name, const void* const* values, const size_t* lengths, int num_values) { diff --git a/tensorflow/c/eager/c_api.h b/tensorflow/c/eager/c_api.h index 337447eec9..a87d73ec8e 100755 --- a/tensorflow/c/eager/c_api.h +++ b/tensorflow/c/eager/c_api.h @@ -311,6 +311,11 @@ TF_CAPI_EXPORT extern void TFE_OpSetAttrFunction(TFE_Op* op, const char* attr_name, const TFE_Op* value); +TF_CAPI_EXPORT extern void TFE_OpSetAttrTensor(TFE_Op* op, + const char* attr_name, + TF_Tensor* tensor, + TF_Status* status); + TF_CAPI_EXPORT extern void TFE_OpSetAttrStringList(TFE_Op* op, const char* attr_name, const void* const* values, |