Remove pointer.

This commit is contained in:
akhandait
2018-08-07 18:45:16 +05:30
parent b2634d50a6
commit f4180deb9d
2 changed files with 5 additions and 4 deletions
@@ -74,7 +74,7 @@ class ReconstructionLoss
private:
//! Locally-stored distribution object.
DistType* dist;
DistType dist;
//! Locally-stored output parameter object.
OutputDataType outputParameter;
@@ -33,8 +33,8 @@ template<typename InputType, typename TargetType>
double ReconstructionLoss<InputDataType, OutputDataType, DistType>::Forward(
const InputType&& input, const TargetType&& target)
{
dist = new DistType(std::move(input));
return dist->LogProbability(std::move(target));
dist = DistType(std::move(input));
return -dist.LogProbability(std::move(target));
}
template<typename InputDataType, typename OutputDataType, typename DistType>
@@ -44,7 +44,8 @@ void ReconstructionLoss<InputDataType, OutputDataType, DistType>::Backward(
const TargetType&& target,
OutputType&& output)
{
dist->LogProbBackward(std::move(target), std::move(output));
dist.LogProbBackward(std::move(target), std::move(output));
output = -output;
}
template<typename InputDataType, typename OutputDataType, typename DistType>