Tensor Map#
-
class TensorMap#
Name-to-Tensor pointer mapping for the TRT binding layer.
TensorMap holds non-owning pointers to tensors keyed by name. Callers are responsible for ensuring the referenced tensors outlive the map.
Public Functions
-
TensorMap() = default#
Default constructor.
-
void set(std::string const &name, Tensor &tensor)#
Associate a name with a tensor.
If the name already exists it is overwritten with the new pointer.
- Parameters:
name – Binding name (e.g. “inputs_embeds”)
tensor – Tensor to associate — the map stores a non-owning pointer
-
void set(std::string const &name, Tensor &&tensor) = delete#
Deleted rvalue overload — prevents callers from binding a moved-from or local temporary whose storage would go out of scope before
bindAlldereferences the stored pointer. Any attempt to pass aTensor&&fails to compile as a deliberate tripwire.
-
Tensor *get(std::string const &name) const#
Retrieve a tensor by name.
- Parameters:
name – Binding name to look up
- Returns:
Pointer to the associated tensor, or nullptr if not found
-
bool contains(std::string const &name) const#
Check whether a name is present in the map.
- Parameters:
name – Binding name to check
- Returns:
True if the name exists, false otherwise
-
std::vector<std::string> allNames() const#
Return all registered names.
- Returns:
Vector of all names currently stored in the map
-
inline size_t size() const#
Return the number of entries in the map.
-
TensorMap() = default#