libdl  0.0.1
Simple yet powerful deep learning
Loading...
Searching...
No Matches
dl::Linear Class Referencefinal

Applies a learnable linear transformation with optional bias. More...

#include <linear.hpp>

Inheritance diagram for dl::Linear:
Collaboration diagram for dl::Linear:

Public Member Functions

 Linear (size_t inFeatures, size_t outFeatures, const Device &device, bool bias=true) noexcept
 
 Linear (size_t inFeatures, size_t outFeatures, bool bias=true) noexcept
 
virtual TensorPtr forward (TensorPtr input) noexcept override
 
TensorPtrweights () noexcept
 
const TensorPtrweights () const noexcept
 
TensorPtrbias () noexcept
 
const TensorPtrbias () const noexcept
 
dl::TensorPtr operator() (TensorPtr input) noexcept
 

Detailed Description

Applies a learnable linear transformation with optional bias.

Given a vector \(x\) computes \(xW^\top + b\).

Definition at line 12 of file linear.hpp.

Member Function Documentation

◆ bias() [1/2]

const TensorPtr & dl::Linear::bias ( ) const
inlinenoexcept

Definition at line 27 of file linear.hpp.

27{ return _bias; }

◆ bias() [2/2]

TensorPtr & dl::Linear::bias ( )
inlinenoexcept

Definition at line 26 of file linear.hpp.

26{ return _bias; }

◆ operator()()

dl::TensorPtr dl::Linear::operator() ( TensorPtr  input)
inlinenoexcept

Definition at line 29 of file linear.hpp.

29{ return forward(input); }

◆ weights() [1/2]

const TensorPtr & dl::Linear::weights ( ) const
inlinenoexcept

Definition at line 25 of file linear.hpp.

25{ return _weights; }

◆ weights() [2/2]

TensorPtr & dl::Linear::weights ( )
inlinenoexcept

Definition at line 24 of file linear.hpp.

24{ return _weights; }

The documentation for this class was generated from the following file: