Shortcuts

Struct UnflattenOptions

Page Contents

Struct Documentation

struct UnflattenOptions

Options for the Unflatten module.

Note: If input tensor is named, use dimname and namedshape arguments.

Example:

Unflatten unnamed_model(UnflattenOptions(0, {2, 2}));
Unflatten named_model(UnflattenOptions("B", {{"B1", 2}, {"B2", 2}}));

Public Types

typedef std::vector<std::pair<std::string, int64_t>> namedshape_t

Public Functions

UnflattenOptions(int64_t dim, std::vector<int64_t> sizes)
UnflattenOptions(const char *dimname, namedshape_t namedshape)
UnflattenOptions(std::string dimname, namedshape_t namedshape)
inline auto dim(const int64_t &new_dim) -> decltype(*this)

dim to unflatten

inline auto dim(int64_t &&new_dim) -> decltype(*this)
inline const int64_t &dim() const noexcept
inline int64_t &dim() noexcept
inline auto dimname(const std::string &new_dimname) -> decltype(*this)

name of dim to unflatten, for use with named tensors

inline auto dimname(std::string &&new_dimname) -> decltype(*this)
inline const std::string &dimname() const noexcept
inline std::string &dimname() noexcept
inline auto sizes(const std::vector<int64_t> &new_sizes) -> decltype(*this)

new shape of unflattened dim

inline auto sizes(std::vector<int64_t> &&new_sizes) -> decltype(*this)
inline const std::vector<int64_t> &sizes() const noexcept
inline std::vector<int64_t> &sizes() noexcept
inline auto namedshape(const namedshape_t &new_namedshape) -> decltype(*this)

new shape of unflattened dim with names, for use with named tensors

inline auto namedshape(namedshape_t &&new_namedshape) -> decltype(*this)
inline const namedshape_t &namedshape() const noexcept
inline namedshape_t &namedshape() noexcept

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources