Eager execution API bug fix for tensor data types whose TF_Tensor memory layout is not the same at the tensorflow::Tensor memory layout.
This commit is contained in:
parent
512d3d0868
commit
5598a3dec7
@ -146,6 +146,8 @@ class TensorCApi {
|
||||
}
|
||||
};
|
||||
|
||||
Status TF_TensorToTensor(const TF_Tensor* src, Tensor* dst);
|
||||
|
||||
TF_Tensor* TF_TensorFromTensor(const Tensor& src, TF_Status* status);
|
||||
|
||||
Status MessageToBuffer(const tensorflow::protobuf::Message& in, TF_Buffer* out);
|
||||
|
@ -152,9 +152,10 @@ TF_DeviceList* TFE_ContextListDevices(TFE_Context* ctx, TF_Status* status) {
|
||||
}
|
||||
|
||||
TFE_TensorHandle* TFE_NewTensorHandle(TF_Tensor* t) {
|
||||
return new TFE_TensorHandle(
|
||||
tensorflow::TensorCApi::MakeTensor(t->dtype, t->shape, t->buffer),
|
||||
nullptr);
|
||||
tensorflow::Tensor tensor;
|
||||
// TODO: Add status argument and check on it.
|
||||
tensorflow::TF_TensorToTensor(t, &tensor);
|
||||
return new TFE_TensorHandle(tensor, nullptr);
|
||||
}
|
||||
|
||||
void TFE_DeleteTensorHandle(TFE_TensorHandle* h) { delete h; }
|
||||
|
Loading…
Reference in New Issue
Block a user