TRITONTF_Tensor
| 739 | // TRITONTF_Tensor |
| 740 | // |
| 741 | TRITONTF_Tensor* |
| 742 | TRITONTF_TensorNew( |
| 743 | const char* name, TRITONTF_DataType dtype, size_t shape_rank, |
| 744 | int64_t* shape_dims, const int tf_gpu_id) |
| 745 | { |
| 746 | TRITONTF_Shape* shape = TRITONTF_ShapeNew(shape_rank, shape_dims); |
| 747 | tensorflow::TensorShape tfshape; |
| 748 | ConvertShape(shape, &tfshape); |
| 749 | |
| 750 | TensorImpl* tensor = new TensorImpl(name, dtype, shape, tfshape, tf_gpu_id); |
| 751 | // If data type is non-string, make sure TensorImpl contains valid TF tensor |
| 752 | if (dtype != TRITONTF_DataType::TRITONTF_TYPE_STRING) { |
| 753 | // tensor's byte size is set to value required and it is independent to |
| 754 | // the data pointer. So make sure data is not nullptr if byte size > 0 |
| 755 | if ((tensor->ByteSize() != 0) && (tensor->Base() == nullptr)) { |
| 756 | delete tensor; |
| 757 | return nullptr; |
| 758 | } |
| 759 | } |
| 760 | return reinterpret_cast<TRITONTF_Tensor*>(tensor); |
| 761 | } |
| 762 | |
| 763 | TRITONTF_DataType |
| 764 | TRITONTF_TensorDataType(TRITONTF_Tensor* tensor) |
nothing calls this directly
no test coverage detected