Shortcuts

Struct CosineSimilarityOptions

Page Contents

Struct Documentation

struct torch::nn::CosineSimilarityOptions

Options for the CosineSimilarity module.

Example:

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

Public Functions

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

Dimension where cosine similarity is computed. Default: 1.

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

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

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

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources