Struct TensorBundle¶
Defined in File tensor_bundle.hpp
Nested Relationships¶
Nested Types¶
Struct Documentation¶
-
struct TensorBundle¶
A lightweight container that groups named tensors together. This is the primary structure used to represent inputs, in-out parameters, and outputs inside AMS evaluation pipelines.
Public Functions
-
TensorBundle() = default¶
Default construction.
-
TensorBundle(TensorBundle&&) noexcept = default¶
Move operations for efficiency.
-
TensorBundle &operator=(TensorBundle&&) noexcept = default¶
-
TensorBundle(const TensorBundle&) = default¶
Copy operations allowed (torch::Tensor has cheap refcounted semantics).
-
TensorBundle &operator=(const TensorBundle&) = default¶
-
inline void add(std::string name, at::Tensor t)¶
Add a named tensor to the bundle. Throws std::invalid_argument if a tensor with the same name already exists.
-
inline bool contains(const std::string &name) const noexcept¶
Check if a tensor with the given name exists in the bundle. Note: This performs a linear search (O(n) complexity).
-
inline Item *find(const std::string &name) noexcept¶
Find a tensor by name. Returns nullptr if not found. Note: This performs a linear search (O(n) complexity).
-
inline const Item *find(const std::string &name) const noexcept¶
Find a tensor by name (const version). Returns nullptr if not found. Note: This performs a linear search (O(n) complexity).
-
inline size_t size() const noexcept¶
Number of tensors in the bundle.
-
inline Item &operator[](size_t i) noexcept¶
Random access to items (unchecked). Callers must ensure 0 <= i < size() to avoid undefined behavior.
-
inline Item &at(size_t i)¶
Bounds-checked random access to items. Throws std::out_of_range if i >= size().
-
inline auto begin() noexcept¶
Iterators.
-
inline auto end() noexcept¶
-
inline auto begin() const noexcept¶
-
inline auto end() const noexcept¶
-
inline bool empty() const noexcept¶
Check if empty.
-
inline void clear() noexcept¶
Remove all items.
-
struct Item¶
A single named tensor.
-
TensorBundle() = default¶