Struct CosineSimilarityOptions

Page Contents

Struct Documentation

struct CosineSimilarityOptions

Options for the CosineSimilarity module.


CosineSimilarity model(CosineSimilarityOptions().dim(0).eps(0.5));

Public Functions

inline auto dim(const int64_t &new_dim) -> decltype(*this)

Dimension where cosine similarity is computed. Default: 1.

inline auto dim(int64_t &&new_dim) -> decltype(*this)
inline const int64_t &dim() const noexcept
inline int64_t &dim() noexcept
inline auto eps(const double &new_eps) -> decltype(*this)

Small value to avoid division by zero. Default: 1e-8.

inline auto eps(double &&new_eps) -> decltype(*this)
inline const double &eps() const noexcept
inline double &eps() noexcept


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources