Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/libtorch_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ ConvertTorchTypeToDataType(const torch::ScalarType& stype)
return TRITONSERVER_TYPE_FP32;
case torch::kDouble:
return TRITONSERVER_TYPE_FP64;
case torch::kBFloat16:
return TRITONSERVER_TYPE_BF16;
default:
break;
}
Expand Down Expand Up @@ -89,6 +91,9 @@ ConvertDataTypeToTorchType(const TRITONSERVER_DataType dtype)
case TRITONSERVER_TYPE_FP64:
type = torch::kDouble;
break;
case TRITONSERVER_TYPE_BF16:
type = torch::kBFloat16;
break;
case TRITONSERVER_TYPE_UINT16:
case TRITONSERVER_TYPE_UINT32:
case TRITONSERVER_TYPE_UINT64:
Expand Down Expand Up @@ -130,6 +135,8 @@ ModelConfigDataTypeToTorchType(const std::string& data_type_str)
type = torch::kFloat;
} else if (dtype == "FP64") {
type = torch::kDouble;
} else if (dtype == "BF16") {
type = torch::kBFloat16;
} else {
return std::make_pair(false, type);
}
Expand Down