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

Method getVal

src/fastertransformer/utils/Tensor.h:136–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134
135 template<typename T>
136 inline T getVal(size_t index) const
137 {
138 FT_LOG_DEBUG("%s start", __PRETTY_FUNCTION__);
139 FT_CHECK(where == MEMORY_CPU);
140 FT_CHECK(data != nullptr);
141 FT_CHECK_WITH_INFO(index < size(), "index is larger than buffer size");
142
143 if (getTensorType<T>() != type) {
144 FT_LOG_DEBUG("getVal with type %s, but data type is: %s",
145 getNumpyTypeDesc(getTensorType<T>()).c_str(),
146 getNumpyTypeDesc(type).c_str());
147 }
148 return ((T*)data)[index];
149 }
150
151 template<typename T>
152 inline T getVal() const

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected