MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / typeFromNumpyDesc

Method typeFromNumpyDesc

src/fastertransformer/utils/Tensor.cc:214–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214DataType Tensor::typeFromNumpyDesc(std::string type)
215{
216 static const std::unordered_map<std::string, DataType> type_map{{"?", TYPE_BOOL},
217 {"b", TYPE_BYTES},
218 {"u1", TYPE_UINT8},
219 {"u2", TYPE_UINT16},
220 {"u4", TYPE_UINT32},
221 {"u8", TYPE_UINT64},
222 {"i1", TYPE_INT8},
223 {"i2", TYPE_INT16},
224 {"i4", TYPE_INT32},
225 {"i8", TYPE_INT64},
226 {"f2", TYPE_FP16},
227 {"f4", TYPE_FP32},
228 {"f8", TYPE_FP64}};
229 return type_map.at(type);
230}
231
232size_t Tensor::getTypeSize(DataType type)
233{

Callers

nothing calls this directly

Calls 1

atMethod · 0.80

Tested by

no test coverage detected