Class BilinearImpl

Inheritance Relationships

Base Type

Class Documentation

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

Applies a billinear transformation with optional bias.

See to learn about the exact behavior of this module.

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


Bilinear model(BilinearOptions(3, 2, 4).bias(false));

Public Functions

BilinearImpl(int64_t in1_features, int64_t in2_features, int64_t out_features)
BilinearImpl(const BilinearOptions &options_)
void reset() override

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

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

Pretty prints the Bilinear module into the given stream.

Tensor forward(const Tensor &input1, const Tensor &input2)

Applies a bilinear transform on the input1 and input2 tensor by multiplying with the weight and optionally adding the bias, if with_bias is true in the options.

Public Members

BilinearOptions options

The options used to configure this module.

Tensor weight

The learned weight.

Tensor bias

The learned bias.

If with_bias is false in the options, this tensor is undefined.


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