Part 2 of Swift<->TF sends/recvs: support receiving tensors in TF from
authorMingsheng Hong <hongm@google.com>
Sat, 5 May 2018 14:10:58 +0000 (07:10 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Mon, 7 May 2018 22:42:04 +0000 (15:42 -0700)
commit067be1aa75d9065b6cc57ba6316fc17544a9fdf1
treecc952cc49d777f7fc1ac828a1c42314aefb8dace
parent150089e6e67e4492f098cdd8f9f2f48dc9f9cc56
Part 2 of Swift<->TF sends/recvs: support receiving tensors in TF from
Swift via direct session.

The changes are:

1. Added a TF experimental C API for Swift host to enqueue a tensor for sending
  to TF. Again, the C APIs can be removed once the Fifo-queue based design
  proves stable later.

2. TFLowerGraph is extended to generate Fifo related nodes for TF to receive
  tensors. This is similar to the extension for TF to send tensors.

3. TFPartition is extended to support host send (createHostSend()), which does
  the tensor send via a new protocol method TensorSendableReceivable.sendToDevice().

The main complexity is in sending a scalar, where a new protocol method
TensorSendableReceivable.createScalarTensor() is called to first create a tensor
out of it, and then send it over to TF.

Also removed code for protocol conformance on AccelerableByTensorFlow. Instead
have compiler look up that conformance from the SILFunction on sending/receiving
tensors.

AccelerableByTensorFlow could be removed from the compiler-known protocol list
now, but we'll defer that till things can stabilized more (in the past this
protocol has been added to and removed from the list at different times).

PiperOrigin-RevId: 195539436
tensorflow/c/c_api_experimental.cc
tensorflow/c/c_api_experimental.h