Shortcuts

Struct UnflattenOptions

Page Contents

Struct Documentation

struct torch::nn::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)
auto dim(const int64_t &new_dim) -> decltype(*this)

dim to unflatten

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

name of dim to unflatten, for use with named tensors

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

new shape of unflattened dim

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

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

auto namedshape(namedshape_t &&new_namedshape) -> decltype(*this)
const namedshape_t &namedshape() const noexcept
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