Template Class StackCheckingGenerator

Inheritance Relationships

Base Type

Class Documentation

template<typename MainGenerator, typename MainContext = MainGenerator::Context>
class StackCheckingGenerator : public sequant::ForwardingGenerator<MainGenerator, MainGenerator::Context>

Wrapper for other Generators that verifies that the received sequence of memory actions (create, load, unload, destroy, persist) obeys a stack-like order: objects must be released in the reverse order of their allocation. All callbacks are forwarded to the wrapped Generator unchanged.

This is required by backends that only support stack-like memory allocations (e.g. ITF). Violations are reported by throwing an Exception.

Public Functions

inline StackCheckingGenerator(MainGenerator generator)
inline void create(const Tensor &tensor, bool zero_init, const MainContext &ctx) override
inline void load(const Tensor &tensor, bool set_to_zero, const MainContext &ctx) override
inline void unload(const Tensor &tensor, const MainContext &ctx) override
inline void destroy(const Tensor &tensor, const MainContext &ctx) override
inline void persist(const Tensor &tensor, const MainContext &ctx) override
inline void create(const Variable &variable, bool zero_init, const MainContext &ctx) override
inline void load(const Variable &variable, bool set_to_zero, const MainContext &ctx) override
inline void unload(const Variable &variable, const MainContext &ctx) override
inline void destroy(const Variable &variable, const MainContext &ctx) override
inline void persist(const Variable &variable, const MainContext &ctx) override
inline void begin_expression(const MainContext &ctx) override
inline void end_expression(const MainContext &ctx) override