Skip to content

tenzr::nn::Softmax

Softmax module normalizing over a configurable axis.

#include <activations.h>

Inherits from tenzr::nn::Module

Public Functions

Name
Softmax(int64_t axis =-1)
virtual Tensor Forward(const Tensor & input) override
virtual std::string Name() const override

Additional inherited members

Public Functions inherited from tenzr::nn::Module

Name
virtual ~Module() =default
Tensor operator()(const Tensor & input)
virtual void Train(bool mode)
void Train()
Switch to training mode.
void Eval()
Switch to evaluation mode.
bool IsTraining() const
Tensor & RegisterParameter(std::string name, Tensor param)
template <typename T ,typename... Args>
std::shared_ptr< T >
RegisterSubmodule(std::string name, Args &&... args)
std::shared_ptr< Module > RegisterSubmodule(std::string name, std::shared_ptr< Module > submod)
std::vector< Tensor > Parameters(bool recurse =true) const
std::unordered_map< std::string, Tensor > NamedParameters(std::string prefix ="", bool recurse =true) const
std::unordered_map< std::string, Tensor > StateDict() const
void LoadStateDict(const std::unordered_map< std::string, Tensor > & state)

Protected Attributes inherited from tenzr::nn::Module

Name
std::unordered_map< std::string, Tensor > parameters_
std::unordered_map< std::string, std::shared_ptr< Module > > submodules_
bool training_

Public Functions Documentation

function Softmax

inline explicit Softmax(
    int64_t axis =-1
)

function Forward

inline virtual Tensor Forward(
    const Tensor & input
) override

Return: Softmax of input.

Reimplements: tenzr::nn::Module::Forward

function Name

inline virtual std::string Name() const override

Return: "Softmax".

Reimplements: tenzr::nn::Module::Name