MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TRITONTF_TensorNew

Function TRITONTF_TensorNew

addons/triton/tensorflow_backend_tf.cc:741–761  ·  view source on GitHub ↗

TRITONTF_Tensor

Source from the content-addressed store, hash-verified

739// TRITONTF_Tensor
740//
741TRITONTF_Tensor*
742TRITONTF_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
763TRITONTF_DataType
764TRITONTF_TensorDataType(TRITONTF_Tensor* tensor)

Callers

nothing calls this directly

Calls 4

TRITONTF_ShapeNewFunction · 0.85
ConvertShapeFunction · 0.85
ByteSizeMethod · 0.80
BaseMethod · 0.80

Tested by

no test coverage detected