Struct EmbeddingFromPretrainedOptions#
Defined in File embedding.h
Page Contents
Struct Documentation#
-
struct EmbeddingFromPretrainedOptions#
Options for the
Embedding::from_pretrainedfunction.Public Functions
-
inline auto freeze(const bool &new_freeze) -> decltype(*this)#
If
true, the tensor does not get updated in the learning process.Equivalent to
embedding.weight.requires_grad_(false). Default:true
-
inline auto freeze(bool &&new_freeze) -> decltype(*this)#
-
inline const bool &freeze() const noexcept#
-
inline bool &freeze() noexcept#
-
inline auto padding_idx(const std::optional<int64_t> &new_padding_idx) -> decltype(*this)#
If specified, the entries at
padding_idxdo not contribute to the gradient; therefore, the embedding vector atpadding_idxis not updated during training, i.e.it remains as a fixed “pad”.
-
inline auto padding_idx(std::optional<int64_t> &&new_padding_idx) -> decltype(*this)#
-
inline const std::optional<int64_t> &padding_idx() const noexcept#
-
inline std::optional<int64_t> &padding_idx() noexcept#
-
inline auto max_norm(const std::optional<double> &new_max_norm) -> decltype(*this)#
If given, each embedding vector with norm larger than
max_normis renormalized to have normmax_norm.
-
inline auto max_norm(std::optional<double> &&new_max_norm) -> decltype(*this)#
-
inline const std::optional<double> &max_norm() const noexcept#
-
inline std::optional<double> &max_norm() noexcept#
-
inline auto norm_type(const double &new_norm_type) -> decltype(*this)#
The p of the p-norm to compute for the
max_normoption. Default2.
-
inline auto norm_type(double &&new_norm_type) -> decltype(*this)#
-
inline const double &norm_type() const noexcept#
-
inline double &norm_type() noexcept#
-
inline auto scale_grad_by_freq(const bool &new_scale_grad_by_freq) -> decltype(*this)#
If given, this will scale gradients by the inverse of frequency of the words in the mini-batch.
Default
false.
-
inline auto scale_grad_by_freq(bool &&new_scale_grad_by_freq) -> decltype(*this)#
-
inline const bool &scale_grad_by_freq() const noexcept#
-
inline bool &scale_grad_by_freq() noexcept#
-
inline auto sparse(const bool &new_sparse) -> decltype(*this)#
If
true, gradient w.r.t.weightmatrix will be a sparse tensor.
-
inline auto sparse(bool &&new_sparse) -> decltype(*this)#
-
inline const bool &sparse() const noexcept#
-
inline bool &sparse() noexcept#
-
inline auto freeze(const bool &new_freeze) -> decltype(*this)#