Skip to content

tenzr::nn::Tanh

Hyperbolic tangent activation module.

#include <activations.h>

Inherits from tenzr::nn::Module

Public Functions

Name
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 Forward

inline virtual Tensor Forward(
    const Tensor & input
) override

Return: tanh(input).

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

function Name

inline virtual std::string Name() const override

Return: "Tanh".

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