Program Listing for File nllloss.h

Return to documentation for file (include/converter/include/ops/nllloss.h)

#ifndef MINDSPORE_CORE_OPS_NLLLOSS_H_
#define MINDSPORE_CORE_OPS_NLLLOSS_H_

#include <memory>
#include <string>
#include <vector>
#include "mindapi/base/types.h"
#include "ops/base_operator.h"

namespace mindspore {
namespace ops {
constexpr auto kNameNLLLoss = "NLLLoss";
class MIND_API NLLLoss : public BaseOperator {
 public:
  MIND_API_BASE_MEMBER(NLLLoss);
  NLLLoss() : BaseOperator(kNameNLLLoss) { InitIOName({"logits", "labels", "weight"}, {"loss", "total_weight"}); }

  void Init(const Reduction &reduction = Reduction::NONE, const int64_t ignore_index = -100);

  void set_reduction(const Reduction &reduction);

  Reduction get_reduction() const;

  void set_ignore_index(const int64_t ignore_index);

  int64_t get_ignore_index() const;
};
}  // namespace ops
}  // namespace mindspore
#endif  // MINDSPORE_CORE_OPS_NLLLOSS_H_