Class LinearImpl#
Defined in File linear.h
Page Contents
Inheritance Relationships#
Base Type#
public torch::nn::Cloneable< LinearImpl >(Template Class Cloneable)
Class Documentation#
-
class LinearImpl : public torch::nn::Cloneable<LinearImpl>#
Applies a linear transformation with optional bias.
See https://pytorch.org/docs/main/generated/torch.nn.Linear.html to learn about the exact behavior of this module.
See the documentation for
torch::nn::LinearOptionsclass to learn what constructor arguments are supported for this module.Example:
Linear model(LinearOptions(5, 2).bias(false));
Public Functions
-
inline LinearImpl(int64_t in_features, int64_t out_features)#
-
explicit LinearImpl(const LinearOptions &options_)#
-
virtual void reset() override#
reset()must perform initialization of all members with reference semantics, most importantly parameters, buffers and submodules.
-
void reset_parameters()#
-
virtual void pretty_print(std::ostream &stream) const override#
Pretty prints the
Linearmodule into the givenstream.
-
Tensor forward(const Tensor &input)#
Transforms the
inputtensor by multiplying with theweightand optionally adding thebias, ifwith_biasis true in the options.
Public Members
-
LinearOptions options#
The options used to configure this module.
-
Tensor weight#
The learned weight.
-
Tensor bias#
The learned bias.
If
biasis false in theoptions, this tensor is undefined.
-
inline LinearImpl(int64_t in_features, int64_t out_features)#