| 34 | namespace tensorflow { |
| 35 | |
| 36 | Status GetArrowType(::tensorflow::DataType dtype, std::shared_ptr<DataType>* out) { |
| 37 | switch (dtype) { |
| 38 | case ::tensorflow::DT_BOOL: |
| 39 | *out = arrow::boolean(); |
| 40 | break; |
| 41 | case ::tensorflow::DT_FLOAT: |
| 42 | *out = arrow::float32(); |
| 43 | break; |
| 44 | case ::tensorflow::DT_DOUBLE: |
| 45 | *out = arrow::float64(); |
| 46 | break; |
| 47 | case ::tensorflow::DT_HALF: |
| 48 | *out = arrow::float16(); |
| 49 | break; |
| 50 | case ::tensorflow::DT_INT8: |
| 51 | *out = arrow::int8(); |
| 52 | break; |
| 53 | case ::tensorflow::DT_INT16: |
| 54 | *out = arrow::int16(); |
| 55 | break; |
| 56 | case ::tensorflow::DT_INT32: |
| 57 | *out = arrow::int32(); |
| 58 | break; |
| 59 | case ::tensorflow::DT_INT64: |
| 60 | *out = arrow::int64(); |
| 61 | break; |
| 62 | case ::tensorflow::DT_UINT8: |
| 63 | *out = arrow::uint8(); |
| 64 | break; |
| 65 | case ::tensorflow::DT_UINT16: |
| 66 | *out = arrow::uint16(); |
| 67 | break; |
| 68 | case ::tensorflow::DT_UINT32: |
| 69 | *out = arrow::uint32(); |
| 70 | break; |
| 71 | case ::tensorflow::DT_UINT64: |
| 72 | *out = arrow::uint64(); |
| 73 | break; |
| 74 | default: |
| 75 | return Status::TypeError("TensorFlow data type is not supported"); |
| 76 | } |
| 77 | return Status::OK(); |
| 78 | } |
| 79 | |
| 80 | Status GetTensorFlowType(std::shared_ptr<DataType> dtype, ::tensorflow::DataType* out) { |
| 81 | switch (dtype->id()) { |