clDNN
softmax.hpp
1 /*
2 // Copyright (c) 2016 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 
18 #pragma once
19 #include "../C/softmax.h"
20 #include "primitive.hpp"
21 
22 namespace cldnn
23 {
30 
39 struct softmax : public primitive_base<softmax, CLDNN_PRIMITIVE_DESC(softmax)>
40 {
41  CLDNN_DECLATE_PRIMITIVE(softmax)
42 
43 
45  {
46  normalize_f = cldnn_softmax_normalize_f,
47  normalize_x = cldnn_softmax_normalize_x,
48  normalize_y = cldnn_softmax_normalize_y,
49  normalize_fyx = cldnn_softmax_normalize_fyx,
50  };
51 
57  const primitive_id& id,
58  const primitive_id& input,
59  const dimension_t dimension = normalize_fyx,
60  const padding& output_padding = padding()
61  )
64  {}
65 
67  softmax(const dto* dto)
69  , dimension(static_cast<dimension_t>(dto->dimension))
70  {}
71 
81 
82 private:
83  void update_dto(dto& dto) const override
84  {
86  }
87 };
91 }
Represents data padding information.
Definition: layout.hpp:125
softmax(const primitive_id &id, const primitive_id &input, const dimension_t dimension=normalize_fyx, const padding &output_padding=padding())
Constructs softmax primitive.
Definition: softmax.hpp:56
cldnn_softmax_dimension dimension
Defines a scope of a single softmax normalization.
Definition: softmax.h:59
softmax(const dto *dto)
Constructs a copy from C API cldnn_softmax_desc.
Definition: softmax.hpp:67
dimension_t
Enum type to specify softmax&#39;s normalization scope (see dimension).
Definition: softmax.hpp:44
const primitive_id id
Primitive&#39;s id.
Definition: primitive.hpp:143
dimension_t dimension
Defines a scope of a single softmax normalization.
Definition: softmax.hpp:80
std::string primitive_id
Unique id of a primitive within a topology.
Definition: primitive.hpp:42
Normalizes results so they sum to 1.
Definition: softmax.hpp:39
fixed_size_vector_ref input
List of ids of input primitives.
Definition: primitive.hpp:146
cldnn_softmax_dimension
Enum type to specify softmax&#39;s normalization scope (see cldnn_softmax_desc::dimension).
Definition: softmax.h:34
base class for all primitives implementations.
Definition: primitive.hpp:190
padding output_padding
Requested output padding.
Definition: primitive.hpp:149
Normalizes results so they sum to 1. The scope of normalization is defined by a member dimension...
Definition: softmax.h:50