Go to the documentation of this file.
12 #ifndef MLPACK_METHODS_ANN_LOSS_FUNCTION_COSINE_EMBEDDING_HPP
13 #define MLPACK_METHODS_ANN_LOSS_FUNCTION_COSINE_EMBEDDING_HPP
36 typename InputDataType = arma::mat,
37 typename OutputDataType = arma::mat
54 const bool similarity =
true,
55 const bool takeMean =
false);
63 template <
typename InputType,
typename TargetType>
64 typename InputType::elem_type
Forward(
const InputType& input,
65 const TargetType& target);
74 template<
typename InputType,
typename TargetType,
typename OutputType>
76 const TargetType& target,
90 OutputDataType&
Delta()
const {
return delta; }
92 OutputDataType&
Delta() {
return delta; }
112 template<
typename Archive>
117 OutputDataType delta;
120 InputDataType inputParameter;
123 OutputDataType outputParameter;
139 #include "cosine_embedding_loss_impl.hpp"
InputType::elem_type Forward(const InputType &input, const TargetType &target)
Ordinary feed forward pass of a neural network.
The core includes that mlpack expects; standard C++ includes and Armadillo.
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType & OutputParameter()
Modify the output parameter.
double & Margin()
Modify the value of takeMean.
void Backward(const InputType &input, const TargetType &target, OutputType &output)
Ordinary feed backward pass of a neural network.
OutputDataType & OutputParameter() const
Get the output parameter.
OutputDataType & Delta() const
Get the delta.
CosineEmbeddingLoss(const double margin=0.0, const bool similarity=true, const bool takeMean=false)
Create the CosineEmbeddingLoss object.
Linear algebra utility functions, generally performed on matrices or vectors.
InputDataType & InputParameter() const
Get the input parameter.
bool Similarity() const
Get the value of similarity hyperparameter.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType & Delta()
Modify the delta.
bool & TakeMean()
Modify the value of takeMean.
bool & Similarity()
Modify the value of takeMean.
Cosine Embedding Loss function is used for measuring whether two inputs are similar or dissimilar,...
bool TakeMean() const
Get the value of takeMean.
double Margin() const
Get the value of margin.