* @brief Represents a pool of tensors to manage GPU resources. The pool is * responsible for managing the lifetime of the tensors and freeing them when * the pool is destroyed. * * Most users do not need to interact with the TensorPool type, as there is a * member instance in the Context struct to simplify lifetime management of GPU * resources. */
| 188 | * resources. |
| 189 | */ |
| 190 | struct TensorPool { |
| 191 | inline TensorPool(Context *ctx) : ctx(ctx), data() {}; |
| 192 | Context *ctx; |
| 193 | std::unordered_map<WGPUBuffer, Tensor> data; |
| 194 | ~TensorPool(); |
| 195 | }; |
| 196 | |
| 197 | enum NumType { |
| 198 | kf16, // (experimental) |