Class UnflattenImpl

Inheritance Relationships

Base Type

Class Documentation

class torch::nn::UnflattenImpl : public torch::nn::Cloneable<UnflattenImpl>

A placeholder for unflatten operator See to learn about the exact behavior of this module.

See the documentation for torch::nn::UnflattenOptions class to learn what constructor arguments are supported for this module.


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

Public Functions

UnflattenImpl(int64_t dim, std::vector<int64_t> sizes)
UnflattenImpl(std::string dimname, UnflattenOptions::namedshape_t namedshape)
UnflattenImpl(UnflattenOptions options_)
void reset() override

reset() must perform initialization of all members with reference semantics, most importantly parameters, buffers and submodules.

void pretty_print(std::ostream &stream) const override

Pretty prints the Unflatten module into the given stream.

Tensor forward(const Tensor &input)

Applies an unflatten transform on the input.

Public Members

UnflattenOptions options

The options used to configure this module.


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources