Publishing 2019 R2 content (#223)
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / api / softmax_loss_grad.hpp
1 /*
2 // Copyright (c) 2018 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 ///////////////////////////////////////////////////////////////////////////////////////////////////
18 #pragma once
19 #include "primitive.hpp"
20
21 namespace cldnn {
22 /// @addtogroup cpp_api C++ API
23 /// @{
24 /// @addtogroup cpp_topology Network Topology
25 /// @{
26 /// @addtogroup cpp_primitives Primitives
27 /// @{
28
29 /// @brief Backward pass for Softmax log loss.
30 /// @details The output values are the same as input_prob, except for the correct one based on the label which is subtracted by 1.
31 struct softmax_loss_grad : public primitive_base<softmax_loss_grad> {
32     CLDNN_DECLARE_PRIMITIVE(softmax_loss_grad)
33
34     /// @brief Constructs softmax_loss_grad primitive.
35     /// @param id This primitive id.
36     /// @param input_prob Input primitive id.
37     /// @param labels Labels primitive id.
38     softmax_loss_grad(const primitive_id& id,
39                       const primitive_id& input_prob,
40                       const primitive_id& labels,
41                       const padding& output_padding = padding())
42         : primitive_base(id, {input_prob, labels}, output_padding) {}
43 };
44 /// @}
45 /// @}
46 /// @}
47 }  // namespace cldnn