2 // Copyright (c) 2018 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 ///////////////////////////////////////////////////////////////////////////////////////////////////
19 #include "primitive.hpp"
22 /// @addtogroup cpp_api C++ API
24 /// @addtogroup cpp_topology Network Topology
26 /// @addtogroup cpp_primitives Primitives
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)
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) {}