Intel(R) Math Kernel Library for Deep Neural Networks (Intel(R) MKL-DNN)  1.0.4
Performance library for Deep Learning
mkldnn.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2016-2019 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 
19 
20 #ifndef MKLDNN_HPP
21 #define MKLDNN_HPP
22 
23 #include "mkldnn_config.h"
24 
25 #ifndef DOXYGEN_SHOULD_SKIP_THIS
26 #include <stdlib.h>
27 #include <memory>
28 #include <vector>
29 #include <unordered_map>
30 #include <algorithm>
31 #include <iterator>
32 
33 #include "mkldnn.h"
34 
35 #if MKLDNN_GPU_RUNTIME == MKLDNN_RUNTIME_OCL
36 #include <CL/cl.h>
37 #endif
38 
39 #endif
40 
41 namespace mkldnn {
42 
45 
48 
53 struct error: public std::exception {
54  mkldnn_status_t status;
55  const char *message;
56 
61  error(mkldnn_status_t astatus, const char *amessage)
62  : status(astatus), message(amessage) {}
63 
65  const char *what() const noexcept override { return message; }
66 
72  static void wrap_c_api(mkldnn_status_t status, const char *message) {
73  if (status != mkldnn_success)
74  throw error(status, message);
75  }
76 };
77 
79 template <typename T> class handle_traits {};
80 
94 template <typename T, typename traits=handle_traits<T>> class handle {
95 private:
96  static mkldnn_status_t dummy_destructor(T){ return mkldnn_success; }
97 
98  std::shared_ptr<typename std::remove_pointer<T>::type> _data;
99  handle(const handle &&) = delete;
100  handle &operator=(const handle &&other) = delete;
101 protected:
102  bool operator==(const T other) const { return other == _data.get(); }
103  bool operator!=(const T other) const { return !(*this == other); }
104 public:
108  handle(T t, bool weak = false): _data(0) {
109  reset(t, weak);
110  }
111 
121  handle(): handle((T)0, true) {}
122 
123  handle(const handle &other): _data(other._data) {}
124  handle &operator=(const handle &other) {
125  _data = other._data;
126  return *this;
127  }
131  void reset(T t, bool weak = false) {
132  _data.reset(t, weak ? &dummy_destructor : traits::destructor);
133  }
134 
136  T get(bool allow_emtpy = false) const {
137  T result = _data.get();
138 
139  if (allow_emtpy == false && result == nullptr)
141  "attempt to use uninitialized object");
142 
143  return result;
144  }
145 
146  bool operator==(const handle &other) const { return other._data.get() == _data.get(); }
147  bool operator!=(const handle &other) const { return !(*this == other); }
148 };
149 
150 #ifndef DOXYGEN_SHOULD_SKIP_THIS
151 template <> struct handle_traits<mkldnn_memory_t> {
152  static constexpr auto destructor = &mkldnn_memory_destroy;
153 };
154 
155 template <> struct handle_traits<mkldnn_primitive_desc_t> {
156  static constexpr auto destructor = &mkldnn_primitive_desc_destroy;
157 };
158 
159 template <> struct handle_traits<mkldnn_primitive_t> {
160  static constexpr auto destructor = &mkldnn_primitive_destroy;
161 };
162 
163 template <> struct handle_traits<mkldnn_primitive_desc_iterator_t> {
164  static constexpr auto destructor = &mkldnn_primitive_desc_iterator_destroy;
165 };
166 #endif
167 
168 struct stream;
169 struct error;
170 struct memory;
171 struct primitive_desc;
172 
174 class primitive: public handle<mkldnn_primitive_t> {
175  friend struct error;
176  friend struct stream;
177  using handle::handle;
178 public:
181  enum class kind {
191  sum = mkldnn_sum,
203  lrn = mkldnn_lrn,
209  rnn = mkldnn_rnn,
210  };
211 
213  primitive(const primitive_desc &pd);
214 
217  // TODO: use the C++ API wrapper structure.
218 
219  void execute(stream &astream,
220  const std::unordered_map<int, memory> &args) const;
221 };
222 
223 inline mkldnn_primitive_kind_t convert_to_c(primitive::kind akind) {
224  return static_cast<mkldnn_primitive_kind_t>(akind);
225 }
226 
230  "could not get primitive descriptor by primitive");
231  return pd;
232 }
234 
239 
241 enum class scratchpad_mode {
246 };
247 
248 inline mkldnn_scratchpad_mode_t convert_to_c(scratchpad_mode mode) {
249  return static_cast<mkldnn_scratchpad_mode_t>(mode);
250 }
251 
253 enum class prop_kind {
275 };
276 
277 inline mkldnn_prop_kind_t convert_to_c(prop_kind kind) {
278  return static_cast<mkldnn_prop_kind_t>(kind);
279 }
280 
282 enum class algorithm {
283  undef = mkldnn_alg_kind_undef,
326  pooling_avg = mkldnn_pooling_avg,
345 };
346 
347 inline mkldnn_alg_kind_t convert_to_c(algorithm aalgorithm) {
348  return static_cast<mkldnn_alg_kind_t>(aalgorithm);
349 }
350 
352 enum class normalization_flags : unsigned {
365 
380 
389 };
390 
391 inline mkldnn_normalization_flags_t convert_to_c(
392  normalization_flags aflag) {
393  return static_cast<mkldnn_normalization_flags_t>(aflag);
394 }
395 
396 enum class rnn_flags : unsigned {
397  undef = mkldnn_rnn_flags_undef
398 };
399 
400 inline mkldnn_rnn_flags_t convert_to_c(
401  rnn_flags aflag) {
402  return static_cast<mkldnn_rnn_flags_t>(aflag);
403 }
404 
405 #define MKLDNN_DEFINE_BITMASK_OPS(enum_name) \
406 inline enum_name operator|(enum_name lhs, enum_name rhs) { \
407  return static_cast<enum_name>( \
408  static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); \
409 } \
410  \
411 inline enum_name operator&(enum_name lhs, enum_name rhs) { \
412  return static_cast<enum_name>( \
413  static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); \
414 } \
415  \
416 inline enum_name operator^(enum_name lhs, enum_name rhs) { \
417  return static_cast<enum_name>( \
418  static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); \
419 } \
420  \
421 inline enum_name& operator|=(enum_name &lhs, enum_name rhs) { \
422  lhs = static_cast<enum_name>( \
423  static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); \
424  return lhs; \
425 } \
426  \
427 inline enum_name& operator&=(enum_name &lhs, enum_name rhs) { \
428  lhs = static_cast<enum_name>( \
429  static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); \
430  return lhs; \
431 } \
432  \
433 inline enum_name& operator^=(enum_name &lhs, enum_name rhs) { \
434  lhs = static_cast<enum_name>( \
435  static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); \
436  return lhs; \
437 } \
438  \
439 inline enum_name operator~(enum_name rhs) { \
440  return static_cast<enum_name>(~static_cast<unsigned>(rhs)); \
441 } \
442 
443 MKLDNN_DEFINE_BITMASK_OPS(normalization_flags)
444 MKLDNN_DEFINE_BITMASK_OPS(rnn_flags)
445 
446 #undef MKLDNN_DEFINE_BITMASK_OPS
447 
448 enum class rnn_direction {
449  unidirectional_left2right = mkldnn_unidirectional_left2right,
450  unidirectional_right2left = mkldnn_unidirectional_right2left,
451  unidirectional = mkldnn_unidirectional,
452  bidirectional_concat = mkldnn_bidirectional_concat,
453  bidirectional_sum = mkldnn_bidirectional_sum,
454 };
455 
456 inline mkldnn_rnn_direction_t convert_to_c(rnn_direction adir) {
457  return static_cast<mkldnn_rnn_direction_t>(adir);
458 }
459 
467 enum class query {
470 
475 
480 
489 
494 
497 
520 
537 };
538 
539 inline mkldnn_query_t convert_to_c(query aquery) {
540  return static_cast<mkldnn_query_t>(aquery);
541 }
542 
544 
550 
551 #ifndef DOXYGEN_SHOULD_SKIP_THIS
552 template <> struct handle_traits<mkldnn_post_ops_t> {
553  static constexpr auto destructor = &mkldnn_post_ops_destroy;
554 };
555 #endif
556 
560 struct post_ops: public handle<mkldnn_post_ops_t> {
563  mkldnn_post_ops_t result;
565  "could not create post operation sequence");
566  reset(result);
567  }
568 
570  int len() const { return mkldnn_post_ops_len(get()); }
571 
573  primitive::kind kind(int index) const {
576  "post_ops index is out of range");
577  return static_cast<primitive::kind>(mkldnn_post_ops_get_kind(get(),
578  index));
579  }
580 
601  void append_sum(float scale = 1.) {
603  "could not append sum");
604  }
605 
608  void get_params_sum(int index, float &scale) const {
610  "could not get sum params");
611  }
612 
621  void append_eltwise(float scale, algorithm alg, float alpha,
622  float beta) {
624  convert_to_c(alg), alpha, beta),
625  "could not append eltwise");
626  }
627 
629  void get_params_eltwise(int index, float &scale, algorithm &alg,
630  float &alpha, float &beta) const {
631  mkldnn_alg_kind_t c_alg;
633  &scale, &c_alg, &alpha, &beta),
634  "could not get eltwise params");
635  alg = static_cast<algorithm>(c_alg);
636  }
637 };
638 
639 #ifndef DOXYGEN_SHOULD_SKIP_THIS
640 template <> struct handle_traits<mkldnn_primitive_attr_t> {
641  static constexpr auto destructor = &mkldnn_primitive_attr_destroy;
642 };
643 #endif
644 
648 struct primitive_attr: public handle<mkldnn_primitive_attr_t> {
653  "could not create a primitive attr");
654  reset(result);
655  }
656 
661  get(), &result), "could not get scratchpad mode");
662  return scratchpad_mode(result);
663  }
664 
668  get(), mkldnn::convert_to_c(mode)),
669  "could not set scratchpad mode");
670  }
671 
674  void get_output_scales(int &mask, std::vector<float> &scales) const {
675  mkldnn_dim_t count;
676  int c_mask;
677  const float *c_scales;
679  &count, &c_mask, &c_scales),
680  "could not get int output scales");
681  scales.resize(count);
682 
683  mask = c_mask;
684  for (mkldnn_dim_t c = 0; c < count; ++c)
685  scales[c] = c_scales[c];
686  }
687 
703  void set_output_scales(int mask, const std::vector<float> &scales) {
705  (mkldnn_dim_t)scales.size(), mask, &scales[0]),
706  "could not set int output scales");
707  }
708 
710  const post_ops get_post_ops() const {
711  post_ops result;
712  const_mkldnn_post_ops_t c_result;
714  "could not get post operation sequence");
715  result.reset(const_cast<mkldnn_post_ops_t>(c_result), true);
716  return result;
717  }
718 
720  void set_post_ops(post_ops ops) {
722  "could not set post operation sequence");
723  }
724 
733  void set_rnn_data_qparams(float scale, float shift) {
735  scale, shift), "could not set rnn data int scale/shift");
736  }
737 
761  void set_rnn_weights_qparams(int mask, const std::vector<float> &scales) {
763  (int)scales.size(), mask, &scales[0]),
764  "could not set rnn weights int scales");
765  }
766 };
767 
769 
775 
776 #ifndef DOXYGEN_SHOULD_SKIP_THIS
777 template <> struct handle_traits<mkldnn_engine_t> {
778  static constexpr auto destructor = &mkldnn_engine_destroy;
779 };
780 #endif
781 
783 struct engine: public handle<mkldnn_engine_t> {
784  friend class primitive;
785 
787  enum class kind {
791  cpu = mkldnn_cpu,
793  gpu = mkldnn_gpu,
794  };
795 
796  engine() = default;
797 
801  static size_t get_count(kind akind) {
802  return mkldnn_engine_get_count(convert_to_c(akind));
803  }
804 
811  engine(kind akind, size_t index) {
812  mkldnn_engine_t aengine;
814  mkldnn_engine_create(&aengine,
815  convert_to_c(akind), index),
816  "could not create an engine");
817  reset(aengine);
818  }
819 
820 #if MKLDNN_GPU_RUNTIME == MKLDNN_RUNTIME_OCL
821  engine(kind akind, cl_device_id device, cl_context context) {
824  mkldnn_engine_t aengine;
825  error::wrap_c_api(mkldnn_engine_create_ocl(&aengine,
826  convert_to_c(akind), device, context),
827  "could not create an engine");
828  reset(aengine);
829  }
830 #endif
831 
833  explicit engine(const mkldnn_engine_t& aengine)
834  : handle(aengine, true) {}
835 
839  mkldnn_engine_t engine_q;
842  mkldnn::convert_to_c(mkldnn::query::engine), 0, &engine_q),
843  "could not get engine from primitive_desc");
844  reset(engine_q, true);
845  }
846 
848  kind get_kind() const {
849  mkldnn_engine_kind_t akind;
851  "could not get the engine kind");
852  return static_cast<engine::kind>(akind);
853  }
854 
855 #if MKLDNN_GPU_RUNTIME == MKLDNN_RUNTIME_OCL
856  cl_context get_ocl_context() const {
858  cl_context context = nullptr;
859  error::wrap_c_api(mkldnn_engine_get_ocl_context(get(), &context),
860  "could not get a context handle");
861  return context;
862  }
863 
865  cl_device_id get_ocl_device() const {
866  cl_device_id device = nullptr;
867  error::wrap_c_api(mkldnn_engine_get_ocl_device(get(), &device),
868  "could not get a device handle");
869  return device;
870  }
871 #endif
872 
873 
874  template <class primitive_desc>
875  static engine query(const primitive_desc &pd) {
876  mkldnn_engine_t engine_q;
879  mkldnn::convert_to_c(mkldnn::query::engine), 0, &engine_q),
880  "could not get engine from primitive_desc");
881 
882  return engine(engine_q);
883  }
884 
885 private:
886  static mkldnn_engine_kind_t convert_to_c(kind akind) {
887  return static_cast<mkldnn_engine_kind_t>(akind);
888  }
889 };
890 
892 
898 
899 #ifndef DOXYGEN_SHOULD_SKIP_THIS
900 template <> struct handle_traits<mkldnn_stream_t> {
901  static constexpr auto destructor = &mkldnn_stream_destroy;
902 };
903 #endif
904 
906 struct stream: public handle<mkldnn_stream_t> {
907  using handle::handle;
908 
910  enum class flags : unsigned {
920  };
921 
922  stream() = default;
923 
925  stream(const engine &aengine,
926  flags aflags = flags::default_flags) {
927  mkldnn_stream_t astream;
928  error::wrap_c_api(mkldnn_stream_create(&astream, aengine.get(),
929  static_cast<mkldnn_stream_flags_t>(aflags)),
930  "could not create a stream");
931  reset(astream);
932  }
933 
934 #if MKLDNN_GPU_RUNTIME == MKLDNN_RUNTIME_OCL
935  stream(const engine &eng, cl_command_queue queue) {
938  mkldnn_stream_t astream;
939  error::wrap_c_api(mkldnn_stream_create_ocl(&astream, eng.get(), queue),
940  "could not create a stream");
941  reset(astream);
942  }
943 
945  cl_command_queue get_ocl_command_queue() const {
946  cl_command_queue queue = nullptr;
947  error::wrap_c_api(mkldnn_stream_get_ocl_command_queue(get(), &queue),
948  "could not get OpenCL command queue");
949  return queue;
950  }
951 #endif
952 
953 
957  "could not wait a stream");
958  return *this;
959  }
960 };
961 
962 inline stream::flags operator|(stream::flags lhs, stream::flags rhs) {
963  return static_cast<stream::flags>(
964  static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs));
965 }
966 
967 inline stream::flags operator&(stream::flags lhs, stream::flags rhs) {
968  return static_cast<stream::flags>(
969  static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs));
970 }
971 
972 inline stream::flags operator^(stream::flags lhs, stream::flags rhs) {
973  return static_cast<stream::flags>(
974  static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs));
975 }
976 
977 inline stream::flags operator~(stream::flags rhs) {
978  return static_cast<stream::flags>(~static_cast<unsigned>(rhs));
979 }
980 
982 
985 
991 
993 struct memory: public handle<mkldnn_memory_t> {
994  typedef mkldnn_dim_t dim;
995  typedef std::vector<dim> dims;
996 
997  template <typename T> static void validate_dims(const std::vector<T> &v) {
998  if (v.size() > MKLDNN_MAX_NDIMS)
999  throw error(mkldnn_invalid_arguments, "invalid dimensions");
1000  }
1001 
1003  enum class data_type {
1007  f16 = mkldnn_f16,
1009  bf16 = mkldnn_bf16,
1011  f32 = mkldnn_f32,
1013  s32 = mkldnn_s32,
1015  s8 = mkldnn_s8,
1017  u8 = mkldnn_u8,
1018  };
1019 
1021  enum class format_kind {
1035  };
1036 
1039  enum class format_tag {
1045 
1046  // Semantic agnostic section
1047  // The physical order of dimensions is defined by the permutation of the
1048  // characters, assuming that ab..z defines the natural order.
1049 
1050  // Plain formats
1051 
1052  a = mkldnn_a,
1053  ab = mkldnn_ab,
1054  abc = mkldnn_abc,
1055  abcd = mkldnn_abcd,
1056  abcde = mkldnn_abcde,
1057  abcdef = mkldnn_abcdef,
1058 
1059  // Permuted plain formats
1060 
1061  abdec = mkldnn_abdec,
1062  acb = mkldnn_acb,
1063  acbde = mkldnn_acbde,
1064  acdb = mkldnn_acdb,
1065  acdeb = mkldnn_acdeb,
1066  ba = mkldnn_ba,
1067  bac = mkldnn_bac,
1068  bacd = mkldnn_bacd,
1069  bcda = mkldnn_bcda,
1070  cba = mkldnn_cba,
1071  cdba = mkldnn_cdba,
1072  cdeba = mkldnn_cdeba,
1073  decab = mkldnn_decab,
1074 
1075  // Opaque blocked formats
1076 
1077  Abc16a = mkldnn_Abc16a,
1078  ABc16a16b = mkldnn_ABc16a16b,
1079  aBc16b = mkldnn_aBc16b,
1080  ABc16b16a = mkldnn_ABc16b16a,
1081  Abc4a = mkldnn_Abc4a,
1082  aBc4b = mkldnn_aBc4b,
1083  ABc4b16a4b = mkldnn_ABc4b16a4b,
1084  ABc4b4a = mkldnn_ABc4b4a,
1085  ABc8a16b2a = mkldnn_ABc8a16b2a,
1086  ABc8a8b = mkldnn_ABc8a8b,
1087  aBc8b = mkldnn_aBc8b,
1088  ABc8b16a2b = mkldnn_ABc8b16a2b,
1089  ABc8b8a = mkldnn_ABc8b8a,
1090  Abcd16a = mkldnn_Abcd16a,
1091  ABcd16a16b = mkldnn_ABcd16a16b,
1092  aBcd16b = mkldnn_aBcd16b,
1093  ABcd16b16a = mkldnn_ABcd16b16a,
1094  aBCd16b16c = mkldnn_aBCd16b16c,
1095  aBCd16c16b = mkldnn_aBCd16c16b,
1096  Abcd4a = mkldnn_Abcd4a,
1097  aBcd4b = mkldnn_aBcd4b,
1098  ABcd4b16a4b = mkldnn_ABcd4b16a4b,
1099  ABcd4b4a = mkldnn_ABcd4b4a,
1100  aBCd4c16b4c = mkldnn_aBCd4c16b4c,
1101  aBCd4c4b = mkldnn_aBCd4c4b,
1102  ABcd8a16b2a = mkldnn_ABcd8a16b2a,
1103  ABcd8a8b = mkldnn_ABcd8a8b,
1106  ABcd8b16a2b = mkldnn_ABcd8b16a2b,
1107  aBCd8b16c2b = mkldnn_aBCd8b16c2b,
1110  aBCd8b8c = mkldnn_aBCd8b8c,
1111  aBCd8c16b2c = mkldnn_aBCd8c16b2c,
1112  aBCd8c8b = mkldnn_aBCd8c8b,
1113  Abcde16a = mkldnn_Abcde16a,
1114  ABcde16a16b = mkldnn_ABcde16a16b,
1115  aBcde16b = mkldnn_aBcde16b,
1116  ABcde16b16a = mkldnn_ABcde16b16a,
1117  aBCde16b16c = mkldnn_aBCde16b16c,
1118  aBCde16c16b = mkldnn_aBCde16c16b,
1119  aBCde2c8b4c = mkldnn_aBCde2c8b4c,
1120  Abcde4a = mkldnn_Abcde4a,
1121  aBcde4b = mkldnn_aBcde4b,
1122  ABcde4b4a = mkldnn_ABcde4b4a,
1123  aBCde4b4c = mkldnn_aBCde4b4c,
1124  aBCde4c16b4c = mkldnn_aBCde4c16b4c,
1125  aBCde4c4b = mkldnn_aBCde4c4b,
1126  Abcde8a = mkldnn_Abcde8a,
1127  ABcde8a8b = mkldnn_ABcde8a8b,
1128  aBcde8b = mkldnn_aBcde8b,
1129  ABcde8b16a2b = mkldnn_ABcde8b16a2b,
1130  aBCde8b16c2b = mkldnn_aBCde8b16c2b,
1131  ABcde8b8a = mkldnn_ABcde8b8a,
1132  aBCde8b8c = mkldnn_aBCde8b8c,
1133  ABcd4a8b8a4b = mkldnn_ABcd4a8b8a4b,
1134  ABcd2a8b8a2b = mkldnn_ABcd2a8b8a2b,
1135  aBCde4b8c8b4c = mkldnn_aBCde4b8c8b4c,
1136  aBCde2b8c8b2c = mkldnn_aBCde2b8c8b2c,
1137  aBCde8c16b2c = mkldnn_aBCde8c16b2c,
1138  aBCde8c8b = mkldnn_aBCde8c8b,
1139  aBcdef16b = mkldnn_aBcdef16b,
1140  aBCdef16b16c = mkldnn_aBCdef16b16c,
1141  aBCdef16c16b = mkldnn_aBCdef16c16b,
1142  aBcdef4b = mkldnn_aBcdef4b,
1143  aBCdef4c4b = mkldnn_aBCdef4c4b,
1144  aBCdef8b8c = mkldnn_aBCdef8b8c,
1145  aBCdef8c16b2c = mkldnn_aBCdef8c16b2c,
1146  aBCdef8c8b = mkldnn_aBCdef8c8b,
1147  aBdc16b = mkldnn_aBdc16b,
1148  aBdc4b = mkldnn_aBdc4b,
1149  aBdc8b = mkldnn_aBdc8b,
1150  aBdec16b = mkldnn_aBdec16b,
1151  aBdec4b = mkldnn_aBdec4b,
1152  aBdec8b = mkldnn_aBdec8b,
1153  aBdefc16b = mkldnn_aBdefc16b,
1154  aCBdef16c16b = mkldnn_aCBdef16c16b,
1155  aBdefc4b = mkldnn_aBdefc4b,
1156  aBdefc8b = mkldnn_aBdefc8b,
1157  Acb16a = mkldnn_Acb16a,
1158  Acb4a = mkldnn_Acb4a,
1159  Acb8a = mkldnn_Acb8a,
1160  aCBd16b16c = mkldnn_aCBd16b16c,
1161  aCBd16c16b = mkldnn_aCBd16c16b,
1162  aCBde16b16c = mkldnn_aCBde16b16c,
1163  aCBde16c16b = mkldnn_aCBde16c16b,
1164  Acdb16a = mkldnn_Acdb16a,
1165  Acdb4a = mkldnn_Acdb4a,
1166  Acdb8a = mkldnn_Acdb8a,
1167  Acdeb16a = mkldnn_Acdeb16a,
1168  Acdeb4a = mkldnn_Acdeb4a,
1169  Acdeb8a = mkldnn_Acdeb8a,
1170  BAc16a16b = mkldnn_BAc16a16b,
1171  BAc16b16a = mkldnn_BAc16b16a,
1172  BAcd16a16b = mkldnn_BAcd16a16b,
1173  BAcd16b16a = mkldnn_BAcd16b16a,
1174  ABcd32a32b = mkldnn_ABcd32a32b,
1175  BAcde16b16 = mkldnn_BAcde16b16a,
1176  aBdec32b = mkldnn_aBdec32b,
1177  Abcdef16a = mkldnn_Abcdef16a,
1178  Acdb32a = mkldnn_Acdb32a,
1179  format_tag_last = mkldnn_format_tag_last,
1180 
1181  x = mkldnn_x,
1184  nc = mkldnn_nc,
1185  cn = mkldnn_cn,
1186  ncw = mkldnn_ncw,
1187  nwc = mkldnn_nwc,
1190  nchw = mkldnn_nchw,
1193  nhwc = mkldnn_nhwc,
1196  chwn = mkldnn_chwn,
1197  ncdhw = mkldnn_ncdhw,
1198  ndhwc = mkldnn_ndhwc,
1199  oi = mkldnn_oi,
1200  io = mkldnn_io,
1201  oiw = mkldnn_oiw,
1202  wio = mkldnn_wio,
1203  oihw = mkldnn_oihw,
1204  hwio = mkldnn_hwio,
1205  ihwo = mkldnn_ihwo,
1206  iohw = mkldnn_iohw,
1207  oidhw = mkldnn_oidhw,
1208  dhwio = mkldnn_dhwio,
1209  goiw = mkldnn_goiw,
1210  goihw = mkldnn_goihw,
1211  hwigo = mkldnn_hwigo,
1212  giohw = mkldnn_giohw,
1213  goidhw = mkldnn_goidhw,
1214  tnc = mkldnn_tnc,
1215  ntc = mkldnn_ntc,
1216  ldnc = mkldnn_ldnc,
1217  ldigo = mkldnn_ldigo,
1218  ldgoi = mkldnn_ldgoi,
1219  ldgo = mkldnn_ldgo,
1220  nCdhw16c = mkldnn_nCdhw16c,
1221  nCdhw4c = mkldnn_nCdhw4c,
1222  nCdhw8c = mkldnn_nCdhw8c,
1223  nChw16c = mkldnn_nChw16c,
1224  nChw4c = mkldnn_nChw4c,
1225  nChw8c = mkldnn_nChw8c,
1226  nCw16c = mkldnn_nCw16c,
1227  nCw4c = mkldnn_nCw4c,
1228  nCw8c = mkldnn_nCw8c,
1229  NCw16n16c = mkldnn_NCw16n16c,
1230  NChw16n16c = mkldnn_NChw16n16c,
1231  NCdhw16n16c = mkldnn_NCdhw16n16c,
1232  NChw32n32c = mkldnn_NChw32n32c,
1233  IOhw16i16o = mkldnn_IOhw16i16o,
1234  Ohwi32o = mkldnn_Ohwi32o,
1235  IOdhw16i16o = mkldnn_IOdhw16i16o,
1236  gIOhw16i16o = mkldnn_gIOhw16i16o,
1237  gOhwi32o = mkldnn_gOhwi32o,
1238  Goidhw16g = mkldnn_Goidhw16g,
1239  IOw16o16i = mkldnn_IOw16o16i,
1240  OIw16i16o = mkldnn_OIw16i16o,
1241  IOw16i16o = mkldnn_IOw16i16o,
1242  gIOw16i16o = mkldnn_gIOw16i16o,
1243  OIw16o16i = mkldnn_OIw16o16i,
1244  Oiw16o = mkldnn_Oiw16o,
1245  OIw4i16o4i = mkldnn_OIw4i16o4i,
1246  OIw4i4o = mkldnn_OIw4i4o,
1247  Oiw4o = mkldnn_Oiw4o,
1248  OIw8i16o2i = mkldnn_OIw8i16o2i,
1249  OIw8i8o = mkldnn_OIw8i8o,
1250  OIw8o16i2o = mkldnn_OIw8o16i2o,
1251  OIw8o8i = mkldnn_OIw8o8i,
1252  Owi16o = mkldnn_Owi16o,
1253  Owi4o = mkldnn_Owi4o,
1254  Owi8o = mkldnn_Owi8o,
1255  IOhw16o16i = mkldnn_IOhw16o16i,
1256  Ohwi16o = mkldnn_Ohwi16o,
1257  Ohwi4o = mkldnn_Ohwi4o,
1258  Ohwi8o = mkldnn_Ohwi8o,
1259  OIhw16i16o = mkldnn_OIhw16i16o,
1260  OIhw16o16i = mkldnn_OIhw16o16i,
1261  Oihw16o = mkldnn_Oihw16o,
1262  OIhw4i16o4i = mkldnn_OIhw4i16o4i,
1263  OIhw4i4o = mkldnn_OIhw4i4o,
1264  Oihw4o = mkldnn_Oihw4o,
1265  OIhw8i16o2i = mkldnn_OIhw8i16o2i,
1266  OIhw8i8o = mkldnn_OIhw8i8o,
1267  OIhw8o16i2o = mkldnn_OIhw8o16i2o,
1268  OIhw8o8i = mkldnn_OIhw8o8i,
1269  Odhwi16o = mkldnn_Odhwi16o,
1270  Odhwi4o = mkldnn_Odhwi4o,
1271  Odhwi8o = mkldnn_Odhwi8o,
1272  OIdhw16i16o = mkldnn_OIdhw16i16o,
1273  OIdhw16o16i = mkldnn_OIdhw16o16i,
1274  Oidhw16o = mkldnn_Oidhw16o,
1275  OIdhw4i4o = mkldnn_OIdhw4i4o,
1276  Oidhw4o = mkldnn_Oidhw4o,
1277  OIdhw8i16o2i = mkldnn_OIdhw8i16o2i,
1278  OIdhw8i8o = mkldnn_OIdhw8i8o,
1279  OIdhw8o8i = mkldnn_OIdhw8o8i,
1280  gIOw16o16i = mkldnn_gIOw16o16i,
1281  gOIw16i16o = mkldnn_gOIw16i16o,
1282  gOIw16o16i = mkldnn_gOIw16o16i,
1283  gOiw16o = mkldnn_gOiw16o,
1284  gOIw4i16o4i = mkldnn_gOIw4i16o4i,
1285  gOIw4i4o = mkldnn_gOIw4i4o,
1286  gOiw4o = mkldnn_gOiw4o,
1287  gOIw8i16o2i = mkldnn_gOIw8i16o2i,
1288  gOIw8i8o = mkldnn_gOIw8i8o,
1289  gOIw8o16i2o = mkldnn_gOIw8o16i2o,
1290  gOIw8o8i = mkldnn_gOIw8o8i,
1291  gOwi16o = mkldnn_gOwi16o,
1292  gOwi4o = mkldnn_gOwi4o,
1293  gOwi8o = mkldnn_gOwi8o,
1294  gIOhw16o16i = mkldnn_gIOhw16o16i,
1295  gOhwi16o = mkldnn_gOhwi16o,
1296  gOhwi4o = mkldnn_gOhwi4o,
1297  gOhwi8o = mkldnn_gOhwi8o,
1298  Goihw16g = mkldnn_Goihw16g,
1299  gOIhw16i16o = mkldnn_gOIhw16i16o,
1300  gOIhw16o16i = mkldnn_gOIhw16o16i,
1301  gOihw16o = mkldnn_gOihw16o,
1302  gOIhw2i8o4i = mkldnn_gOIhw2i8o4i,
1303  gOIhw4i16o4i = mkldnn_gOIhw4i16o4i,
1304  gOIhw4i4o = mkldnn_gOIhw4i4o,
1305  gOIhw4o4i = mkldnn_gOIhw4o4i,
1306  gOihw4o = mkldnn_gOihw4o,
1307  Goihw8g = mkldnn_Goihw8g,
1308  gOIhw8i16o2i = mkldnn_gOIhw8i16o2i,
1309  gOIhw8i8o = mkldnn_gOIhw8i8o,
1310  gOIhw8o16i2o = mkldnn_gOIhw8o16i2o,
1311  OIhw4o8i8o4i = mkldnn_OIhw4o8i8o4i,
1312  OIhw2o8i8o2i = mkldnn_OIhw2o8i8o2i,
1313  gOIhw4o8i8o4i = mkldnn_gOIhw4o8i8o4i,
1314  gOIhw2o8i8o2i = mkldnn_gOIhw2o8i8o2i,
1315  gOIhw8o8i = mkldnn_gOIhw8o8i,
1316  gIOdhw16i16o = mkldnn_gIOdhw16i16o,
1317  gOdhwi16o = mkldnn_gOdhwi16o,
1318  gOdhwi4o = mkldnn_gOdhwi4o,
1319  gOdhwi8o = mkldnn_gOdhwi8o,
1320  gOIdhw16i16o = mkldnn_gOIdhw16i16o,
1321  gOIdhw16o16i = mkldnn_gOIdhw16o16i,
1322  gOidhw16o = mkldnn_gOidhw16o,
1323  gOIdhw4i4o = mkldnn_gOIdhw4i4o,
1324  gOidhw4o = mkldnn_gOidhw4o,
1325  gOIdhw8i16o2i = mkldnn_gOIdhw8i16o2i,
1326  gOIdhw8i8o = mkldnn_gOIdhw8i8o,
1327  gOIdhw8o8i = mkldnn_gOIdhw8o8i,
1328  };
1329 
1331  struct desc {
1332  friend struct memory;
1335 
1337  desc(): data() {}
1338 
1344  desc(const dims &adims, data_type adata_type, format_tag aformat_tag) {
1345  validate_dims(adims);
1347  (int)adims.size(),
1348  adims.size() == 0 ? nullptr : &adims[0],
1349  convert_to_c(adata_type), convert_to_c(aformat_tag)),
1350  "could not initialize a memory descriptor by tag");
1351  }
1352 
1358  desc(const dims &adims, data_type adata_type, const dims &astrides) {
1359  validate_dims(adims);
1361  (int)adims.size(),
1362  adims.size() == 0 ? nullptr : &adims[0],
1363  convert_to_c(adata_type),
1364  astrides.size() == 0 ? nullptr : &astrides[0]),
1365  "could not initialize a memory descriptor by strides");
1366  }
1367 
1371  desc(const mkldnn_memory_desc_t &adata): data(adata) {}
1372 
1374  //
1377  desc submemory_desc(const dims &adims, const dims &offsets) {
1378  mkldnn_memory_desc_t sub_md;
1380  &data, &adims[0], &offsets[0]),
1381  "could not initialize a sub-memory");
1382  return desc(sub_md);
1383  }
1384 
1387  size_t get_size() const { return mkldnn_memory_desc_get_size(&data); }
1388 
1390  bool is_zero() const { return data.ndims == 0; }
1391 
1392  bool operator==(const desc &other) const {
1393  return mkldnn_memory_desc_equal(&data, &other.data) != 0;
1394  }
1395 
1396  bool operator!=(const desc &other) const { return !operator==(other); }
1397  };
1398 
1399  memory() = default;
1400 
1406  memory(const desc &md, const engine &aengine, void *ahandle) {
1407  mkldnn_memory_t result;
1409  aengine.get(), ahandle), "could not create a memory");
1410  reset(result);
1411  }
1412 
1417  memory(const desc &md, const engine &aengine)
1418  : memory(md, aengine, MKLDNN_MEMORY_ALLOCATE) {}
1419 
1421  desc get_desc() const {
1422  const mkldnn_memory_desc_t *cdesc;
1424  "could not get memory descriptor from a memory");
1425  return desc(*cdesc);
1426  }
1427 
1429  engine get_engine() const {
1430  mkldnn_engine_t engine_q;
1431  error::wrap_c_api(mkldnn_memory_get_engine(get(), &engine_q),
1432  "could not get engine from a memory");
1433  return engine(engine_q);
1434  }
1435 
1439  void *get_data_handle() const {
1440  void *handle;
1442  "could not get native handle");
1443  return handle;
1444  }
1445 
1446  void set_data_handle(void *handle) const {
1448  "could not set native handle");
1449  }
1450 
1466  template <typename T = void>
1467  T *map_data() const {
1468  void *mapped_ptr;
1469  error::wrap_c_api(mkldnn_memory_map_data(get(), &mapped_ptr),
1470  "could not map the data");
1471  return static_cast<T *>(mapped_ptr);
1472  }
1473 
1482  void unmap_data(void *mapped_ptr) const {
1483  error::wrap_c_api(mkldnn_memory_unmap_data(get(), mapped_ptr),
1484  "could not unmap the data");
1485  }
1486 
1487 #if MKLDNN_GPU_RUNTIME == MKLDNN_RUNTIME_OCL
1488  cl_mem get_ocl_mem_object() const {
1490  cl_mem mem_object;
1491  error::wrap_c_api(mkldnn_memory_get_ocl_mem_object(get(), &mem_object),
1492  "could not get OpenCL memory object");
1493  return mem_object;
1494  }
1495 
1497  void set_ocl_mem_object(cl_mem mem_object) {
1498  error::wrap_c_api(mkldnn_memory_set_ocl_mem_object(get(), mem_object),
1499  "could not set OpenCL memory object");
1500  }
1501 #endif
1502 
1503  // Must go away or be private:
1504  static mkldnn_data_type_t convert_to_c(data_type adata_type) {
1505  return static_cast<mkldnn_data_type_t>(adata_type);
1506  }
1507  static mkldnn_format_tag_t convert_to_c(format_tag aformat) {
1508  return static_cast<mkldnn_format_tag_t>(aformat);
1509  }
1510 };
1511 
1512 inline bool operator==(mkldnn_data_type_t a, memory::data_type b) {
1513  return a == memory::convert_to_c(b);
1514 }
1515 inline bool operator!=(mkldnn_data_type_t a, memory::data_type b) {
1516  return !(a == b);
1517 }
1518 inline bool operator==(memory::data_type a, mkldnn_data_type_t b) {
1519  return b == a;
1520 }
1521 inline bool operator!=(memory::data_type a, mkldnn_data_type_t b) {
1522  return !(a == b);
1523 }
1524 
1525 inline bool operator==(mkldnn_format_tag_t a, memory::format_tag b) {
1526  return a == memory::convert_to_c(b);
1527 }
1528 inline bool operator!=(mkldnn_format_tag_t a, memory::format_tag b) {
1529  return !(a == b);
1530 }
1531 inline bool operator==(memory::format_tag a, mkldnn_format_tag_t b) {
1532  return b == a;
1533 }
1534 inline bool operator!=(memory::format_tag a, mkldnn_format_tag_t b) {
1535  return !(a == b);
1536 }
1537 
1539 
1546 
1550 struct reorder : public primitive {
1551  struct primitive_desc : public handle<mkldnn_primitive_desc_t> {
1552  primitive_desc() = default;
1553 
1554  primitive_desc(const engine &src_engine, const memory::desc &src_md,
1555  const engine &dst_engine, const memory::desc &dst_md,
1556  const primitive_attr &aattr = primitive_attr()) {
1557  mkldnn_primitive_desc_t result;
1559  &src_md.data, src_engine.get(),
1560  &dst_md.data, dst_engine.get(), aattr.get()),
1561  "could not create a reorder primitive descriptor");
1562  reset(result);
1563  }
1564 
1565  primitive_desc(const memory &src, const memory &dst,
1566  const primitive_attr &aattr = primitive_attr()) {
1567  mkldnn_primitive_desc_t result;
1568  auto src_md = src.get_desc();
1569  auto dst_md = dst.get_desc();
1571  &src_md.data, src.get_engine().get(),
1572  &dst_md.data, dst.get_engine().get(), aattr.get()),
1573  "could not create a reorder primitive descriptor");
1574  reset(result);
1575  }
1576 
1581  memory::desc scratchpad_desc() const {
1583  get(), mkldnn::convert_to_c(query::scratchpad_md), 0);
1584  return memory::desc(*cdesc);
1585  }
1586 
1588  mkldnn_engine_t engine_q;
1591  mkldnn::convert_to_c(query::scratchpad_engine), 0, &engine_q),
1592  "could not get scratchpad engine from reorder primitive_desc");
1593 
1594  return engine(engine_q);
1595  }
1596 
1597  engine get_engine() { return engine::query(*this); }
1598  };
1599 
1600  reorder() = default;
1601 
1602  reorder(const primitive_desc &pd): primitive(pd.get()) {}
1603 
1604  reorder(const memory &src, const memory &dst):
1605  primitive(primitive_desc(src, dst).get()) {}
1606 
1607  using primitive::execute;
1608 
1609  void execute(stream astream, memory &src, memory &dst) {
1610  primitive::execute(astream,
1611  {{MKLDNN_ARG_FROM, src}, {MKLDNN_ARG_TO, dst}});
1612  }
1613 };
1614 
1616 
1623 
1631 struct concat : public primitive {
1632  struct primitive_desc : public handle<mkldnn_primitive_desc_t> {
1633  std::vector<mkldnn_memory_desc_t> cpp_to_c(
1634  const std::vector<memory::desc> &srcs) {
1635  std::vector<mkldnn_memory_desc_t> c_api_srcs;
1636  c_api_srcs.reserve(srcs.size());
1637  for (const auto &s : srcs) c_api_srcs.push_back(s.data);
1638  return c_api_srcs;
1639  }
1640 
1641  primitive_desc() = default;
1642 
1643  primitive_desc(const memory::desc &dst, int concat_dimension,
1644  const std::vector<memory::desc> &srcs, const engine &aengine,
1645  const primitive_attr &aattr = primitive_attr()) {
1646  auto c_api_srcs = cpp_to_c(srcs);
1647 
1648  mkldnn_primitive_desc_t result;
1651  (int)c_api_srcs.size(), concat_dimension,
1652  &c_api_srcs[0], aattr.get(), aengine.get()),
1653  "could not create a concat primitive descriptor");
1654  reset(result);
1655  }
1656 
1657  primitive_desc(int concat_dimension,
1658  const std::vector<memory::desc> &srcs, const engine &aengine,
1659  const primitive_attr &aattr = primitive_attr()) {
1660  auto c_api_srcs = cpp_to_c(srcs);
1661 
1662  mkldnn_primitive_desc_t result;
1664  mkldnn_concat_primitive_desc_create(&result, nullptr,
1665  (int)c_api_srcs.size(), concat_dimension,
1666  &c_api_srcs[0], aattr.get(), aengine.get()),
1667  "could not create a concat primitive descriptor");
1668  reset(result);
1669  }
1670 
1672  memory::desc dst_desc() const {
1674  get(), mkldnn::convert_to_c(query::dst_md), 0);
1675  return memory::desc(*cdesc);
1676  }
1677 
1682  memory::desc scratchpad_desc() const {
1684  get(), mkldnn::convert_to_c(query::scratchpad_md), 0);
1685  return memory::desc(*cdesc);
1686  }
1687 
1688  engine get_engine() { return engine::query(*this); }
1689  };
1690 
1691  concat() = default;
1692 
1693  concat(const primitive_desc &pd): primitive(pd.get()) {}
1694 };
1695 
1697 
1704 
1710 struct sum : public primitive {
1711  struct primitive_desc : public handle<mkldnn_primitive_desc_t> {
1712  std::vector<mkldnn_memory_desc_t> cpp_to_c(
1713  const std::vector<memory::desc> &srcs) {
1714  std::vector<mkldnn_memory_desc_t> c_api_srcs;
1715  c_api_srcs.reserve(srcs.size());
1716  for (const auto &s : srcs) c_api_srcs.push_back(s.data);
1717  return c_api_srcs;
1718  }
1719 
1720  primitive_desc() = default;
1721 
1722  primitive_desc(const memory::desc &dst,
1723  const std::vector<float> &scales,
1724  const std::vector<memory::desc> &srcs, const engine &aengine,
1725  const primitive_attr &aattr = primitive_attr()) {
1726  error::wrap_c_api(scales.size() == srcs.size()
1728  "number of scales not equal to number of srcs");
1729 
1730  auto c_api_srcs = cpp_to_c(srcs);
1731 
1732  mkldnn_primitive_desc_t result;
1734  &result, &dst.data, (int)c_api_srcs.size(),
1735  &scales[0], &c_api_srcs[0], aattr.get(), aengine.get()),
1736  "could not create a sum primitive descriptor");
1737  reset(result);
1738  }
1739 
1740  primitive_desc(const std::vector<float> &scales,
1741  const std::vector<memory::desc> &srcs, const engine &aengine,
1742  const primitive_attr &aattr = primitive_attr()) {
1743  error::wrap_c_api(scales.size() == srcs.size()
1745  "number of scales not equal to number of srcs");
1746 
1747  auto c_api_srcs = cpp_to_c(srcs);
1748  mkldnn_primitive_desc_t result;
1750  nullptr, (int)c_api_srcs.size(), &scales[0],
1751  &c_api_srcs[0], aattr.get(), aengine.get()),
1752  "could not create a sum primitive descriptor");
1753  reset(result);
1754  }
1755 
1757  memory::desc dst_desc() const {
1759  get(), mkldnn::convert_to_c(query::dst_md), 0);
1760  return memory::desc(*cdesc);
1761  }
1762 
1767  memory::desc scratchpad_desc() const {
1769  get(), mkldnn::convert_to_c(query::scratchpad_md), 0);
1770  return memory::desc(*cdesc);
1771  }
1772 
1773  engine get_engine() { return engine::query(*this); }
1774  };
1775 
1776  sum() = default;
1777 
1778  sum(const primitive_desc &pd): primitive(pd.get()) {}
1779 };
1780 
1782 
1784 
1787 
1790 
1792 struct primitive_desc : public handle<mkldnn_primitive_desc_t> {
1793  primitive_desc() = default;
1794 
1799  const engine &e, const_mkldnn_primitive_desc_t hint_fwd_pd) {
1800  mkldnn_primitive_desc_iterator_t iterator = nullptr;
1802  &iterator, desc, attr ? attr->get() : nullptr, e.get(),
1803  hint_fwd_pd);
1804  error::wrap_c_api(status,
1805  "could not create a primitive descriptor iterator");
1806  pd_iterator.reset(iterator);
1807  fetch_impl();
1808  }
1809 
1810  engine get_engine() { return engine::query(*this); }
1811 
1812  primitive_attr get_primitive_attr() const {
1813  const_mkldnn_primitive_attr_t const_cattr;
1815  "could not get attributes");
1817  error::wrap_c_api(mkldnn_primitive_attr_clone(&cattr, const_cattr),
1818  "could not clone attributes");
1819 
1820  primitive_attr attr;
1821  attr.reset(cattr);
1822  return attr;
1823  }
1824 
1826  const char *impl_info_str() const {
1827  const char *res;
1829  mkldnn_query_impl_info_str, 0, &res),
1830  "could not query implementation info string");
1831  return res;
1832  }
1833 
1835  memory::dim query_s64(query q) const {
1836  memory::dim res;
1838  mkldnn::convert_to_c(q), 0, &res);
1839  return status == mkldnn_success ? res : 0;
1840  }
1841 
1848  bool next_impl() {
1850  pd_iterator.get());
1851  if (status == mkldnn_iterator_ends) return false;
1852  error::wrap_c_api(status, "primitive descriptor iterator next failed");
1853 
1854  fetch_impl();
1855  return true;
1856  }
1857 
1859  memory::desc query_md(query what, int idx = 0) const {
1860  std::vector<query> valid_q{ query::src_md, query::diff_src_md,
1863  if (!std::any_of(valid_q.cbegin(), valid_q.cend(),
1864  [=](query q) { return what == q; }))
1865  throw error(mkldnn_invalid_arguments, "invalid memory query");
1866 
1868  get(), mkldnn::convert_to_c(what), idx);
1869  return memory::desc(*cdesc);
1870  }
1871 
1877  return query_md(query::scratchpad_md, 0);
1878  }
1879 
1880  private:
1882  void fetch_impl() {
1884  pd_iterator.get());
1886  "could not fetch a primitive descriptor from the iterator");
1887  reset(pd);
1888  }
1889 };
1890 
1892 
1900 
1906 
1908  struct desc {
1910 
1919  desc(prop_kind aprop_kind, algorithm aalgorithm,
1920  const memory::desc &src_desc,
1921  const memory::desc &weights_desc,
1922  const memory::desc &bias_desc,
1923  const memory::desc &dst_desc,
1924  const memory::dims &strides,
1925  const memory::dims &padding_l,
1926  const memory::dims &padding_r) {
1927  memory::validate_dims(strides);
1928  memory::validate_dims(padding_l);
1929  memory::validate_dims(padding_r);
1931  mkldnn::convert_to_c(aprop_kind), convert_to_c(aalgorithm),
1932  &src_desc.data, &weights_desc.data, &bias_desc.data,
1933  &dst_desc.data, &strides[0], &padding_l[0],
1934  &padding_r[0]),
1935  "could not create a convolution forward descriptor");
1936  }
1937 
1946  desc(prop_kind aprop_kind, algorithm aalgorithm,
1947  const memory::desc &src_desc,
1948  const memory::desc &weights_desc,
1949  const memory::desc &dst_desc,
1950  const memory::dims &strides,
1951  const memory::dims &padding_l,
1952  const memory::dims &padding_r) {
1953  memory::validate_dims(strides);
1954  memory::validate_dims(padding_l);
1955  memory::validate_dims(padding_r);
1957  mkldnn::convert_to_c(aprop_kind), convert_to_c(aalgorithm),
1958  &src_desc.data, &weights_desc.data, nullptr,
1959  &dst_desc.data, &strides[0], &padding_l[0],
1960  &padding_r[0]),
1961  "could not create a convolution forward descriptor");
1962  }
1963 
1972  desc(prop_kind aprop_kind, algorithm aalgorithm,
1973  const memory::desc &src_desc,
1974  const memory::desc &weights_desc,
1975  const memory::desc &bias_desc,
1976  const memory::desc &dst_desc,
1977  const memory::dims &strides,
1978  const memory::dims &dilates,
1979  const memory::dims &padding_l,
1980  const memory::dims &padding_r) {
1981  memory::validate_dims(strides);
1982  memory::validate_dims(dilates);
1983  memory::validate_dims(padding_l);
1984  memory::validate_dims(padding_r);
1987  mkldnn::convert_to_c(aprop_kind), convert_to_c(aalgorithm),
1988  &src_desc.data, &weights_desc.data, &bias_desc.data,
1989  &dst_desc.data, &strides[0], &dilates[0],
1990  &padding_l[0], &padding_r[0]),
1991  "could not create a dilated convolution forward descriptor");
1992  }
1993 
2002  desc(prop_kind aprop_kind, algorithm aalgorithm,
2003  const memory::desc &src_desc,
2004  const memory::desc &weights_desc,
2005  const memory::desc &dst_desc,
2006  const memory::dims &strides,
2007  const memory::dims &dilates,
2008  const memory::dims &padding_l,
2009  const memory::dims &padding_r) {
2010  memory::validate_dims(strides);
2011  memory::validate_dims(dilates);
2012  memory::validate_dims(padding_l);
2013  memory::validate_dims(padding_r);
2016  mkldnn::convert_to_c(aprop_kind), convert_to_c(aalgorithm),
2017  &src_desc.data, &weights_desc.data, nullptr,
2018  &dst_desc.data, &strides[0], &dilates[0],
2019  &padding_l[0], &padding_r[0]),
2020  "could not create a dilated convolution forward descriptor");
2021  }
2022  };
2023 
2026  primitive_desc() = default;
2027 
2030  primitive_desc(const desc &desc, const engine &e)
2031  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
2032 
2035  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
2036  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
2037 
2040  return query_md(query::src_md, 0);
2041  }
2042 
2045  return query_md(query::weights_md, 0);
2046  }
2047 
2053  return query_md(query::weights_md, 1);
2054  }
2055 
2058  return query_md(query::dst_md, 0);
2059  }
2060  };
2061 
2062  convolution_forward() = default;
2063 
2067 };
2068 
2074 
2076  struct desc {
2078 
2085  desc(algorithm aalgorithm,
2086  const memory::desc &diff_src_desc,
2087  const memory::desc &weights_desc,
2088  const memory::desc &diff_dst_desc,
2089  const memory::dims &strides,
2090  const memory::dims &padding_l,
2091  const memory::dims &padding_r) {
2092  memory::validate_dims(strides);
2093  memory::validate_dims(padding_l);
2094  memory::validate_dims(padding_r);
2096  &data, convert_to_c(aalgorithm), &diff_src_desc.data,
2097  &weights_desc.data, &diff_dst_desc.data,
2098  &strides[0], &padding_l[0], &padding_r[0]),
2099  "could not create a convolution backward data descriptor");
2100  }
2101 
2108  desc(algorithm aalgorithm,
2109  const memory::desc &diff_src_desc,
2110  const memory::desc &weights_desc,
2111  const memory::desc &diff_dst_desc,
2112  const memory::dims &strides,
2113  const memory::dims &dilates,
2114  const memory::dims &padding_l,
2115  const memory::dims &padding_r) {
2116  memory::validate_dims(strides);
2117  memory::validate_dims(dilates);
2118  memory::validate_dims(padding_l);
2119  memory::validate_dims(padding_r);
2122  &data, convert_to_c(aalgorithm), &diff_src_desc.data,
2123  &weights_desc.data, &diff_dst_desc.data,
2124  &strides[0], &dilates[0], &padding_l[0], &padding_r[0]),
2125  "could not create a convolution backward data descriptor");
2126  }
2127  };
2128 
2131  primitive_desc() = default;
2132 
2135  primitive_desc(const desc &desc, const engine &e,
2136  const convolution_forward::primitive_desc &hint_fwd_pd)
2137  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
2138 
2141  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
2142  const convolution_forward::primitive_desc &hint_fwd_pd)
2143  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
2144 
2147  return query_md(query::diff_src_md, 0);
2148  }
2149 
2152  return query_md(query::weights_md, 0);
2153  }
2154 
2157  return query_md(query::diff_dst_md, 0);
2158  }
2159  };
2160 
2161  convolution_backward_data() = default;
2162 
2166 };
2167 
2173 
2175  struct desc {
2177 
2184  desc(algorithm aalgorithm,
2185  const memory::desc &src_desc,
2186  const memory::desc &diff_weights_desc,
2187  const memory::desc &diff_bias_desc,
2188  const memory::desc &diff_dst_desc,
2189  const memory::dims &strides,
2190  const memory::dims &padding_l,
2191  const memory::dims &padding_r) {
2192  memory::validate_dims(strides);
2193  memory::validate_dims(padding_l);
2194  memory::validate_dims(padding_r);
2196  &data, convert_to_c(aalgorithm), &src_desc.data,
2197  &diff_weights_desc.data, &diff_bias_desc.data,
2198  &diff_dst_desc.data,
2199  &strides[0], &padding_l[0], &padding_r[0]),
2200  "could not create a convolution backward weights descriptor");
2201  }
2202 
2209  desc(algorithm aalgorithm,
2210  const memory::desc &src_desc,
2211  const memory::desc &diff_weights_desc,
2212  const memory::desc &diff_dst_desc,
2213  const memory::dims &strides,
2214  const memory::dims &padding_l,
2215  const memory::dims &padding_r) {
2216  memory::validate_dims(strides);
2217  memory::validate_dims(padding_l);
2218  memory::validate_dims(padding_r);
2220  &data, convert_to_c(aalgorithm), &src_desc.data,
2221  &diff_weights_desc.data, nullptr, &diff_dst_desc.data,
2222  &strides[0], &padding_l[0], &padding_r[0]),
2223  "could not create a convolution backward weights descriptor");
2224  }
2225 
2232  desc(algorithm aalgorithm,
2233  const memory::desc &src_desc,
2234  const memory::desc &diff_weights_desc,
2235  const memory::desc &diff_bias_desc,
2236  const memory::desc &diff_dst_desc,
2237  const memory::dims &strides,
2238  const memory::dims &dilates,
2239  const memory::dims &padding_l,
2240  const memory::dims &padding_r) {
2241  memory::validate_dims(strides);
2242  memory::validate_dims(dilates);
2243  memory::validate_dims(padding_l);
2244  memory::validate_dims(padding_r);
2246  &data, convert_to_c(aalgorithm), &src_desc.data,
2247  &diff_weights_desc.data, &diff_bias_desc.data,
2248  &diff_dst_desc.data,
2249  &strides[0], &dilates[0], &padding_l[0], &padding_r[0]),
2250  "could not create a convolution backward weights descriptor");
2251  }
2252 
2259  desc(algorithm aalgorithm,
2260  const memory::desc &src_desc,
2261  const memory::desc &diff_weights_desc,
2262  const memory::desc &diff_dst_desc,
2263  const memory::dims &strides,
2264  const memory::dims &dilates,
2265  const memory::dims &padding_l,
2266  const memory::dims &padding_r) {
2267  memory::validate_dims(strides);
2268  memory::validate_dims(dilates);
2269  memory::validate_dims(padding_l);
2270  memory::validate_dims(padding_r);
2272  &data, convert_to_c(aalgorithm), &src_desc.data,
2273  &diff_weights_desc.data, nullptr, &diff_dst_desc.data,
2274  &strides[0], &dilates[0], &padding_l[0],
2275  &padding_r[0]),
2276  "could not create a convolution backward weights descriptor");
2277  }
2278 
2279  };
2280 
2283  primitive_desc() = default;
2284 
2286  primitive_desc(const desc &desc, const engine &e,
2287  const convolution_forward::primitive_desc &hint_fwd_pd)
2288  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
2289 
2292  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
2293  const convolution_forward::primitive_desc &hint_fwd_pd)
2294  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
2295 
2298  return query_md(query::src_md, 0);
2299  }
2300 
2303  return query_md(query::diff_weights_md, 0);
2304  }
2305 
2308  return query_md(query::diff_weights_md, 1);
2309  }
2310 
2313  return query_md(query::diff_dst_md, 0);
2314  }
2315  };
2316 
2317  convolution_backward_weights() = default;
2318 
2322 };
2323 
2325 //
2331 
2337 
2339  struct desc {
2341 
2350  desc(prop_kind aprop_kind, algorithm aalgorithm,
2351  const memory::desc &src_desc,
2352  const memory::desc &weights_desc,
2353  const memory::desc &bias_desc,
2354  const memory::desc &dst_desc,
2355  const memory::dims &strides,
2356  const memory::dims &padding_l,
2357  const memory::dims &padding_r) {
2358  memory::validate_dims(strides);
2359  memory::validate_dims(padding_l);
2360  memory::validate_dims(padding_r);
2362  mkldnn::convert_to_c(aprop_kind), convert_to_c(aalgorithm),
2363  &src_desc.data, &weights_desc.data, &bias_desc.data,
2364  &dst_desc.data, &strides[0], &padding_l[0],
2365  &padding_r[0]),
2366  "could not create a deconvolution forward descriptor");
2367  }
2368 
2377  desc(prop_kind aprop_kind, algorithm aalgorithm,
2378  const memory::desc &src_desc,
2379  const memory::desc &weights_desc,
2380  const memory::desc &dst_desc,
2381  const memory::dims &strides,
2382  const memory::dims &padding_l,
2383  const memory::dims &padding_r) {
2384  memory::validate_dims(strides);
2385  memory::validate_dims(padding_l);
2386  memory::validate_dims(padding_r);
2388  mkldnn::convert_to_c(aprop_kind), convert_to_c(aalgorithm),
2389  &src_desc.data, &weights_desc.data, nullptr,
2390  &dst_desc.data, &strides[0], &padding_l[0],
2391  &padding_r[0]),
2392  "could not create a deconvolution forward descriptor");
2393  }
2394 
2403  desc(prop_kind aprop_kind, algorithm aalgorithm,
2404  const memory::desc &src_desc,
2405  const memory::desc &weights_desc,
2406  const memory::desc &bias_desc,
2407  const memory::desc &dst_desc,
2408  const memory::dims &strides,
2409  const memory::dims &dilates,
2410  const memory::dims &padding_l,
2411  const memory::dims &padding_r) {
2412  memory::validate_dims(strides);
2413  memory::validate_dims(dilates);
2414  memory::validate_dims(padding_l);
2415  memory::validate_dims(padding_r);
2417  mkldnn::convert_to_c(aprop_kind), convert_to_c(aalgorithm),
2418  &src_desc.data, &weights_desc.data, &bias_desc.data,
2419  &dst_desc.data, &strides[0], &dilates[0], &padding_l[0],
2420  &padding_r[0]),
2421  "could not create a dilated deconvolution forward descriptor");
2422  }
2423 
2432  desc(prop_kind aprop_kind, algorithm aalgorithm,
2433  const memory::desc &src_desc,
2434  const memory::desc &weights_desc,
2435  const memory::desc &dst_desc,
2436  const memory::dims &strides,
2437  const memory::dims &dilates,
2438  const memory::dims &padding_l,
2439  const memory::dims &padding_r) {
2440  memory::validate_dims(strides);
2441  memory::validate_dims(dilates);
2442  memory::validate_dims(padding_l);
2443  memory::validate_dims(padding_r);
2445  mkldnn::convert_to_c(aprop_kind), convert_to_c(aalgorithm),
2446  &src_desc.data, &weights_desc.data, nullptr,
2447  &dst_desc.data, &strides[0], &dilates[0], &padding_l[0],
2448  &padding_r[0]),
2449  "could not create a dilated deconvolution forward descriptor");
2450  }
2451  };
2452 
2455  primitive_desc() = default;
2456 
2459  primitive_desc(const desc &desc, const engine &e)
2460  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
2461 
2464  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
2465  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
2466 
2469  return query_md(query::src_md, 0);
2470  }
2471 
2474  return query_md(query::weights_md, 0);
2475  }
2476 
2482  return query_md(query::weights_md, 1);
2483  }
2484 
2487  return query_md(query::dst_md, 0);
2488  }
2489  };
2490 
2491  deconvolution_forward() = default;
2492 
2496 };
2497 
2503 
2505  struct desc {
2507 
2514  desc(algorithm aalgorithm,
2515  const memory::desc &diff_src_desc,
2516  const memory::desc &weights_desc,
2517  const memory::desc &diff_dst_desc,
2518  const memory::dims &strides,
2519  const memory::dims &padding_l,
2520  const memory::dims &padding_r) {
2521  memory::validate_dims(strides);
2522  memory::validate_dims(padding_l);
2523  memory::validate_dims(padding_r);
2525  &data, convert_to_c(aalgorithm), &diff_src_desc.data,
2526  &weights_desc.data, &diff_dst_desc.data,
2527  &strides[0], &padding_l[0], &padding_r[0]),
2528  "could not create a deconvolution backward data descriptor");
2529  }
2530 
2537  desc(algorithm aalgorithm,
2538  const memory::desc &diff_src_desc,
2539  const memory::desc &weights_desc,
2540  const memory::desc &diff_dst_desc,
2541  const memory::dims &strides,
2542  const memory::dims &dilates,
2543  const memory::dims &padding_l,
2544  const memory::dims &padding_r) {
2545  memory::validate_dims(strides);
2546  memory::validate_dims(dilates);
2547  memory::validate_dims(padding_l);
2548  memory::validate_dims(padding_r);
2550  &data, convert_to_c(aalgorithm), &diff_src_desc.data,
2551  &weights_desc.data, &diff_dst_desc.data,
2552  &strides[0], &dilates[0], &padding_l[0], &padding_r[0]),
2553  "could not create a dilated deconvolution backward data descriptor");
2554  }
2555  };
2556 
2559  primitive_desc() = default;
2560 
2563  primitive_desc(const desc &desc, const engine &e,
2564  const deconvolution_forward::primitive_desc &hint_fwd_pd)
2565  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
2566 
2569  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
2570  const deconvolution_forward::primitive_desc &hint_fwd_pd)
2571  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
2572 
2575  return query_md(query::diff_src_md, 0);
2576  }
2577 
2580  return query_md(query::weights_md, 0);
2581  }
2582 
2585  return query_md(query::diff_dst_md, 0);
2586  }
2587  };
2588 
2589  deconvolution_backward_data() = default;
2590 
2594 };
2595 
2601 
2603  struct desc {
2605 
2612  desc(algorithm aalgorithm,
2613  const memory::desc &src_desc,
2614  const memory::desc &diff_weights_desc,
2615  const memory::desc &diff_bias_desc,
2616  const memory::desc &diff_dst_desc,
2617  const memory::dims &strides,
2618  const memory::dims &padding_l,
2619  const memory::dims &padding_r) {
2620  memory::validate_dims(strides);
2621  memory::validate_dims(padding_l);
2622  memory::validate_dims(padding_r);
2624  &data, convert_to_c(aalgorithm), &src_desc.data,
2625  &diff_weights_desc.data, &diff_bias_desc.data,
2626  &diff_dst_desc.data,
2627  &strides[0], &padding_l[0], &padding_r[0]),
2628  "could not create a deconvolution backward weights descriptor");
2629  }
2630 
2637  desc(algorithm aalgorithm,
2638  const memory::desc &src_desc,
2639  const memory::desc &diff_weights_desc,
2640  const memory::desc &diff_dst_desc,
2641  const memory::dims &strides,
2642  const memory::dims &padding_l,
2643  const memory::dims &padding_r) {
2644  memory::validate_dims(strides);
2645  memory::validate_dims(padding_l);
2646  memory::validate_dims(padding_r);
2648  &data, convert_to_c(aalgorithm), &src_desc.data,
2649  &diff_weights_desc.data, nullptr, &diff_dst_desc.data,
2650  &strides[0], &padding_l[0], &padding_r[0]),
2651  "could not create a deconvolution backward weights descriptor");
2652  }
2653 
2660  desc(algorithm aalgorithm,
2661  const memory::desc &src_desc,
2662  const memory::desc &diff_weights_desc,
2663  const memory::desc &diff_bias_desc,
2664  const memory::desc &diff_dst_desc,
2665  const memory::dims &strides,
2666  const memory::dims &dilates,
2667  const memory::dims &padding_l,
2668  const memory::dims &padding_r) {
2669  memory::validate_dims(strides);
2670  memory::validate_dims(dilates);
2671  memory::validate_dims(padding_l);
2672  memory::validate_dims(padding_r);
2674  &data, convert_to_c(aalgorithm), &src_desc.data,
2675  &diff_weights_desc.data, &diff_bias_desc.data,
2676  &diff_dst_desc.data,
2677  &strides[0], &dilates[0], &padding_l[0], &padding_r[0]),
2678  "could not create a dilated deconvolution backward weights descriptor");
2679  }
2680 
2687  desc(algorithm aalgorithm,
2688  const memory::desc &src_desc,
2689  const memory::desc &diff_weights_desc,
2690  const memory::desc &diff_dst_desc,
2691  const memory::dims &strides,
2692  const memory::dims &dilates,
2693  const memory::dims &padding_l,
2694  const memory::dims &padding_r) {
2695  memory::validate_dims(strides);
2696  memory::validate_dims(dilates);
2697  memory::validate_dims(padding_l);
2698  memory::validate_dims(padding_r);
2700  &data, convert_to_c(aalgorithm), &src_desc.data,
2701  &diff_weights_desc.data, nullptr, &diff_dst_desc.data,
2702  &strides[0], &dilates[0], &padding_l[0], &padding_r[0]),
2703  "could not create a dilated deconvolution backward weights descriptor");
2704  }
2705  };
2706 
2709  primitive_desc() = default;
2710 
2712  primitive_desc(const desc &desc, const engine &e,
2713  const deconvolution_forward::primitive_desc &hint_fwd_pd)
2714  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
2715 
2718  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
2719  const deconvolution_forward::primitive_desc &hint_fwd_pd)
2720  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
2721 
2724  return query_md(query::src_md, 0);
2725  }
2726 
2729  return query_md(query::diff_weights_md, 0);
2730  }
2731 
2734  return query_md(query::diff_weights_md, 1);
2735  }
2736 
2739  return query_md(query::diff_dst_md, 0);
2740  }
2741  };
2742 
2743  deconvolution_backward_weights() = default;
2744 
2748 };
2749 
2751 
2759 
2762 struct lrn_forward : public primitive {
2763 
2765  struct desc {
2766  mkldnn_lrn_desc_t data;
2767 
2773  desc(prop_kind aprop_kind, algorithm aalgorithm,
2774  const memory::desc &src_desc, memory::dim local_size,
2775  float alpha, float beta, float k = 1.f) {
2777  mkldnn::convert_to_c(aprop_kind), convert_to_c(aalgorithm),
2778  &src_desc.data, local_size, alpha, beta, k),
2779  "could not create a lrn forward descriptor");
2780  }
2781  };
2782 
2786  primitive_desc() = default;
2787 
2788  primitive_desc(const desc &desc, const engine &e)
2789  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
2790 
2791  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
2792  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
2793 
2796  return query_md(query::src_md, 0);
2797  }
2798 
2801  return query_md(query::dst_md, 0);
2802  }
2803 
2808  return query_md(query::workspace_md, 0);
2809  }
2810  };
2811 
2812  lrn_forward() = default;
2813 
2814  lrn_forward(const primitive_desc &pd): primitive(pd) {}
2815 };
2816 
2819 struct lrn_backward : public primitive {
2820 
2822  struct desc {
2823  mkldnn_lrn_desc_t data;
2824 
2829  desc(algorithm aalgorithm, const memory::desc &data_desc,
2830  const memory::desc &diff_data_desc, memory::dim local_size,
2831  float alpha, float beta, float k = 1.f) {
2833  convert_to_c(aalgorithm), &diff_data_desc.data,
2834  &data_desc.data, local_size, alpha, beta, k),
2835  "could not create a lrn backward descriptor");
2836  }
2837  };
2838 
2842  primitive_desc() = default;
2843 
2844  primitive_desc(const desc &desc, const engine &e,
2845  const lrn_forward::primitive_desc &hint_fwd_pd)
2846  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
2847 
2848  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
2849  const lrn_forward::primitive_desc &hint_fwd_pd)
2850  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
2851 
2854  return query_md(query::diff_src_md, 0);
2855  }
2856 
2859  return query_md(query::diff_dst_md, 0);
2860  }
2861 
2866  return query_md(query::workspace_md, 0);
2867  }
2868  };
2869 
2870  lrn_backward() = default;
2871 
2872  lrn_backward(const primitive_desc &pd): primitive(pd) {}
2873 };
2874 
2876 
2883 
2886 struct pooling_forward : public primitive {
2887 
2889  struct desc {
2890  mkldnn_pooling_desc_t data;
2891 
2897  desc(prop_kind aprop_kind, algorithm aalgorithm,
2898  const memory::desc &src_desc,
2899  const memory::desc &dst_desc,
2900  const memory::dims &strides,
2901  const memory::dims &kernel,
2902  const memory::dims &padding_l,
2903  const memory::dims &padding_r) {
2904  memory::validate_dims(strides);
2905  memory::validate_dims(kernel);
2906  memory::validate_dims(padding_l);
2907  memory::validate_dims(padding_r);
2909  mkldnn::convert_to_c(aprop_kind),
2910  convert_to_c(aalgorithm),
2911  &src_desc.data, &dst_desc.data,
2912  &strides[0], &kernel[0],
2913  &padding_l[0], &padding_r[0]),
2914  "could not init a forward pooling descriptor");
2915  }
2916  };
2917 
2920  primitive_desc() = default;
2921 
2922  primitive_desc(const desc &desc, const engine &e)
2923  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
2924 
2925  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
2926  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
2927 
2930  return query_md(query::src_md, 0);
2931  }
2932 
2935  return query_md(query::dst_md, 0);
2936  }
2937 
2942  return query_md(query::workspace_md, 0);
2943  }
2944  };
2945 
2946  pooling_forward() = default;
2947 
2948  pooling_forward(const primitive_desc &pd): primitive(pd) {}
2949 };
2950 
2951 struct pooling_backward : public primitive {
2952 
2954  struct desc {
2955  mkldnn_pooling_desc_t data;
2956 
2960  desc(algorithm aalgorithm,
2961  const memory::desc &diff_src_desc,
2962  const memory::desc &diff_dst_desc,
2963  const memory::dims &strides,
2964  const memory::dims &kernel,
2965  const memory::dims &padding_l,
2966  const memory::dims &padding_r) {
2967  memory::validate_dims(strides);
2968  memory::validate_dims(kernel);
2969  memory::validate_dims(padding_l);
2970  memory::validate_dims(padding_r);
2972  convert_to_c(aalgorithm),
2973  &diff_src_desc.data, &diff_dst_desc.data,
2974  &strides[0], &kernel[0],
2975  &padding_l[0], &padding_r[0]),
2976  "could not init a backward pooling descriptor");
2977  }
2978  };
2979 
2982  primitive_desc() = default;
2983 
2984  primitive_desc(const desc &desc, const engine &e,
2985  const pooling_forward::primitive_desc &hint_fwd_pd)
2986  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
2987 
2988  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
2989  const pooling_forward::primitive_desc &hint_fwd_pd)
2990  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
2991 
2994  return query_md(query::diff_src_md, 0);
2995  }
2996 
2999  return query_md(query::diff_dst_md, 0);
3000  }
3001 
3006  return query_md(query::workspace_md, 0);
3007  }
3008  };
3009 
3010  pooling_backward() = default;
3011 
3012  pooling_backward(const primitive_desc &pd): primitive(pd) {}
3013 };
3014 
3016 
3034 
3037 struct eltwise_forward : public primitive {
3038 
3043  struct desc {
3044  mkldnn_eltwise_desc_t data;
3045  desc(prop_kind aprop_kind, algorithm aalgorithm,
3046  const memory::desc &src_desc, float alpha = 0, float beta = 0) {
3048  mkldnn::convert_to_c(aprop_kind),
3049  mkldnn::convert_to_c(aalgorithm), &src_desc.data,
3050  alpha, beta),
3051  "could not create a eltwise forward descriptor");
3052  }
3053  };
3054 
3057  primitive_desc() = default;
3058 
3059  primitive_desc(const desc &desc, const engine &e)
3060  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
3061 
3062  primitive_desc(const desc &desc, const primitive_attr &attr,
3063  const engine &e)
3064  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
3065 
3068  return query_md(query::src_md, 0);
3069  }
3070 
3073  return query_md(query::dst_md, 0);
3074  }
3075  };
3076 
3077  eltwise_forward() = default;
3078 
3079  eltwise_forward(const primitive_desc &pd): primitive(pd) {}
3080 };
3081 
3084 struct eltwise_backward : public primitive {
3085 
3089  struct desc {
3090  mkldnn_eltwise_desc_t data;
3091 
3092  desc(algorithm aalgorithm, const memory::desc &diff_data_desc,
3093  const memory::desc &data_desc, float alpha = 0, float beta = 0)
3094  {
3096  mkldnn::convert_to_c(aalgorithm), &diff_data_desc.data,
3097  &data_desc.data, alpha, beta),
3098  "could not create a eltwise backward descriptor");
3099  }
3100  };
3101 
3104  primitive_desc() = default;
3105 
3106  primitive_desc(const desc &desc, const engine &e,
3107  const eltwise_forward::primitive_desc &hint_fwd_pd)
3108  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
3109 
3110  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
3111  const eltwise_forward::primitive_desc &hint_fwd_pd)
3112  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
3113 
3116  return query_md(query::src_md, 0);
3117  }
3118 
3121  return query_md(query::diff_src_md, 0);
3122  }
3123 
3126  return query_md(query::diff_dst_md, 0);
3127  }
3128  };
3129 
3130  eltwise_backward() = default;
3131 
3132  eltwise_backward(const primitive_desc &pd): primitive(pd) {}
3133 };
3134 
3136 
3143 
3146 struct softmax_forward : public primitive {
3147 
3149  struct desc {
3150  mkldnn_softmax_desc_t data;
3151 
3155  desc(prop_kind aprop_kind, const memory::desc &data_desc,
3156  int softmax_axis) {
3158  mkldnn::convert_to_c(aprop_kind), &data_desc.data,
3159  softmax_axis),
3160  "could not create a softmax forward descriptor");
3161  }
3162  };
3163 
3166  primitive_desc() = default;
3167 
3168  primitive_desc(const desc &desc, const engine &e)
3169  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
3170 
3171  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
3172  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
3173 
3176  return query_md(query::src_md, 0);
3177  }
3178 
3181  return query_md(query::dst_md, 0);
3182  }
3183  };
3184 
3185  softmax_forward() = default;
3186 
3187  softmax_forward(const primitive_desc &pd): primitive(pd) {}
3188 };
3189 
3192 struct softmax_backward : public primitive {
3193 
3195  struct desc {
3196  mkldnn_softmax_desc_t data;
3197 
3200  desc(const memory::desc &diff_desc, const memory::desc &data_desc,
3201  int softmax_axis) {
3203  &diff_desc.data, &data_desc.data, softmax_axis),
3204  "could not init a backward softmax descriptor");
3205  }
3206  };
3207 
3210  primitive_desc() = default;
3211 
3212  primitive_desc(const desc &desc, const engine &e,
3213  const softmax_forward::primitive_desc &hint_fwd_pd)
3214  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
3215 
3216  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
3217  const softmax_forward::primitive_desc &hint_fwd_pd)
3218  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
3219 
3222  return query_md(query::dst_md, 0);
3223  }
3224 
3227  return query_md(query::diff_src_md, 0);
3228  }
3229 
3232  return query_md(query::diff_dst_md, 0);
3233  }
3234  };
3235 
3236  softmax_backward() = default;
3237 
3238  softmax_backward(const primitive_desc &pd): primitive(pd) {}
3239 };
3240 
3242 
3260 
3264 
3266  struct desc {
3268 
3277  desc(prop_kind aprop_kind, const memory::desc &src_desc, float epsilon,
3278  normalization_flags flags) {
3281  mkldnn::convert_to_c(aprop_kind), &src_desc.data,
3282  epsilon, convert_to_c(flags)),
3283  "could not create a batch normalization forward "
3284  "descriptor");
3285  }
3286  };
3287 
3290  primitive_desc() = default;
3291 
3294  primitive_desc(const desc &desc, const engine &e)
3295  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
3296 
3299  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
3300  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
3301 
3304  return query_md(query::src_md, 0);
3305  }
3306 
3309  return query_md(query::weights_md, 0);
3310  }
3311 
3314  return query_md(query::dst_md, 0);
3315  }
3316 
3321  return query_md(query::workspace_md, 0);
3322  }
3323 
3326  return stat_desc(mean);
3327  }
3328 
3331  return stat_desc(var);
3332  }
3333 
3334  private:
3335  enum { mean = 1, var = 2, };
3336  memory::desc stat_desc(int kind) const {
3339  get(), mkldnn::convert_to_c(query::batch_normalization_d), 0, &p),
3340  "could not get a batch-normalization descriptor");
3341  return query_md(p->flags & mkldnn_use_global_stats ? query::src_md
3342  : query::dst_md,
3343  kind);
3344  }
3345  };
3346 
3347  batch_normalization_forward() = default;
3348 
3349  batch_normalization_forward(const primitive_desc &pd): primitive(pd) {}
3350 };
3351 
3355 
3357  struct desc {
3359 
3368  desc(prop_kind aprop_kind, const memory::desc &diff_data_desc,
3369  const memory::desc &data_desc, float epsilon,
3370  normalization_flags flags) {
3373  mkldnn::convert_to_c(aprop_kind),
3374  &diff_data_desc.data, &data_desc.data,
3375  epsilon, convert_to_c(flags)),
3376  "could not create a batch normalization backward "
3377  "descriptor");
3378  }
3379  };
3380 
3383  primitive_desc() = default;
3384 
3387  primitive_desc(const desc &desc, const engine &e,
3389  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
3390 
3393  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
3395  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
3396 
3399  return query_md(query::src_md, 0);
3400  }
3401 
3404  return query_md(query::src_md, 1);
3405  }
3406 
3409  return query_md(query::src_md, 2);
3410  }
3411 
3414  return query_md(query::weights_md, 0);
3415  }
3416 
3419  return query_md(query::dst_md, 0);
3420  }
3421 
3424  return query_md(query::diff_dst_md, 0);
3425  }
3426 
3431  return query_md(query::workspace_md, 0);
3432  }
3433 
3436  return query_md(query::diff_src_md, 0);
3437  }
3438 
3441  return query_md(query::diff_weights_md, 0);
3442  }
3443  };
3444 
3445  batch_normalization_backward() = default;
3446 
3448 };
3449 
3451 
3458 
3462 
3472  struct desc {
3474  desc(prop_kind aprop_kind, const memory::desc &src_desc,
3475  const memory::desc &weights_desc,
3476  const memory::desc &bias_desc,
3477  const memory::desc &dst_desc) {
3480  mkldnn::convert_to_c(aprop_kind), &src_desc.data,
3481  &weights_desc.data, &bias_desc.data, &dst_desc.data),
3482  "could not create a inner product forward descriptor");
3483  }
3484 
3485  desc(prop_kind aprop_kind, const memory::desc &src_desc,
3486  const memory::desc &weights_desc,
3487  const memory::desc &dst_desc) {
3490  mkldnn::convert_to_c(aprop_kind), &src_desc.data,
3491  &weights_desc.data, nullptr, &dst_desc.data),
3492  "could not create a inner product forward descriptor");
3493  }
3494  };
3495 
3498  primitive_desc() = default;
3499 
3500  primitive_desc(const desc &desc, const engine &e)
3501  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
3502 
3503  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
3504  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
3505 
3508  return query_md(query::src_md, 0);
3509  }
3510 
3513  return query_md(query::weights_md, 0);
3514  }
3515 
3521  return query_md(query::weights_md, 1);
3522  }
3523 
3526  return query_md(query::dst_md, 0);
3527  }
3528  };
3529 
3530  inner_product_forward() = default;
3531 
3533 };
3534 
3538 
3544  struct desc {
3546  desc(const memory::desc &diff_src_desc,
3547  const memory::desc &weights_desc,
3548  const memory::desc &diff_dst_desc) {
3551  &diff_src_desc.data, &weights_desc.data,
3552  &diff_dst_desc.data),
3553  "could not create a inner product backward data descriptor");
3554  }
3555  };
3556 
3560  primitive_desc() = default;
3561 
3562  primitive_desc(const desc &desc, const engine &e,
3563  const inner_product_forward::primitive_desc &hint_fwd_pd)
3564  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
3565 
3566  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
3567  const inner_product_forward::primitive_desc &hint_fwd_pd)
3568  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
3569 
3572  return query_md(query::diff_src_md, 0);
3573  }
3574 
3577  return query_md(query::weights_md, 0);
3578  }
3579 
3582  return query_md(query::diff_dst_md, 0);
3583  }
3584  };
3585 
3586  inner_product_backward_data() = default;
3587 
3589 };
3590 
3594 
3600  struct desc {
3602  desc(const memory::desc &src_desc,
3603  const memory::desc &diff_weights_desc,
3604  const memory::desc &diff_bias_desc,
3605  const memory::desc &diff_dst_desc) {
3608  &data, &src_desc.data, &diff_weights_desc.data,
3609  &diff_bias_desc.data, &diff_dst_desc.data),
3610  "could not create a inner product backward weights descriptor");
3611  }
3612  desc(const memory::desc &src_desc,
3613  const memory::desc &diff_weights_desc,
3614  const memory::desc &diff_dst_desc) {
3617  &data, &src_desc.data, &diff_weights_desc.data,
3618  nullptr, &diff_dst_desc.data),
3619  "could not create a inner product backward weights descriptor");
3620  }
3621  };
3622 
3626  primitive_desc() = default;
3627 
3628  primitive_desc(const desc &desc, const engine &e,
3629  const inner_product_forward::primitive_desc &hint_fwd_pd)
3630  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
3631 
3632  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
3633  const inner_product_forward::primitive_desc &hint_fwd_pd)
3634  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
3635 
3638  return query_md(query::src_md, 0);
3639  }
3640 
3643  return query_md(query::diff_weights_md, 0);
3644  }
3645 
3648  return query_md(query::diff_weights_md, 1);
3649  }
3650 
3653  return query_md(query::diff_dst_md, 0);
3654  }
3655  };
3656 
3657  inner_product_backward_weights() = default;
3658 
3660 };
3661 
3663 
3670 
3675 
3677  struct desc {
3678  mkldnn_rnn_desc_t data;
3679 
3698  desc(prop_kind aprop_kind, algorithm activation,
3699  rnn_direction direction,
3700  const memory::desc &src_layer_desc,
3701  const memory::desc &src_iter_desc,
3702  const memory::desc &weights_layer_desc,
3703  const memory::desc &weights_iter_desc,
3704  const memory::desc &bias_desc,
3705  const memory::desc &dst_layer_desc,
3706  const memory::desc &dst_iter_desc,
3707  rnn_flags flags = rnn_flags::undef,
3708  float alpha = 0.0f, float beta = 0.0f) {
3710  mkldnn::convert_to_c(aprop_kind),
3711  mkldnn::convert_to_c(activation),
3712  mkldnn::convert_to_c(direction),
3713  &src_layer_desc.data, &src_iter_desc.data,
3714  &weights_layer_desc.data, &weights_iter_desc.data,
3715  &bias_desc.data,
3716  &dst_layer_desc.data, &dst_iter_desc.data,
3717  mkldnn::convert_to_c(flags), alpha, beta),
3718  "could not create an RNN forward descriptor");
3719  }
3720 
3721  };
3722 
3725  primitive_desc() = default;
3726 
3727  primitive_desc(const desc &desc, const engine &e)
3728  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
3729 
3730  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
3731  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
3732 
3735  return query_md(query::src_md, 0);
3736  }
3737 
3743  return query_md(query::src_md, 1);
3744  }
3745 
3748  return query_md(query::weights_md, 0);
3749  }
3750 
3753  return query_md(query::weights_md, 1);
3754  }
3755 
3761  return query_md(query::weights_md, 2);
3762  }
3763 
3766  return query_md(query::dst_md, 0);
3767  }
3768 
3774  return query_md(query::dst_md, 1);
3775  }
3776 
3781  return query_md(query::workspace_md, 0);
3782  }
3783  };
3784 
3785  vanilla_rnn_forward() = default;
3786 
3787  vanilla_rnn_forward(const primitive_desc &pd): primitive(pd) {}
3788 };
3789 
3794 
3796  struct desc {
3797  mkldnn_rnn_desc_t data;
3798 
3816  desc(prop_kind aprop_kind, algorithm activation,
3817  rnn_direction direction,
3818  const memory::desc &src_layer_desc,
3819  const memory::desc &src_iter_desc,
3820  const memory::desc &weights_layer_desc,
3821  const memory::desc &weights_iter_desc,
3822  const memory::desc &bias_desc,
3823  const memory::desc &dst_layer_desc,
3824  const memory::desc &dst_iter_desc,
3825  const memory::desc &diff_src_layer_desc,
3826  const memory::desc &diff_src_iter_desc,
3827  const memory::desc &diff_weights_layer_desc,
3828  const memory::desc &diff_weights_iter_desc,
3829  const memory::desc &diff_bias_desc,
3830  const memory::desc &diff_dst_layer_desc,
3831  const memory::desc &diff_dst_iter_desc,
3832  rnn_flags flags = rnn_flags::undef,
3833  float alpha = 0.0f, float beta = 0.0f) {
3835  mkldnn::convert_to_c(aprop_kind), mkldnn::convert_to_c(activation),
3836  mkldnn::convert_to_c(direction),
3837  &src_layer_desc.data, &src_iter_desc.data,
3838  &weights_layer_desc.data, &weights_iter_desc.data,
3839  &bias_desc.data,
3840  &dst_layer_desc.data, &dst_iter_desc.data,
3841  &diff_src_layer_desc.data, &diff_src_iter_desc.data,
3842  &diff_weights_layer_desc.data,
3843  &diff_weights_iter_desc.data, &diff_bias_desc.data,
3844  &diff_dst_layer_desc.data, &diff_dst_iter_desc.data,
3845  mkldnn::convert_to_c(flags), alpha, beta),
3846  "could not create an RNN backward descriptor");
3847  }
3848 
3849  };
3850 
3853  primitive_desc() = default;
3854 
3855  primitive_desc(const desc &desc, const engine &e,
3856  const vanilla_rnn_forward::primitive_desc &hint_fwd_pd)
3857  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
3858 
3859  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
3860  const vanilla_rnn_forward::primitive_desc &hint_fwd_pd)
3861  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
3862 
3865  return query_md(query::src_md, 0);
3866  }
3867 
3873  return query_md(query::src_md, 1);
3874  }
3875 
3878  return query_md(query::weights_md, 0);
3879  }
3880 
3883  return query_md(query::weights_md, 1);
3884  }
3885 
3891  return query_md(query::weights_md, 2);
3892  }
3893 
3896  return query_md(query::dst_md, 0);
3897  }
3898 
3904  return query_md(query::dst_md, 1);
3905  }
3906 
3911  return query_md(query::workspace_md, 0);
3912  }
3913 
3916  return query_md(query::diff_src_md, 0);
3917  }
3918 
3924  return query_md(query::diff_src_md, 1);
3925  }
3926 
3929  return query_md(query::diff_weights_md, 0);
3930  }
3931 
3934  return query_md(query::diff_weights_md, 1);
3935  }
3936 
3939  return query_md(query::diff_weights_md, 2);
3940  }
3941 
3944  return query_md(query::diff_dst_md, 0);
3945  }
3946 
3952  return query_md(query::diff_dst_md, 1);
3953  }
3954  };
3955 
3956  vanilla_rnn_backward() = default;
3957 
3958  vanilla_rnn_backward(const primitive_desc &pd): primitive(pd) {}
3959 };
3960 
3964 struct lstm_forward : public primitive {
3965 
3967  struct desc {
3968  mkldnn_rnn_desc_t data;
3969 
3987  desc(prop_kind aprop_kind,
3988  rnn_direction direction,
3989  const memory::desc &src_layer_desc,
3990  const memory::desc &src_iter_desc,
3991  const memory::desc &src_iter_c_desc,
3992  const memory::desc &weights_layer_desc,
3993  const memory::desc &weights_iter_desc,
3994  const memory::desc &bias_desc,
3995  const memory::desc &dst_layer_desc,
3996  const memory::desc &dst_iter_desc,
3997  const memory::desc &dst_iter_c_desc,
3998  rnn_flags flags = rnn_flags::undef) {
4000  mkldnn::convert_to_c(aprop_kind),
4001  mkldnn::convert_to_c(direction),
4002  &src_layer_desc.data, &src_iter_desc.data,
4003  &src_iter_c_desc.data,
4004  &weights_layer_desc.data, &weights_iter_desc.data,
4005  &bias_desc.data,
4006  &dst_layer_desc.data, &dst_iter_desc.data,
4007  &dst_iter_c_desc.data,
4008  mkldnn::convert_to_c(flags)),
4009  "could not create an LSTM forward descriptor");
4010  }
4011 
4012  };
4013 
4016  primitive_desc() = default;
4017 
4018  primitive_desc(const desc &desc, const engine &e)
4019  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
4020 
4021  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
4022  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
4023 
4026  return query_md(query::src_md, 0);
4027  }
4028 
4034 
4035  return query_md(query::src_md, 1);
4036  }
4037 
4040  return query_md(query::src_md, 2);
4041  }
4042 
4045  return query_md(query::weights_md, 0);
4046  }
4047 
4050  return query_md(query::weights_md, 1);
4051  }
4052 
4058  return query_md(query::weights_md, 2);
4059  }
4060 
4063  return query_md(query::dst_md, 0);
4064  }
4065 
4071  return query_md(query::dst_md, 1);
4072  }
4073 
4076  return query_md(query::dst_md, 2);
4077  }
4078 
4083  return query_md(query::workspace_md, 0);
4084  }
4085  };
4086 
4087  lstm_forward() = default;
4088 
4089  lstm_forward(const primitive_desc &pd): primitive(pd) {}
4090 };
4091 
4095 struct lstm_backward : public primitive {
4096 
4098  struct desc {
4099  mkldnn_rnn_desc_t data;
4100 
4119  desc(prop_kind aprop_kind, rnn_direction direction,
4120  const memory::desc &src_layer_desc,
4121  const memory::desc &src_iter_desc,
4122  const memory::desc &src_iter_c_desc,
4123  const memory::desc &weights_layer_desc,
4124  const memory::desc &weights_iter_desc,
4125  const memory::desc &bias_desc,
4126  const memory::desc &dst_layer_desc,
4127  const memory::desc &dst_iter_desc,
4128  const memory::desc &dst_iter_c_desc,
4129  const memory::desc &diff_src_layer_desc,
4130  const memory::desc &diff_src_iter_desc,
4131  const memory::desc &diff_src_iter_c_desc,
4132  const memory::desc &diff_weights_layer_desc,
4133  const memory::desc &diff_weights_iter_desc,
4134  const memory::desc &diff_bias_desc,
4135  const memory::desc &diff_dst_layer_desc,
4136  const memory::desc &diff_dst_iter_desc,
4137  const memory::desc &diff_dst_iter_c_desc,
4138  rnn_flags flags = rnn_flags::undef) {
4140  mkldnn::convert_to_c(aprop_kind),
4141  mkldnn::convert_to_c(direction),
4142  &src_layer_desc.data, &src_iter_desc.data, &src_iter_c_desc.data,
4143  &weights_layer_desc.data, &weights_iter_desc.data,
4144  &bias_desc.data,
4145  &dst_layer_desc.data, &dst_iter_desc.data, &dst_iter_c_desc.data,
4146  &diff_src_layer_desc.data, &diff_src_iter_desc.data, &diff_src_iter_c_desc.data,
4147  &diff_weights_layer_desc.data,
4148  &diff_weights_iter_desc.data, &diff_bias_desc.data,
4149  &diff_dst_layer_desc.data, &diff_dst_iter_desc.data, &diff_dst_iter_c_desc.data,
4150  mkldnn::convert_to_c(flags)),
4151  "could not create an LSTM backward descriptor");
4152  }
4153 
4154  };
4155 
4158  primitive_desc() = default;
4159 
4160  primitive_desc(const desc &desc, const engine &e,
4161  const lstm_forward::primitive_desc &hint_fwd_pd)
4162  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
4163 
4164  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
4165  const lstm_forward::primitive_desc &hint_fwd_pd)
4166  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
4167 
4170  return query_md(query::src_md, 0);
4171  }
4172 
4178 
4179  return query_md(query::src_md, 1);
4180  }
4181 
4184  return query_md(query::src_md, 2);
4185  }
4186 
4189  return query_md(query::weights_md, 0);
4190  }
4191 
4194  return query_md(query::weights_md, 1);
4195  }
4196 
4202  return query_md(query::weights_md, 2);
4203  }
4204 
4207  return query_md(query::dst_md, 0);
4208  }
4209 
4215  return query_md(query::dst_md, 1);
4216  }
4217 
4220  return query_md(query::dst_md, 2);
4221  }
4222 
4227  return query_md(query::workspace_md, 0);
4228  }
4229 
4230 
4233  return query_md(query::diff_src_md, 0);
4234  }
4235 
4241  return query_md(query::diff_src_md, 1);
4242  }
4243 
4246  return query_md(query::diff_src_md, 2);
4247  }
4248 
4251  return query_md(query::diff_weights_md, 0);
4252  }
4253 
4256  return query_md(query::diff_weights_md, 1);
4257  }
4258 
4261  return query_md(query::diff_weights_md, 2);
4262  }
4263 
4266  return query_md(query::diff_dst_md, 0);
4267  }
4268 
4274  return query_md(query::diff_dst_md, 1);
4275  }
4276 
4279  return query_md(query::diff_dst_md, 2);
4280  }
4281  };
4282 
4283  lstm_backward() = default;
4284 
4285  // With last iteration (with and without input src_iter)
4286  lstm_backward(const primitive_desc &pd): primitive(pd) {}
4287 };
4288 
4292 struct gru_forward : public primitive {
4293 
4295  struct desc {
4296  mkldnn_rnn_desc_t data;
4297 
4315  desc(prop_kind aprop_kind,
4316  rnn_direction direction,
4317  const memory::desc &src_layer_desc,
4318  const memory::desc &src_iter_desc,
4319  const memory::desc &weights_layer_desc,
4320  const memory::desc &weights_iter_desc,
4321  const memory::desc &bias_desc,
4322  const memory::desc &dst_layer_desc,
4323  const memory::desc &dst_iter_desc,
4324  rnn_flags flags = rnn_flags::undef) {
4326  mkldnn::convert_to_c(aprop_kind),
4327  mkldnn::convert_to_c(direction),
4328  &src_layer_desc.data, &src_iter_desc.data,
4329  &weights_layer_desc.data, &weights_iter_desc.data,
4330  &bias_desc.data,
4331  &dst_layer_desc.data, &dst_iter_desc.data,
4332  mkldnn::convert_to_c(flags)),
4333  "could not create a GRU forward descriptor");
4334  }
4335 
4336  };
4337 
4340  primitive_desc() = default;
4341 
4342  primitive_desc(const desc &desc, const engine &e)
4343  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
4344 
4345  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
4346  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
4347 
4350  return query_md(query::src_md, 0);
4351  }
4352 
4358 
4359  return query_md(query::src_md, 1);
4360  }
4361 
4364  return query_md(query::weights_md, 0);
4365  }
4366 
4369  return query_md(query::weights_md, 1);
4370  }
4371 
4377  return query_md(query::weights_md, 2);
4378  }
4379 
4382  return query_md(query::dst_md, 0);
4383  }
4384 
4390  return query_md(query::dst_md, 1);
4391  }
4392 
4397  return query_md(query::workspace_md, 0);
4398  }
4399  };
4400 
4401  gru_forward() = default;
4402 
4403  gru_forward(const primitive_desc &pd): primitive(pd) {}
4404 };
4405 
4409 struct gru_backward : public primitive {
4410 
4412  struct desc {
4413  mkldnn_rnn_desc_t data;
4414 
4430  desc(prop_kind aprop_kind, rnn_direction direction,
4431  const memory::desc &src_layer_desc,
4432  const memory::desc &src_iter_desc,
4433  const memory::desc &weights_layer_desc,
4434  const memory::desc &weights_iter_desc,
4435  const memory::desc &bias_desc,
4436  const memory::desc &dst_layer_desc,
4437  const memory::desc &dst_iter_desc,
4438  const memory::desc &diff_src_layer_desc,
4439  const memory::desc &diff_src_iter_desc,
4440  const memory::desc &diff_weights_layer_desc,
4441  const memory::desc &diff_weights_iter_desc,
4442  const memory::desc &diff_bias_desc,
4443  const memory::desc &diff_dst_layer_desc,
4444  const memory::desc &diff_dst_iter_desc,
4445  rnn_flags flags = rnn_flags::undef) {
4447  mkldnn::convert_to_c(aprop_kind),
4448  mkldnn::convert_to_c(direction),
4449  &src_layer_desc.data, &src_iter_desc.data,
4450  &weights_layer_desc.data, &weights_iter_desc.data,
4451  &bias_desc.data,
4452  &dst_layer_desc.data, &dst_iter_desc.data,
4453  &diff_src_layer_desc.data, &diff_src_iter_desc.data,
4454  &diff_weights_layer_desc.data,
4455  &diff_weights_iter_desc.data, &diff_bias_desc.data,
4456  &diff_dst_layer_desc.data, &diff_dst_iter_desc.data,
4457  mkldnn::convert_to_c(flags)),
4458  "could not create an GRU backward descriptor");
4459  }
4460 
4461  };
4462 
4465  primitive_desc() = default;
4466 
4467  primitive_desc(const desc &desc, const engine &e,
4468  const gru_forward::primitive_desc &hint_fwd_pd)
4469  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
4470 
4471  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
4472  const gru_forward::primitive_desc &hint_fwd_pd)
4473  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
4474 
4477  return query_md(query::src_md, 0);
4478  }
4479 
4485 
4486  return query_md(query::src_md, 1);
4487  }
4488 
4491  return query_md(query::weights_md, 0);
4492  }
4493 
4496  return query_md(query::weights_md, 1);
4497  }
4498 
4504  return query_md(query::weights_md, 2);
4505  }
4506 
4509  return query_md(query::dst_md, 0);
4510  }
4511 
4517  return query_md(query::dst_md, 1);
4518  }
4519 
4524  return query_md(query::workspace_md, 0);
4525  }
4526 
4527 
4530  return query_md(query::diff_src_md, 0);
4531  }
4532 
4538  return query_md(query::diff_src_md, 1);
4539  }
4540 
4543  return query_md(query::diff_weights_md, 0);
4544  }
4545 
4548  return query_md(query::diff_weights_md, 1);
4549  }
4550 
4553  return query_md(query::diff_weights_md, 2);
4554  }
4555 
4558  return query_md(query::diff_dst_md, 0);
4559  }
4560 
4566  return query_md(query::diff_dst_md, 1);
4567  }
4568  };
4569 
4570  gru_backward() = default;
4571 
4572  // With last iteration (with and without input src_iter)
4573  gru_backward(const primitive_desc &pd): primitive(pd) {}
4574 };
4575 
4579 struct lbr_gru_forward : public primitive {
4580 
4582  struct desc {
4583  mkldnn_rnn_desc_t data;
4584 
4602  desc(prop_kind aprop_kind,
4603  rnn_direction direction,
4604  const memory::desc &src_layer_desc,
4605  const memory::desc &src_iter_desc,
4606  const memory::desc &weights_layer_desc,
4607  const memory::desc &weights_iter_desc,
4608  const memory::desc &bias_desc,
4609  const memory::desc &dst_layer_desc,
4610  const memory::desc &dst_iter_desc,
4611  rnn_flags flags = rnn_flags::undef) {
4613  mkldnn::convert_to_c(aprop_kind),
4614  mkldnn::convert_to_c(direction),
4615  &src_layer_desc.data, &src_iter_desc.data,
4616  &weights_layer_desc.data, &weights_iter_desc.data,
4617  &bias_desc.data,
4618  &dst_layer_desc.data, &dst_iter_desc.data,
4619  mkldnn::convert_to_c(flags)),
4620  "could not create a Linear-before-reset GRU forward descriptor");
4621  }
4622 
4623  };
4624 
4627  primitive_desc() = default;
4628 
4629  primitive_desc(const desc &desc, const engine &e)
4630  : mkldnn::primitive_desc(&desc.data, nullptr, e, nullptr) {}
4631 
4632  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
4633  : mkldnn::primitive_desc(&desc.data, &attr, e, nullptr) {}
4634 
4637  return query_md(query::src_md, 0);
4638  }
4639 
4645 
4646  return query_md(query::src_md, 1);
4647  }
4648 
4651  return query_md(query::weights_md, 0);
4652  }
4653 
4656  return query_md(query::weights_md, 1);
4657  }
4658 
4664  return query_md(query::weights_md, 2);
4665  }
4666 
4669  return query_md(query::dst_md, 0);
4670  }
4671 
4677  return query_md(query::dst_md, 1);
4678  }
4679 
4684  return query_md(query::workspace_md, 0);
4685  }
4686  };
4687 
4688  lbr_gru_forward() = default;
4689 
4690  lbr_gru_forward(const primitive_desc &pd): primitive(pd) {}
4691 };
4692 
4696 struct lbr_gru_backward : public primitive {
4697 
4699  struct desc {
4700  mkldnn_rnn_desc_t data;
4701 
4717  desc(prop_kind aprop_kind, rnn_direction direction,
4718  const memory::desc &src_layer_desc,
4719  const memory::desc &src_iter_desc,
4720  const memory::desc &weights_layer_desc,
4721  const memory::desc &weights_iter_desc,
4722  const memory::desc &bias_desc,
4723  const memory::desc &dst_layer_desc,
4724  const memory::desc &dst_iter_desc,
4725  const memory::desc &diff_src_layer_desc,
4726  const memory::desc &diff_src_iter_desc,
4727  const memory::desc &diff_weights_layer_desc,
4728  const memory::desc &diff_weights_iter_desc,
4729  const memory::desc &diff_bias_desc,
4730  const memory::desc &diff_dst_layer_desc,
4731  const memory::desc &diff_dst_iter_desc,
4732  rnn_flags flags = rnn_flags::undef) {
4734  mkldnn::convert_to_c(aprop_kind),
4735  mkldnn::convert_to_c(direction),
4736  &src_layer_desc.data, &src_iter_desc.data,
4737  &weights_layer_desc.data, &weights_iter_desc.data,
4738  &bias_desc.data,
4739  &dst_layer_desc.data, &dst_iter_desc.data,
4740  &diff_src_layer_desc.data, &diff_src_iter_desc.data,
4741  &diff_weights_layer_desc.data,
4742  &diff_weights_iter_desc.data, &diff_bias_desc.data,
4743  &diff_dst_layer_desc.data, &diff_dst_iter_desc.data,
4744  mkldnn::convert_to_c(flags)),
4745  "could not create an LBR_GRU backward descriptor");
4746  }
4747 
4748  };
4749 
4752  primitive_desc() = default;
4753 
4754  primitive_desc(const desc &desc, const engine &e,
4755  const lbr_gru_forward::primitive_desc &hint_fwd_pd)
4756  : mkldnn::primitive_desc(&desc.data, nullptr, e, hint_fwd_pd.get()) {}
4757 
4758  primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e,
4759  const lbr_gru_forward::primitive_desc &hint_fwd_pd)
4760  : mkldnn::primitive_desc(&desc.data, &attr, e, hint_fwd_pd.get()) {}
4761 
4764  return query_md(query::src_md, 0);
4765  }
4766 
4772 
4773  return query_md(query::src_md, 1);
4774  }
4775 
4778  return query_md(query::weights_md, 0);
4779  }
4780 
4783  return query_md(query::weights_md, 1);
4784  }
4785 
4791  return query_md(query::weights_md, 2);
4792  }
4793 
4796  return query_md(query::dst_md, 0);
4797  }
4798 
4804  return query_md(query::dst_md, 1);
4805  }
4806 
4811  return query_md(query::workspace_md, 0);
4812  }
4813 
4814 
4817  return query_md(query::diff_src_md, 0);
4818  }
4819 
4825  return query_md(query::diff_src_md, 1);
4826  }
4827 
4830  return query_md(query::diff_weights_md, 0);
4831  }
4832 
4835  return query_md(query::diff_weights_md, 1);
4836  }
4837 
4840  return query_md(query::diff_weights_md, 2);
4841  }
4842 
4845  return query_md(query::diff_dst_md, 0);
4846  }
4847 
4853  return query_md(query::diff_dst_md, 1);
4854  }
4855  };
4856 
4857  lbr_gru_backward() = default;
4858 
4859  lbr_gru_backward(const primitive_desc &pd): primitive(pd) {}
4860 };
4861 
4863 
4870 
4873 struct shuffle_forward : public primitive {
4874 
4876  struct desc {
4877  mkldnn_shuffle_desc_t data;
4878 
4882  desc(prop_kind aprop_kind, const memory::desc &data_desc,
4883  int axis, int group_size) {
4885  mkldnn::convert_to_c(aprop_kind), &data_desc.data,
4886  axis, group_size),
4887  "could not create a shuffle forward descriptor");
4888  }
4889  };
4890 
4893  primitive_desc() = default;
4894 
4895  primitive_desc(const desc &desc, const engine &e,
4896  const primitive_attr &aattr = primitive_attr())
4897  : mkldnn::primitive_desc(&desc.data, &aattr, e, nullptr) {}
4898 
4901  return query_md(query::src_md, 0);
4902  }
4903 
4906  return query_md(query::dst_md, 0);
4907  }
4908  };
4909 
4910  shuffle_forward() = default;
4911 
4912  shuffle_forward(const primitive_desc &pd): primitive(pd) {}
4913 };
4914 
4917 struct shuffle_backward : public primitive {
4918 
4919  // Descriptor for shuffle backward propagation.
4920  struct desc {
4921  mkldnn_shuffle_desc_t data;
4922 
4925  desc(const memory::desc &diff_data_desc, int axis, int group_size) {
4927  &diff_data_desc.data, axis, group_size),
4928  "could not create a shuffle backward descriptor");
4929  }
4930  };
4931 
4932  // Primitive descriptor for shuffle backward propagation.
4933  struct primitive_desc : public mkldnn::primitive_desc {
4934  primitive_desc() = default;
4935 
4936  primitive_desc(const desc &desc, const engine &e,
4937  const shuffle_forward::primitive_desc &hint_fwd_pd,
4938  const primitive_attr &aattr = primitive_attr())
4940  &desc.data, &aattr, e, hint_fwd_pd.get()) {}
4941 
4943  memory::desc diff_src_desc() const {
4944  return query_md(query::diff_src_md, 0);
4945  }
4946 
4948  memory::desc diff_dst_desc() const {
4949  return query_md(query::diff_dst_md, 0);
4950  }
4951  };
4952 
4953  shuffle_backward() = default;
4954 
4955  shuffle_backward(const primitive_desc &pd): primitive(pd) {}
4956 };
4957 
4959 
4961 
4963 
4964 // implementation section
4965 #ifndef DOXYGEN_SHOULD_SKIP_THIS
4966 
4967 inline primitive::primitive(const_mkldnn_primitive_desc_t c_pd) {
4968  mkldnn_primitive_t result;
4970  "could not create a primitive");
4971  reset(result);
4972 }
4973 
4974 inline primitive::primitive(const primitive_desc &pd): primitive(pd.get()) {}
4975 
4976 inline void primitive::execute(stream &astream,
4977  const std::unordered_map<int, memory> &args) const {
4978  std::vector<mkldnn_exec_arg_t> c_args;
4979  c_args.reserve(args.size());
4980  for (const auto &a: args)
4981  c_args.push_back({a.first, a.second.get()});
4982 
4983  error::wrap_c_api(mkldnn_primitive_execute(get(), astream.get(),
4984  (int)c_args.size(), c_args.data()),
4985  "could not execute a primitive");
4986 }
4987 #endif // DOXYGEN_SHOULD_SKIP_THIS
4988 
4989 } // namespace mkldnn
4990 
4991 #endif
void append_sum(float scale=1.)
Appends accumulation (sum) post operation.
Definition: mkldnn.hpp:601
Primitive descriptor for eltwise backward propagation.
Definition: mkldnn.hpp:3103
LRN within a single channel.
Definition: mkldnn_types.h:694
memory::desc dst_iter_desc() const
Queries destination iteration memory descriptor.
Definition: mkldnn.hpp:4516
GRU cell with linear before reset.
implementation name
A descriptor of a Local Response Normalization (LRN) operation.
Definition: mkldnn_types.h:1081
Average pooling include padding.
batch normalization descriptor
op descriptor
Definition: mkldnn_types.h:1516
mkldnn_status_t MKLDNN_API mkldnn_lbr_gru_backward_desc_init(mkldnn_rnn_desc_t *rnn_desc, mkldnn_prop_kind_t prop_kind, mkldnn_rnn_direction_t direction, const mkldnn_memory_desc_t *src_layer_desc, const mkldnn_memory_desc_t *src_iter_desc, const mkldnn_memory_desc_t *weights_layer_desc, const mkldnn_memory_desc_t *weights_iter_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_layer_desc, const mkldnn_memory_desc_t *dst_iter_desc, const mkldnn_memory_desc_t *diff_src_layer_desc, const mkldnn_memory_desc_t *diff_src_iter_desc, const mkldnn_memory_desc_t *diff_weights_layer_desc, const mkldnn_memory_desc_t *diff_weights_iter_desc, const mkldnn_memory_desc_t *diff_bias_desc, const mkldnn_memory_desc_t *diff_dst_layer_desc, const mkldnn_memory_desc_t *diff_dst_iter_desc, unsigned flags)
Initializes an LBR GRU descriptor rnn_desc for backward propagation using prop_kind, direction, and memory descriptors.
memory::desc src_iter_desc() const
Queries source recurrent hidden state memory descriptor.
Definition: mkldnn.hpp:4177
Packed weights format used in RNN.
Definition: mkldnn_types.h:99
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e, const convolution_forward::primitive_desc &hint_fwd_pd)
Initializes a primitive descriptor for convolution weight update with attributes defined by attr...
Definition: mkldnn.hpp:2292
2D CNN activations tensor, an alias to mkldnn_ab
Definition: mkldnn_types.h:340
T * map_data() const
Maps the data of the memory.
Definition: mkldnn.hpp:1467
desc(prop_kind aprop_kind, algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &dst_desc, const memory::dims &strides, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for deconvolution forward propagation without bias using prop_kind (possible...
Definition: mkldnn.hpp:2377
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_destroy(mkldnn_primitive_attr_t attr)
Deletes an attr.
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:3581
A tensor in a generic format described by the stride and blocking values in each dimension.
A softmax primitive.
Definition: mkldnn_types.h:629
4D tensor blocked by 2nd dimension with block size 16
Definition: mkldnn_types.h:231
Primitive descriptor for GRU backward propagation.
Definition: mkldnn.hpp:4464
number of outputs expected
Definition: mkldnn_types.h:1501
mkldnn_status_t MKLDNN_API mkldnn_stream_destroy(mkldnn_stream_t stream)
Destroys an execution stream.
Average pooling exclude padding, alias for mkldnn::algorithm::pooling_avg_include_padding.
A base class for all primitive descriptors.
Definition: mkldnn.hpp:1792
GPU engine.
Definition: mkldnn_types.h:1262
Unspecified format kind.
Definition: mkldnn_types.h:91
mkldnn_status_t
Status values returned by the library functions.
Definition: mkldnn_types.h:50
mkldnn_status_t MKLDNN_API mkldnn_lstm_forward_desc_init(mkldnn_rnn_desc_t *rnn_desc, mkldnn_prop_kind_t prop_kind, mkldnn_rnn_direction_t direction, const mkldnn_memory_desc_t *src_layer_desc, const mkldnn_memory_desc_t *src_iter_desc, const mkldnn_memory_desc_t *src_iter_c_desc, const mkldnn_memory_desc_t *weights_layer_desc, const mkldnn_memory_desc_t *weights_iter_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_layer_desc, const mkldnn_memory_desc_t *dst_iter_desc, const mkldnn_memory_desc_t *dst_iter_c_desc, unsigned flags)
Initializes an LSTM descriptor rnn_desc for forward propagation using prop_kind, direction, and memory descriptors.
memory::desc variance_desc() const
Queries variance memory descriptor.
Definition: mkldnn.hpp:3408
desc(prop_kind aprop_kind, algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &dst_desc, const memory::dims &strides, const memory::dims &dilates, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for dilated deconvolution forward propagation without bias using aprop_kind ...
Definition: mkldnn.hpp:2432
4D tensor blocked by 1st and 2nd dimension with block size 8
Definition: mkldnn_types.h:250
Primitive descriptor for pooling forward propagation.
Definition: mkldnn.hpp:2919
A descriptor of a convolution operation.
Definition: mkldnn_types.h:938
16-bit/half-precision floating point.
desc(prop_kind aprop_kind, const memory::desc &data_desc, int axis, int group_size)
Initializes a shuffle descriptor for forward propagation using prop_kind, memory descriptor data_desc...
Definition: mkldnn.hpp:4882
Descriptor for pooling forward propagation.
Definition: mkldnn.hpp:2889
desc(prop_kind aprop_kind, algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &bias_desc, const memory::desc &dst_desc, const memory::dims &strides, const memory::dims &dilates, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for dilated deconvolution forward propagation with bias using aprop_kind (po...
Definition: mkldnn.hpp:2403
permuted 3D tensor
Definition: mkldnn_types.h:193
mkldnn_status_t MKLDNN_API mkldnn_dilated_convolution_backward_weights_desc_init(mkldnn_convolution_desc_t *conv_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *diff_weights_desc, const mkldnn_memory_desc_t *diff_bias_desc, const mkldnn_memory_desc_t *diff_dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t dilates, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a convolution descriptor conv_desc for backward propagation with respect to weights using...
Primitive descriptor for deconvolution weight update.
Definition: mkldnn.hpp:2708
mkldnn_status_t MKLDNN_API mkldnn_post_ops_create(mkldnn_post_ops_t *post_ops)
Creates an empty sequence of post operations post_ops.
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_destroy(mkldnn_primitive_desc_t primitive_desc)
Deletes a primitive_desc.
memory consumption (bytes)
int MKLDNN_API mkldnn_memory_desc_equal(const mkldnn_memory_desc_t *lhs, const mkldnn_memory_desc_t *rhs)
Compares two memory descriptors.
desc(algorithm aalgorithm, const memory::desc &diff_src_desc, const memory::desc &weights_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for convolution backward propagation using aalgorithm, memory descriptors...
Definition: mkldnn.hpp:2085
The operation failed because of incorrect function arguments.
Definition: mkldnn_types.h:56
Primitive descriptor for LSTM backward propagation.
Definition: mkldnn.hpp:4157
Eltwise: exponent.
Definition: mkldnn_types.h:678
desc()
Constructs a zero memory descriptor.
Definition: mkldnn.hpp:1337
Forward data propagation (alias for mkldnn_forward_inference).
Definition: mkldnn_types.h:596
Descriptor for local response normalization forward propagation.
Definition: mkldnn.hpp:2765
Descriptor for deconvolution weight update.
Definition: mkldnn.hpp:2603
An opaque structure to describe an engine.
Primitive descriptor for inner product forward propagation.
Definition: mkldnn.hpp:3497
Backward data propagation.
Definition: mkldnn_types.h:602
Descriptor for softmax backward propagation.
Definition: mkldnn.hpp:3195
4D RNN bias tensor in the format (num_layers, num_directions, num_gates, output_channels).
Definition: mkldnn_types.h:427
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_get_attr(const_mkldnn_primitive_desc_t primitive_desc, const_mkldnn_primitive_attr_t *attr)
Returns a constant reference to the attribute of a primitive_desc.
Use global statistics.
Definition: mkldnn_types.h:724
Shuffle for backward propagation.
Definition: mkldnn.hpp:4917
memory::desc src_iter_desc() const
Queries source iteration memory descriptor.
Definition: mkldnn.hpp:4771
mkldnn_status_t MKLDNN_API mkldnn_memory_get_memory_desc(const_mkldnn_memory_t memory, const mkldnn_memory_desc_t **memory_desc)
Returns a memory_desc associated with memory.
desc(algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for deconvolution weight update with bias using aalgorithm, memory descriptors, strides, padding_l, and padding_r.
Definition: mkldnn.hpp:2612
desc(prop_kind aprop_kind, const memory::desc &data_desc, int softmax_axis)
Initializes a softmax descriptor for forward propagation using prop_kind (possible values are mkldnn:...
Definition: mkldnn.hpp:3155
mkldnn_status_t MKLDNN_API mkldnn_stream_create(mkldnn_stream_t *stream, mkldnn_engine_t engine, unsigned flags)
Creates an execution stream for engine and with flags.
const_mkldnn_primitive_desc_t get_primitive_desc() const
Returns the descriptor of the underlying C API primitive.
Definition: mkldnn.hpp:227
memory::desc diff_src_desc() const
Queries diff source gradient memory descriptor.
Definition: mkldnn.hpp:2574
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:4201
Default order execution.
Definition: mkldnn_types.h:1550
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_clone(mkldnn_primitive_attr_t *attr, const_mkldnn_primitive_attr_t existing_attr)
Makes a copy of an existing_attr.
mkldnn_status_t MKLDNN_API mkldnn_lrn_forward_desc_init(mkldnn_lrn_desc_t *lrn_desc, mkldnn_prop_kind_t prop_kind, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *data_desc, mkldnn_dim_t local_size, float alpha, float beta, float k)
Initializes an lrn_desc for forward propagation using prop_kind (possible values are mkldnn_forward_t...
kind get_kind() const
Returns the kind of the engine.
Definition: mkldnn.hpp:848
desc submemory_desc(const dims &adims, const dims &offsets)
Constructs a sub-memory descriptor.
Definition: mkldnn.hpp:1377
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:2807
A descriptor of a Softmax operation.
Definition: mkldnn_types.h:1032
memory::desc diff_src_desc() const
Queries diff source memory descriptor.
Definition: mkldnn.hpp:3226
mkldnn_status_t MKLDNN_API mkldnn_deconvolution_backward_data_desc_init(mkldnn_deconvolution_desc_t *conv_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *diff_src_desc, const mkldnn_memory_desc_t *weights_desc, const mkldnn_memory_desc_t *diff_dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a deconvolution descriptor conv_desc for backward propagation with respect to data using ...
desc(prop_kind aprop_kind, algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &bias_desc, const memory::desc &dst_desc, const memory::dims &strides, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for convolution forward propagation without bias using aprop_kind (possible ...
Definition: mkldnn.hpp:1919
mkldnn_status_t MKLDNN_API mkldnn_memory_unmap_data(const_mkldnn_memory_t memory, void *mapped_ptr)
For a memory, unmaps a mapped pointer to the data of the memory.
memory::desc dst_iter_desc() const
Queries destination iteration memory descriptor.
Definition: mkldnn.hpp:4389
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:2486
void set_rnn_data_qparams(float scale, float shift)
Sets quantization scale and shift for RNN data tensors.
Definition: mkldnn.hpp:733
5D tensor blocked by 2nd dimension with block size 16
Definition: mkldnn_types.h:260
permuted 4D tensor
Definition: mkldnn_types.h:204
source memory desc
A descriptor of an inner product operation.
Definition: mkldnn_types.h:1135
mkldnn_status_t MKLDNN_API mkldnn_post_ops_destroy(mkldnn_post_ops_t post_ops)
Deletes a post_ops sequence.
memory::desc diff_weights_layer_desc() const
Queries diff weights layer memory descriptor.
Definition: mkldnn.hpp:4250
An opaque structure for a chain of post operations.
4D CNN activations tensor, an alias to mkldnn::memory::format_tag::bcda
An opaque structure to describe a primitive descriptor.
batch normalization descriptor
Definition: mkldnn_types.h:1524
void reset(T t, bool weak=false)
Resets the value of a C handle.
Definition: mkldnn.hpp:131
32-bit signed integer.
A convolution primitive.
Definition: mkldnn_types.h:623
LSTM descriptor for backward propagation.
Definition: mkldnn.hpp:4098
mkldnn_rnn_direction_t
A direction of RNN primitive execution.
Definition: mkldnn_types.h:1169
Backward weights propagation.
primitive_desc(const desc &desc, const engine &e, const deconvolution_forward::primitive_desc &hint_fwd_pd)
Initializes a primitive descriptor for deconvolution backward propagation.
Definition: mkldnn.hpp:2563
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:3890
source memory desc
Definition: mkldnn_types.h:1531
engine(const mkldnn_engine_t &aengine)
Constructs an engine from other engine aengine.
Definition: mkldnn.hpp:833
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:3652
engine(const handle< mkldnn_primitive_desc_t > &pd)
Constructs an engine from the primitive descriptor pd by querying its engine.
Definition: mkldnn.hpp:838
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:3221
mkldnn_status_t MKLDNN_API mkldnn_batch_normalization_forward_desc_init(mkldnn_batch_normalization_desc_t *bnrm_desc, mkldnn_prop_kind_t prop_kind, const mkldnn_memory_desc_t *data_desc, float epsilon, unsigned flags)
Initializes a batch normalization descriptor bnrm_desc for forward propagation using prop_kind (possi...
mkldnn_status_t MKLDNN_API mkldnn_vanilla_rnn_backward_desc_init(mkldnn_rnn_desc_t *rnn_desc, mkldnn_prop_kind_t prop_kind, const mkldnn_alg_kind_t activation, const mkldnn_rnn_direction_t direction, const mkldnn_memory_desc_t *src_layer_desc, const mkldnn_memory_desc_t *src_iter_desc, const mkldnn_memory_desc_t *weights_layer_desc, const mkldnn_memory_desc_t *weights_iter_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_layer_desc, const mkldnn_memory_desc_t *dst_iter_desc, const mkldnn_memory_desc_t *diff_src_layer_desc, const mkldnn_memory_desc_t *diff_src_iter_desc, const mkldnn_memory_desc_t *diff_weights_layer_desc, const mkldnn_memory_desc_t *diff_weights_iter_desc, const mkldnn_memory_desc_t *diff_bias_desc, const mkldnn_memory_desc_t *diff_dst_layer_desc, const mkldnn_memory_desc_t *diff_dst_iter_desc, unsigned flags, float alpha, float beta)
Initializes an RNN descriptor rnn_desc for backward propagation using prop_kind, activation, direction, and memory descriptors.
weights memory descriptor desc
An execution engine.
Definition: mkldnn.hpp:783
Forward data propagation, alias for mkldnn::prop_kind::forward_inference.
deconvolution_backward_weights(const primitive_desc &pd)
Creates a deconvolution weight update primitive from the corresponding primitive descriptor.
Definition: mkldnn.hpp:2747
4D tensor blocked by 1st and 2nd dimension with block size 8
mkldnn_status_t MKLDNN_API mkldnn_post_ops_append_eltwise(mkldnn_post_ops_t post_ops, float scale, mkldnn_alg_kind_t alg, float alpha, float beta)
Appends eltwise post operation to the post_ops with given parameters kind, alpha, and beta (...
memory::desc diff_bias_desc() const
Queries diff bias memory descriptor.
Definition: mkldnn.hpp:3938
mkldnn_status_t MKLDNN_API mkldnn_pooling_forward_desc_init(mkldnn_pooling_desc_t *pool_desc, mkldnn_prop_kind_t prop_kind, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t kernel, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a pooling descriptor pool_desc for forward propagation using prop_kind (possible values a...
Backward data propagation.
memory::desc dst_layer_desc() const
Queries destination layer memory descriptor.
Definition: mkldnn.hpp:4508
memory(const desc &md, const engine &aengine, void *ahandle)
Constructs a memory.
Definition: mkldnn.hpp:1406
Undefined primitive.
5D CNN weights tensor (incl. groups), an alias to mkldnn_abcde
Definition: mkldnn_types.h:392
Undefined primitive.
Definition: mkldnn_types.h:613
An inner product primitive.
Definition: mkldnn_types.h:637
3D CNN weights tensor, an alias to mkldnn_cba
Definition: mkldnn_types.h:367
memory::desc diff_dst_iter_c_desc() const
Queries diff destination recurrent cell state memory descriptor.
Definition: mkldnn.hpp:4278
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:2039
Out-of-order execution.
LSTM for backward propagation.
Definition: mkldnn.hpp:4095
primitive_attr()
Creates a default primitive attribute.
Definition: mkldnn.hpp:650
Element-wise operations for backward propagation.
Definition: mkldnn.hpp:3084
error(mkldnn_status_t astatus, const char *amessage)
Constructs an error instance.
Definition: mkldnn.hpp:61
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:2929
Primitive descriptor for softmax forward propagation.
Definition: mkldnn.hpp:3165
void get_params_sum(int index, float &scale) const
Gets the parameters of the accumulation (sum) post operation with index index.
Definition: mkldnn.hpp:608
desc(prop_kind aprop_kind, algorithm activation, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &diff_src_layer_desc, const memory::desc &diff_src_iter_desc, const memory::desc &diff_weights_layer_desc, const memory::desc &diff_weights_iter_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_layer_desc, const memory::desc &diff_dst_iter_desc, rnn_flags flags=rnn_flags::undef, float alpha=0.0f, float beta=0.0f)
Initializes an RNN descriptor for backward propagation using prop_kind, activation, direction, and memory descriptors.
Definition: mkldnn.hpp:3816
32-bit signed integer.
Definition: mkldnn_types.h:78
bool is_zero() const
Returns true if the memory descriptor describes an empty memory.
Definition: mkldnn.hpp:1390
Use scale and shift parameters.
Definition: mkldnn_types.h:737
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:4900
Max pooling.
Definition: mkldnn_types.h:685
Use scale and shift parameters.
5D CNN activations tensor, an alias to mkldnn_acdeb
Definition: mkldnn_types.h:356
mkldnn_status_t MKLDNN_API mkldnn_softmax_forward_desc_init(mkldnn_softmax_desc_t *softmax_desc, mkldnn_prop_kind_t prop_kind, const mkldnn_memory_desc_t *data_desc, int softmax_axis)
Initializes a softmax_desc for forward propagation using prop_kind (possible values are mkldnn_forwar...
permuted 5D tensor
Definition: mkldnn_types.h:194
mkldnn_status_t MKLDNN_API mkldnn_memory_desc_init_by_strides(mkldnn_memory_desc_t *memory_desc, int ndims, const mkldnn_dims_t dims, mkldnn_data_type_t data_type, const mkldnn_dims_t strides)
Initializes a memory_desc memory descriptor using ndims, dims, data_type, and strides.
memory::desc scratchpad_desc() const
Queries scratchpad memory descriptor.
Definition: mkldnn.hpp:1876
const post_ops get_post_ops() const
Returns post_ops previously set by set_post_ops.
Definition: mkldnn.hpp:710
5D CNN activations tensor blocked by channels with block size 8, an alias to mkldnn_aBcde8b ...
Definition: mkldnn_types.h:441
execution engine
Definition: mkldnn_types.h:1497
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_next(mkldnn_primitive_desc_iterator_t iterator)
Iterates over primitive descriptors.
convolution_backward_weights(const primitive_desc &pd)
Creates convolution weight update primitive from corresponding primitive descriptor.
Definition: mkldnn.hpp:2321
Pooling for forward propagation.
Definition: mkldnn.hpp:2886
mkldnn_status_t MKLDNN_API mkldnn_lrn_backward_desc_init(mkldnn_lrn_desc_t *lrn_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *diff_data_desc, const mkldnn_memory_desc_t *data_desc, mkldnn_dim_t local_size, float alpha, float beta, float k)
Initializes an lrn_desc for backward propagation using alg_kind, memory descriptors data_desc and dif...
5D CNN weights tensor, an alias to mkldnn_abcde
Definition: mkldnn_types.h:381
mkldnn_status_t MKLDNN_API mkldnn_convolution_backward_weights_desc_init(mkldnn_convolution_desc_t *conv_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *diff_weights_desc, const mkldnn_memory_desc_t *diff_bias_desc, const mkldnn_memory_desc_t *diff_dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a convolution descriptor conv_desc for backward propagation with respect to weights using...
Primitive descriptor for batch normalization backward propagation.
Definition: mkldnn.hpp:3382
memory::desc mean_desc() const
Queries mean memory descriptor.
Definition: mkldnn.hpp:3403
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:2481
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_create(mkldnn_primitive_attr_t *attr)
Creates an empty (default) attr attribute.
size_t MKLDNN_API mkldnn_memory_desc_get_size(const mkldnn_memory_desc_t *memory_desc)
Returns the size (in bytes) that is required for given memory_desc.
A convolution primitive.
deconvolution_backward_data(const primitive_desc &pd)
Creates a deconvolution backward propagation primitive from the corresponding primitive descriptor...
Definition: mkldnn.hpp:2593
mkldnn_status_t MKLDNN_API mkldnn_pooling_backward_desc_init(mkldnn_pooling_desc_t *pool_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *diff_src_desc, const mkldnn_memory_desc_t *diff_dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t kernel, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a pooling descriptor pool_desc for backward propagation using alg_kind, memory descriptors, and pooling parameters in the spatial domain: strides, kernel sizes, padding_l, and padding_r.
algorithm
Kinds of algorithms.
Definition: mkldnn.hpp:282
mkldnn_status_t MKLDNN_API mkldnn_dilated_convolution_backward_data_desc_init(mkldnn_convolution_desc_t *conv_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *diff_src_desc, const mkldnn_memory_desc_t *weights_desc, const mkldnn_memory_desc_t *diff_dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t dilates, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a dilated convolution descriptor conv_desc for backward propagation with respect to data ...
Default order execution.
5D CNN activations tensor blocked by channels with block size 4, an alias to mkldnn_aBcde4b ...
Definition: mkldnn_types.h:438
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:3760
A descriptor of a element-wise operation.
Definition: mkldnn_types.h:998
memory::desc diff_bias_desc() const
Queries diff bias memory descriptor.
Definition: mkldnn.hpp:2733
rnn descriptor
Definition: mkldnn_types.h:1526
desc(algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for convolution weight update with bias using aalgorithm, memory descriptors, strides, padding_l, and padding_r.
Definition: mkldnn.hpp:2184
An element-wise primitive.
Definition: mkldnn_types.h:627
desc(algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for deconvolution weight update without bias using aalgorithm, memory descriptors, strides, padding_l, and padding_r.
Definition: mkldnn.hpp:2637
Primitive descriptor for inner product backward propagation with respect to data. ...
Definition: mkldnn.hpp:3559
mkldnn_status_t MKLDNN_API mkldnn_primitive_execute(const_mkldnn_primitive_t primitive, mkldnn_stream_t stream, int nargs, const mkldnn_exec_arg_t *args)
Executes a primitive using a stream, and nargs arguments args.
Softmax for backward propagation.
Definition: mkldnn.hpp:3192
memory::desc src_iter_desc() const
Queries source iteration memory descriptor.
Definition: mkldnn.hpp:3742
mkldnn_status_t MKLDNN_API mkldnn_vanilla_rnn_forward_desc_init(mkldnn_rnn_desc_t *rnn_desc, mkldnn_prop_kind_t prop_kind, const mkldnn_alg_kind_t activation, const mkldnn_rnn_direction_t direction, const mkldnn_memory_desc_t *src_layer_desc, const mkldnn_memory_desc_t *src_iter_desc, const mkldnn_memory_desc_t *weights_layer_desc, const mkldnn_memory_desc_t *weights_iter_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_layer_desc, const mkldnn_memory_desc_t *dst_iter_desc, unsigned flags, float alpha, float beta)
Initializes an RNN descriptor rnn_desc for forward propagation using prop_kind, activation, direction, and memory descriptors.
Unidirectional execution of RNN primitive from left to right.
Definition: mkldnn_types.h:1171
lrn descriptor
desc(prop_kind aprop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, rnn_flags flags=rnn_flags::undef)
Initializes an LBR GRU descriptor for forward propagation using prop_kind, direction, and memory descriptors.
Definition: mkldnn.hpp:4602
Initializes an eltwise descriptor for backward propagation using aalgorithm algorithm memory descript...
Definition: mkldnn.hpp:3089
A descriptor for an RNN operation.
Definition: mkldnn_types.h:1184
execution engine
memory::desc diff_dst_layer_desc() const
Queries diff destination layer memory descriptor.
Definition: mkldnn.hpp:4557
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:3313
Implements primitive descriptor and primitive for concat.
Definition: mkldnn.hpp:1631
eltwise descriptor
Definition: mkldnn_types.h:1520
memory::desc src_iter_desc() const
Queries source recurrent hidden state memory descriptor.
Definition: mkldnn.hpp:4033
memory::desc diff_weights_layer_desc() const
Queries diff weights layer memory descriptor.
Definition: mkldnn.hpp:4829
3D CNN activations tensor, an alias to mkldnn_acb
Definition: mkldnn_types.h:346
mkldnn_status_t MKLDNN_API mkldnn_convolution_backward_data_desc_init(mkldnn_convolution_desc_t *conv_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *diff_src_desc, const mkldnn_memory_desc_t *weights_desc, const mkldnn_memory_desc_t *diff_dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a convolution descriptor conv_desc for backward propagation with respect to data using al...
scratchpad_mode get_scratchpad_mode() const
Returns the scratchpad mode.
Definition: mkldnn.hpp:658
deconvolution_forward(const primitive_desc &pd)
Creates a deconvolution forward propagation primitive from the corresponding primitive descriptor...
Definition: mkldnn.hpp:2495
primitive_desc(const desc &desc, const engine &e)
Initializes a primitive descriptor for convolution forward propagation.
Definition: mkldnn.hpp:2030
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_set_rnn_data_qparams(mkldnn_primitive_attr_t attr, const float scale, const float shift)
Sets quantization scale and shift for RNN data tensors.
size_t MKLDNN_API mkldnn_engine_get_count(mkldnn_engine_kind_t kind)
Returns the number of engines of a particular kind.
An opaque structure to describe a memory.
LSTM for forward propagation.
Definition: mkldnn.hpp:3964
3D CNN activations tensor, an alias to mkldnn_abc
Definition: mkldnn_types.h:344
format_kind
Memory format kind.
Definition: mkldnn.hpp:1021
Eltwise: soft_relu.
Definition: mkldnn_types.h:674
Primitive descriptor for convolution backward propagation.
Definition: mkldnn.hpp:2130
void set_post_ops(post_ops ops)
Sets post_ops for future use.
Definition: mkldnn.hpp:720
desc(prop_kind aprop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &diff_src_layer_desc, const memory::desc &diff_src_iter_desc, const memory::desc &diff_weights_layer_desc, const memory::desc &diff_weights_iter_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_layer_desc, const memory::desc &diff_dst_iter_desc, rnn_flags flags=rnn_flags::undef)
Initializes an LBR_GRU descriptor for backward propagation using prop_kind, direction, and memory descriptors.
Definition: mkldnn.hpp:4717
memory::desc diff_weights_iter_desc() const
Queries diff weights iteration memory descriptor.
Definition: mkldnn.hpp:4547
mkldnn_primitive_kind_t MKLDNN_API mkldnn_post_ops_get_kind(const_mkldnn_post_ops_t post_ops, int index)
Returns the kind of post operation with index index in given post_ops.
T get(bool allow_emtpy=false) const
Returns the value of the underlying C handle.
Definition: mkldnn.hpp:136
32-bit/single-precision floating point.
Forward data propagation, alias for mkldnn::prop_kind::forward_training.
RNN cell.
Definition: mkldnn_types.h:696
scratchpad memory desc
shuffle descriptor
desc(prop_kind aprop_kind, const memory::desc &diff_data_desc, const memory::desc &data_desc, float epsilon, normalization_flags flags)
Initializes a batch normalization descriptor for backward propagation with respect to data and scale-...
Definition: mkldnn.hpp:3368
softmax descriptor
Post operations.
Definition: mkldnn.hpp:560
A user shall query and provide the scratchpad memory to primitives.
Definition: mkldnn_types.h:1318
Eltwise: gelu.
Definition: mkldnn_types.h:683
convolution_forward(const primitive_desc &pd)
Creates a convolution forward propagation primitive from the corresponding primitive descriptor...
Definition: mkldnn.hpp:2066
Initializes an inner product descriptor for backward propagation with respect to data using memory de...
Definition: mkldnn.hpp:3544
Convolution forward propagation.
Definition: mkldnn.hpp:1905
Backward weights propagation.
Definition: mkldnn_types.h:604
memory::desc diff_weights_desc() const
Queries diff weights memory descriptor.
Definition: mkldnn.hpp:3642
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_set_output_scales(mkldnn_primitive_attr_t attr, mkldnn_dim_t count, int mask, const float *scales)
Sets output scales for primitive operations.
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:4226
format_tag
Memory format tag specification.
Definition: mkldnn.hpp:1039
32-bit/single-precision floating point.
Definition: mkldnn_types.h:76
6D CNN weights tensor (incl. groups), an alias to mkldnn_abcdef
Definition: mkldnn_types.h:398
desc(algorithm aalgorithm, const memory::desc &diff_src_desc, const memory::desc &weights_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &dilates, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes descriptor for dilated deconvolution backward propagation using aalgorithm, memory descriptors, strides, padding_l, and padding_r.
Definition: mkldnn.hpp:2537
Memory descriptor.
Definition: mkldnn_types.h:865
memory::desc weights_desc() const
Queries weights memory descriptor.
Definition: mkldnn.hpp:3512
Initializes an inner product descriptor for forward propagation using prop_kind (possible values are ...
Definition: mkldnn.hpp:3472
memory::desc weights_iter_desc() const
Queries weights iteration memory descriptor.
Definition: mkldnn.hpp:4495
memory::desc diff_dst_layer_desc() const
Queries diff destination layer memory descriptor.
Definition: mkldnn.hpp:4265
mkldnn_status_t MKLDNN_API mkldnn_inner_product_backward_data_desc_init(mkldnn_inner_product_desc_t *ip_desc, const mkldnn_memory_desc_t *diff_src_desc, const mkldnn_memory_desc_t *weights_desc, const mkldnn_memory_desc_t *diff_dst_desc)
Initializes an inner product descriptor ip_desc for backward propagation with respect to data using m...
Packed weights format used in RNN.
memory::desc weights_iter_desc() const
Queries weights iteration memory descriptor.
Definition: mkldnn.hpp:4193
Base class for all computational primitives.
Definition: mkldnn.hpp:174
memory::desc weights_desc() const
Queries weights memory descriptor.
Definition: mkldnn.hpp:3576
C API.
memory::desc weights_desc() const
Queries weights (scale and shift) memory descriptor.
Definition: mkldnn.hpp:3308
memory::desc src_layer_desc() const
Queries source layer memory descriptor.
Definition: mkldnn.hpp:4476
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:2738
Inner product for forward propagation.
Definition: mkldnn.hpp:3461
3D CNN activations tensor blocked by channels with block size 8, an alias to mkldnn_aBc8b ...
Definition: mkldnn_types.h:459
memory::desc src_layer_desc() const
Queries source layer memory descriptor.
Definition: mkldnn.hpp:4763
pooling descriptor
Definition: mkldnn_types.h:1522
Descriptor for pooling backward propagation.
Definition: mkldnn.hpp:2954
prop_kind
Propagation kind.
Definition: mkldnn.hpp:253
Default stream configuration.
mkldnn_format_tag_t
Memory format tag specification.
Definition: mkldnn_types.h:170
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:3525
5D RNN weights tensor in the format (num_layers, num_directions, num_gates, output_channels, input_channels).
Definition: mkldnn_types.h:420
memory::desc weights_layer_desc() const
Queries weights layer memory descriptor.
Definition: mkldnn.hpp:4490
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:4376
memory::desc dst_layer_desc() const
Queries destination layer memory descriptor.
Definition: mkldnn.hpp:4668
mkldnn_status_t MKLDNN_API mkldnn_dilated_deconvolution_backward_weights_desc_init(mkldnn_deconvolution_desc_t *conv_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *diff_weights_desc, const mkldnn_memory_desc_t *diff_bias_desc, const mkldnn_memory_desc_t *diff_dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t dilates, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a dilated deconvolution descriptor conv_desc for backward propagation with respect to wei...
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_create(mkldnn_primitive_desc_iterator_t *iterator, const_mkldnn_op_desc_t op_desc, const_mkldnn_primitive_attr_t attr, mkldnn_engine_t engine, const_mkldnn_primitive_desc_t hint_forward_primitive_desc)
Creates a primitive descriptor iterator for given op_desc, attr, engine, and optionally a hint primit...
memory::desc diff_dst_iter_desc() const
Queries diff destination iteration memory descriptor.
Definition: mkldnn.hpp:4565
The operation was successful.
Definition: mkldnn_types.h:52
Primitive descriptor for LSTM forward propagation.
Definition: mkldnn.hpp:4015
mkldnn_status_t MKLDNN_API mkldnn_engine_create(mkldnn_engine_t *engine, mkldnn_engine_kind_t kind, size_t index)
Creates an engine of particular kind and index.
primitive_desc(const desc &desc, const engine &e, const convolution_forward::primitive_desc &hint_fwd_pd)
Initializes a primitive descriptor for convolution weight update.
Definition: mkldnn.hpp:2286
LBR_GRU for forward propagation.
Definition: mkldnn.hpp:4579
primitive_desc(const_mkldnn_op_desc_t desc, const primitive_attr *attr, const engine &e, const_mkldnn_primitive_desc_t hint_fwd_pd)
Creates a primitive descriptor from given op_desc, attr, engine, and optionally a hint primitive desc...
Definition: mkldnn.hpp:1798
desc(algorithm aalgorithm, const memory::desc &diff_src_desc, const memory::desc &weights_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &dilates, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for dilated convolution backward propagation using aalgorithm, memory descriptors, strides, padding_l, and padding_r.
Definition: mkldnn.hpp:2108
4D CNN weights tensor, an alias to mkldnn_abcd
Definition: mkldnn_types.h:371
Backward propagation (with respect to all parameters).
Definition: mkldnn_types.h:600
desc(algorithm aalgorithm, const memory::desc &diff_src_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &kernel, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a pooling descriptor for backward propagation using aalgorithm, memory descriptors...
Definition: mkldnn.hpp:2960
permuted 3D tensor
Definition: mkldnn_types.h:203
memory::desc src_iter_desc() const
Queries source iteration memory descriptor.
Definition: mkldnn.hpp:4357
softmax descriptor
Definition: mkldnn_types.h:1521
desc(prop_kind aprop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &diff_src_layer_desc, const memory::desc &diff_src_iter_desc, const memory::desc &diff_weights_layer_desc, const memory::desc &diff_weights_iter_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_layer_desc, const memory::desc &diff_dst_iter_desc, rnn_flags flags=rnn_flags::undef)
Initializes an GRU descriptor for backward propagation using prop_kind, direction, and memory descriptors.
Definition: mkldnn.hpp:4430
A deconvolution primitive.
Definition: mkldnn_types.h:625
desc(prop_kind aprop_kind, algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &dst_desc, const memory::dims &strides, const memory::dims &kernel, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a pooling descriptor for forward propagation using aprop_kind (possible values are mkldnn...
Definition: mkldnn.hpp:2897
3D RNN data tensor in the format (batch, seq_length, input channels).
Definition: mkldnn_types.h:403
Definition: mkldnn.hpp:41
3D tensor blocked by 2nd dimension with block size 16
Definition: mkldnn_types.h:213
no query
Definition: mkldnn_types.h:1495
Initializes an inner product descriptor for backward propagation with respect to weights using memory...
Definition: mkldnn.hpp:3600
Descriptor for convolution forward propagation.
Definition: mkldnn.hpp:2339
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:3180
RNN descriptor for backward propagation.
Definition: mkldnn.hpp:3796
Default stream configuration.
Definition: mkldnn_types.h:1556
desc(prop_kind aprop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &src_iter_c_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &dst_iter_c_desc, rnn_flags flags=rnn_flags::undef)
Initializes an LSTM descriptor for forward propagation using prop_kind, direction, and memory descriptors.
Definition: mkldnn.hpp:3987
8-bit unsigned integer.
Definition: mkldnn_types.h:82
memory::desc dst_layer_desc() const
Queries destination layer memory descriptor.
Definition: mkldnn.hpp:4206
Average pooling include padding.
Definition: mkldnn_types.h:687
A tensor in a generic format described by the stride and blocking values in each dimension.
Definition: mkldnn_types.h:95
Primitive descriptor for local response normalization forward propagation.
Definition: mkldnn.hpp:2785
permuted 4D tensor
Definition: mkldnn_types.h:195
mkldnn_status_t MKLDNN_API mkldnn_lbr_gru_forward_desc_init(mkldnn_rnn_desc_t *rnn_desc, mkldnn_prop_kind_t prop_kind, mkldnn_rnn_direction_t direction, const mkldnn_memory_desc_t *src_layer_desc, const mkldnn_memory_desc_t *src_iter_desc, const mkldnn_memory_desc_t *weights_layer_desc, const mkldnn_memory_desc_t *weights_iter_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_layer_desc, const mkldnn_memory_desc_t *dst_iter_desc, unsigned flags)
Initializes an LBR GRU descriptor rnn_desc for forward propagation using prop_kind, direction, and memory descriptors.
permuted 4D tensor
Definition: mkldnn_types.h:201
memory::desc src_iter_desc() const
Queries source iteration memory descriptor.
Definition: mkldnn.hpp:4644
Eltwise: hyperbolic tangent non-linearity (tanh)
Local response normalization (LRN) across multiple channels.
Definition: mkldnn_types.h:692
Fuse with ReLU.
Definition: mkldnn_types.h:746
GRU cell.
Definition: mkldnn_types.h:700
void set_output_scales(int mask, const std::vector< float > &scales)
Sets output scales for primitive operations.
Definition: mkldnn.hpp:703
implementation name
Definition: mkldnn_types.h:1512
4D CNN activations tensor, an alias to mkldnn_abcd
Definition: mkldnn_types.h:348
desc(prop_kind aprop_kind, algorithm activation, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, rnn_flags flags=rnn_flags::undef, float alpha=0.0f, float beta=0.0f)
Initializes an RNN descriptor for forward propagation using prop_kind, activation, direction, and memory descriptors.
Definition: mkldnn.hpp:3698
3D RNN data tensor in the format (seq_length, batch, input channels).
Definition: mkldnn_types.h:401
memory::desc weights_layer_desc() const
Queries weights layer memory descriptor.
Definition: mkldnn.hpp:4044
Descriptor for convolution forward propagation.
Definition: mkldnn.hpp:1908
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:3418
memory::desc src_iter_desc() const
Queries source iteration memory descriptor.
Definition: mkldnn.hpp:3872
6D tensor blocked by 2nd dimension with block size 4
Definition: mkldnn_types.h:293
Eltwise: parametric exponential linear unit (elu)
Definition: mkldnn_types.h:662
Just a sentinel, not real memory format tag.
Definition: mkldnn_types.h:333
kind
Kinds of engines.
Definition: mkldnn.hpp:787
Descriptor for local response normalization backward propagation.
Definition: mkldnn.hpp:2822
Inner product for backward propagation with respect to data.
Definition: mkldnn.hpp:3537
Intel(R) MKL-DNN exception class.
Definition: mkldnn.hpp:53
desc(prop_kind aprop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, rnn_flags flags=rnn_flags::undef)
Initializes a GRU descriptor for forward propagation using prop_kind, direction, and memory descripto...
Definition: mkldnn.hpp:4315
memory::desc diff_src_desc() const
Queries diff source memory descriptor.
Definition: mkldnn.hpp:3120
Eltwise: ReLU.
Definition: mkldnn_types.h:658
mkldnn_status_t MKLDNN_API mkldnn_memory_create(mkldnn_memory_t *memory, const mkldnn_memory_desc_t *memory_desc, mkldnn_engine_t engine, void *handle)
Creates a memory for given memory_desc and engine.
Softmax for forward propagation.
Definition: mkldnn.hpp:3146
Out-of-order execution.
Definition: mkldnn_types.h:1554
number of outputs expected
memory::desc src_iter_desc() const
Queries source iter memory descriptor.
Definition: mkldnn.hpp:4484
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:3520
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:4790
memory::desc weights_iter_desc() const
Queries weights iteration memory descriptor.
Definition: mkldnn.hpp:4655
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e, const batch_normalization_forward::primitive_desc &hint_fwd_pd)
Initializes a primitive descriptor for batch normalization backward propagation with attributes defin...
Definition: mkldnn.hpp:3393
memory::desc weights_desc() const
Queries weights memory descriptor.
Definition: mkldnn.hpp:2044
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_set_post_ops(mkldnn_primitive_attr_t attr, const_mkldnn_post_ops_t post_ops)
Sets configured post_ops to an attribute attr for future use (when primitive descriptor is being crea...
rnn descriptor
Descriptor for RNN forward propagation.
Definition: mkldnn.hpp:3677
memory::desc diff_bias_desc() const
Queries diff bias memory descriptor.
Definition: mkldnn.hpp:4839
scratchpad_mode
Scratchpad mode.
Definition: mkldnn.hpp:241
scratchpad memory desc
Definition: mkldnn_types.h:1538
Eltwise: square.
Definition: mkldnn_types.h:664
Creates an out-of-place sum primitive descriptor for sum of n inputs multiplied by the scale with res...
Definition: mkldnn.hpp:1710
flags
Stream flags.
Definition: mkldnn.hpp:910
mkldnn_status_t MKLDNN_API mkldnn_eltwise_forward_desc_init(mkldnn_eltwise_desc_t *eltwise_desc, mkldnn_prop_kind_t prop_kind, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *data_desc, float alpha, float beta)
Initializes an eltwise_desc for forward propagation using prop_kind (possible values are mkldnn_forwa...
5D tensor blocked by 2nd dimension with block size 8
Definition: mkldnn_types.h:276
desc(algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &dilates, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for dilated deconvolution weight update with bias using aalgorithm, memory descriptors, strides, dilates padding_l, and padding_r.
Definition: mkldnn.hpp:2660
Eltwise: parametric exponential linear unit (elu)
memory::desc diff_src_layer_desc() const
Queries diff source layer memory descriptor.
Definition: mkldnn.hpp:4816
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:3175
Backward bias propagation.
Definition: mkldnn_types.h:606
memory::desc src_iter_c_desc() const
Queries source recurrent cell state memory descriptor.
Definition: mkldnn.hpp:4039
Initializes a reorder primitive using the description of the source (src_engine and src_md) and desti...
Definition: mkldnn.hpp:1550
query
Primitive descriptor query specification.
Definition: mkldnn.hpp:467
memory::desc dst_iter_c_desc() const
Queries destination recurrent cell state memory descriptor.
Definition: mkldnn.hpp:4075
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_query(const_mkldnn_primitive_desc_t primitive_desc, mkldnn_query_t what, int index, void *result)
Queries primitive descriptor.
memory::desc src_layer_desc() const
Queries source layer memory descriptor.
Definition: mkldnn.hpp:3864
memory::desc weights_desc() const
Queries weights memory descriptor.
Definition: mkldnn.hpp:2151
A descriptor of a shuffle operation.
Definition: mkldnn_types.h:981
void get_params_eltwise(int index, float &scale, algorithm &alg, float &alpha, float &beta) const
Gets the eltwise parameters of the post operation with index index.
Definition: mkldnn.hpp:629
scratchpad engine – engine to be used for creating scratchpad memory
Definition: mkldnn_types.h:1509
permuted 5D tensor
Definition: mkldnn_types.h:196
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:2800
primitive_desc(const desc &desc, const engine &e, const deconvolution_forward::primitive_desc &hint_fwd_pd)
Initializes a primitive descriptor for deconvolution weight update.
Definition: mkldnn.hpp:2712
convolution_backward_data(const primitive_desc &pd)
Creates a convolution backward propagation primitive from the corresponding primitive descriptor...
Definition: mkldnn.hpp:2165
Primitive attributes.
Definition: mkldnn.hpp:648
5D CNN activations tensor, an alias to mkldnn_abcde
Definition: mkldnn_types.h:354
Primitive descriptor for deconvolution backward propagation.
Definition: mkldnn.hpp:2558
Average pooling exclude padding.
weights grad. memory desc
int ndims
Number of dimensions.
Definition: mkldnn_types.h:867
Local response normalization for forward propagation.
Definition: mkldnn.hpp:2762
kind
Kinds of primitives.
Definition: mkldnn.hpp:181
memory::desc mean_desc() const
Queries mean memory descriptor.
Definition: mkldnn.hpp:3325
An opaque structure to describe an execution stream.
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:3507
Primitive descriptor for LBR_GRU backward propagation.
Definition: mkldnn.hpp:4751
memory::desc diff_dst_iter_desc() const
Queries diff destination recurrent hidden state memory descriptor.
Definition: mkldnn.hpp:4273
6D tensor blocked by 2nd dimension with block size 16
Definition: mkldnn_types.h:289
mkldnn_status_t MKLDNN_API mkldnn_eltwise_backward_desc_init(mkldnn_eltwise_desc_t *eltwise_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *diff_data_desc, const mkldnn_memory_desc_t *data_desc, float alpha, float beta)
Initializes an eltwise_desc for backward propagation using alg_kind algorithm memory descriptors diff...
mkldnn_stream_flags_t
Stream flags.
Definition: mkldnn_types.h:1547
Descriptor for shuffle forward propagation.
Definition: mkldnn.hpp:4876
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:3125
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_destroy(mkldnn_primitive_desc_iterator_t iterator)
Deletes a primitive descriptor iterator.
Primitive descriptor for local response normalization backward propagation.
Definition: mkldnn.hpp:2841
mkldnn_scratchpad_mode_t
Scratchpad mode.
Definition: mkldnn_types.h:1314
memory::desc query_md(query what, int idx=0) const
Queries and returns requested memory descriptor.
Definition: mkldnn.hpp:1859
mkldnn_status_t MKLDNN_API mkldnn_post_ops_append_sum(mkldnn_post_ops_t post_ops, float scale)
Appends accumulation (sum) post operation to the post_ops.
Convolution weight update.
Definition: mkldnn.hpp:2172
3D CNN activations tensor blocked by channels with block size 16, an alias to mkldnn_aBc16b ...
Definition: mkldnn_types.h:453
A rnn primitive.
Definition: mkldnn_types.h:639
mkldnn_status_t MKLDNN_API mkldnn_dilated_convolution_forward_desc_init(mkldnn_convolution_desc_t *conv_desc, mkldnn_prop_kind_t prop_kind, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *weights_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t dilates, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a dilated convolution descriptor conv_desc for forward propagation using prop_kind (possi...
desc(algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for convolution weight update without bias using aalgorithm, memory descriptors, strides, padding_l, and padding_r.
Definition: mkldnn.hpp:2209
A deconvolution primitive.
Descriptor for LSTM forward propagation.
Definition: mkldnn.hpp:3967
mkldnn_prop_kind_t
Kinds of propagation.
Definition: mkldnn_types.h:584
CPU engine.
Definition: mkldnn_types.h:1260
Eltwise: square root.
Definition: mkldnn_types.h:668
An unspecified engine.
permuted 3D tensor
Definition: mkldnn_types.h:198
Undefined data type, used for empty memory descriptors.
mkldnn_status_t MKLDNN_API mkldnn_memory_destroy(mkldnn_memory_t memory)
Deletes a memory.
Winograd convolution.
Definition: mkldnn_types.h:650
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:4810
Eltwise: linear.
Definition: mkldnn_types.h:670
memory::desc diff_bias_desc() const
Queries diff bias memory descriptor.
Definition: mkldnn.hpp:3647
desc(algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &dilates, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for dilated convolution weight update without bias using aalgorithm...
Definition: mkldnn.hpp:2259
non-standard 16-bit (bfloat16 w/ 7 bit mantissa) floating point.
Definition: mkldnn_types.h:74
memory::desc diff_weights_layer_desc() const
Queries diff weights layer memory descriptor.
Definition: mkldnn.hpp:4542
mkldnn_status_t MKLDNN_API mkldnn_softmax_backward_desc_init(mkldnn_softmax_desc_t *softmax_desc, const mkldnn_memory_desc_t *diff_desc, const mkldnn_memory_desc_t *data_desc, int softmax_axis)
Initializes a softmax_desc for backward propagation using memory descriptors diff_desc and data_desc...
mkldnn_status_t MKLDNN_API mkldnn_memory_set_data_handle(mkldnn_memory_t memory, void *handle)
For a memory, sets the data handle.
memory::desc weights_iter_desc() const
Queries weights iteration memory descriptor.
Definition: mkldnn.hpp:4049
Eltwise: logistic.
Definition: mkldnn_types.h:676
Batch normalization backward propagation.
Definition: mkldnn.hpp:3354
Direct convolution.
Definition: mkldnn_types.h:648
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:3115
Primitive iterator passed over last primitive descriptor.
Definition: mkldnn_types.h:60
convolution descriptor
mkldnn_status_t MKLDNN_API mkldnn_memory_map_data(const_mkldnn_memory_t memory, void **mapped_ptr)
For a memory, maps the data of the memory to mapped_ptr.
memory::desc weights_desc() const
Queries weights (scale and shift) memory descriptor.
Definition: mkldnn.hpp:3413
Descriptor for convolution backward propagation.
Definition: mkldnn.hpp:2076
2D CNN activations tensor, an alias to mkldnn::memory::format_tag::ab
An opaque structure for primitive descriptor attributes.
memory::desc diff_weights_iter_desc() const
Queries diff weights iteration memory descriptor.
Definition: mkldnn.hpp:3933
memory::desc src_layer_desc() const
Queries source layer memory descriptor.
Definition: mkldnn.hpp:3734
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:3910
mkldnn_status_t MKLDNN_API mkldnn_shuffle_forward_desc_init(mkldnn_shuffle_desc_t *shuffle_desc, mkldnn_prop_kind_t prop_kind, const mkldnn_memory_desc_t *data_desc, int axis, mkldnn_dim_t group_size)
Initializes a shuffle_desc for forward propagation using prop_kind, memory descriptor data_desc...
plain 3D tensor
Definition: mkldnn_types.h:185
LRN within a single channel.
runtime estimation (seconds)
Definition: mkldnn_types.h:1503
memory::desc diff_weights_desc() const
Queries diff weights (scale and shift) memory descriptor.
Definition: mkldnn.hpp:3440
Primitive descriptor for convolution weight update.
Definition: mkldnn.hpp:2282
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:2723
mkldnn_status_t MKLDNN_API mkldnn_shuffle_backward_desc_init(mkldnn_shuffle_desc_t *shuffle_desc, const mkldnn_memory_desc_t *diff_data_desc, int axis, mkldnn_dim_t group_size)
Initializes a shuffle_desc for backward propagation using memory descriptor diff_data_desc, axis, and group_size.
An element-wise primitive.
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:2057
4D CNN weights tensor, an alias to mkldnn_bcda
Definition: mkldnn_types.h:377
memory::desc weights_layer_desc() const
Queries weights layer memory descriptor.
Definition: mkldnn.hpp:3877
memory::desc diff_src_iter_desc() const
Queries diff source iteration memory descriptor.
Definition: mkldnn.hpp:4537
Unidirectional execution of RNN primitive from right to left.
Definition: mkldnn_types.h:1173
4D CNN activations tensor, an alias to mkldnn::memory::format_tag::acdb
GRU cell with linear before reset.
Definition: mkldnn_types.h:708
desc(const dims &adims, data_type adata_type, format_tag aformat_tag)
Constructs a memory descriptor.
Definition: mkldnn.hpp:1344
LSTM cell.
Definition: mkldnn_types.h:698
mkldnn_status_t MKLDNN_API mkldnn_batch_normalization_backward_desc_init(mkldnn_batch_normalization_desc_t *bnrm_desc, mkldnn_prop_kind_t prop_kind, const mkldnn_memory_desc_t *diff_data_desc, const mkldnn_memory_desc_t *data_desc, float epsilon, unsigned flags)
Initializes a batch normalization descriptor bnrm_desc for backward propagation with respect to data ...
4D CNN activations tensor, an alias to mkldnn::memory::format_tag::abcd
Backward propagation (with respect to all parameters).
memory::desc diff_dst_iter_desc() const
Queries diff destination iteration memory descriptor.
Definition: mkldnn.hpp:4852
memory::desc diff_weights_iter_desc() const
Queries diff weights iteration memory descriptor.
Definition: mkldnn.hpp:4255
primitive_desc(const desc &desc, const engine &e)
Initializes a primitive descriptor for batch normalization forward propagation.
Definition: mkldnn.hpp:3294
desc(prop_kind aprop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &src_iter_c_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &dst_iter_c_desc, const memory::desc &diff_src_layer_desc, const memory::desc &diff_src_iter_desc, const memory::desc &diff_src_iter_c_desc, const memory::desc &diff_weights_layer_desc, const memory::desc &diff_weights_iter_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_layer_desc, const memory::desc &diff_dst_iter_desc, const memory::desc &diff_dst_iter_c_desc, rnn_flags flags=rnn_flags::undef)
Initializes an LSTM descriptor for backward propagation using prop_kind, direction, and memory descriptors.
Definition: mkldnn.hpp:4119
stream(const engine &aengine, flags aflags=flags::default_flags)
Constructs a stream.
Definition: mkldnn.hpp:925
Undefined data type, used for empty memory descriptors.
Definition: mkldnn_types.h:70
memory::desc diff_weights_desc() const
Queries diff weights memory descriptor.
Definition: mkldnn.hpp:2302
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:3780
memory::desc dst_iter_c_desc() const
Queries destination recurrent cell state memory descriptor.
Definition: mkldnn.hpp:4219
Deconvolution backward propagation.
Definition: mkldnn.hpp:2502
Initializes an eltwise descriptor for forward propagation using prop_kind (possible values are mkldnn...
Definition: mkldnn.hpp:3043
A shuffle primitive.
Definition: mkldnn_types.h:617
4D CNN activations tensor, an alias to mkldnn_acdb
Definition: mkldnn_types.h:350
size_t get_size() const
Returns the number of bytes required to allocate the memory described including the padding area...
Definition: mkldnn.hpp:1387
int len() const
Returns the length of post operations.
Definition: mkldnn.hpp:570
memory::desc variance_desc() const
Queries variance memory descriptor.
Definition: mkldnn.hpp:3330
destination grad. memory desc
Definition: mkldnn_types.h:1536
pooling descriptor
#define MKLDNN_MAX_NDIMS
Maximum number of dimensions a tensor can have.
Definition: mkldnn_types.h:757
desc(algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &dilates, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for dilated deconvolution weight update without bias using aalgorithm...
Definition: mkldnn.hpp:2687
mkldnn_status_t MKLDNN_API mkldnn_primitive_get_primitive_desc(const_mkldnn_primitive_t primitive, const_mkldnn_primitive_desc_t *primitive_desc)
Retrieves a reference to the primitive_desc descriptor of given primitive.
mkldnn_normalization_flags_t
Flags for batch normalization primitive.
Definition: mkldnn_types.h:712
mkldnn_status_t MKLDNN_API mkldnn_post_ops_get_params_eltwise(const_mkldnn_post_ops_t post_ops, int index, float *scale, mkldnn_alg_kind_t *alg, float *alpha, float *beta)
Gets the eltwise parameters of the post operation with index index in the sequence of post_ops...
Primitive descriptor for deconvolution forward propagation.
Definition: mkldnn.hpp:2454
mkldnn_status_t MKLDNN_API mkldnn_reorder_primitive_desc_create(mkldnn_primitive_desc_t *reorder_primitive_desc, const mkldnn_memory_desc_t *src_md, mkldnn_engine_t src_engine, const mkldnn_memory_desc_t *dst_md, mkldnn_engine_t dst_engine, const_mkldnn_primitive_attr_t attr)
Initializes a reorder_primitive_desc using the description of the source (src_engine and src_md) and ...
permuted 5D tensor
Definition: mkldnn_types.h:192
Primitive descriptor for inner product backward propagation with respect to weights.
Definition: mkldnn.hpp:3625
mkldnn_status_t MKLDNN_API mkldnn_post_ops_get_params_sum(const_mkldnn_post_ops_t post_ops, int index, float *scale)
Gets the parameters of the accumulation (sum) post operation with index index in the sequence of post...
A (out-of-place) concat primitive.
Definition: mkldnn_types.h:619
memory::desc diff_dst_layer_desc() const
Queries diff destination layer memory descriptor.
Definition: mkldnn.hpp:3943
memory::desc diff_src_layer_desc() const
Queries diff source layer memory descriptor.
Definition: mkldnn.hpp:4529
8-bit signed integer.
memory::desc diff_src_iter_c_desc() const
Queries diff source recurrent cell state memory descriptor.
Definition: mkldnn.hpp:4245
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:2468
mkldnn_status_t MKLDNN_API mkldnn_stream_wait(mkldnn_stream_t stream)
Waits for all primitives in the execution stream to finish.
static size_t get_count(kind akind)
Returns the number of engines of a certain kind.
Definition: mkldnn.hpp:801
memory::desc dst_layer_desc() const
Queries destination layer memory descriptor.
Definition: mkldnn.hpp:4795
mkldnn_query_t
Primitive descriptor query specification.
Definition: mkldnn_types.h:1494
A descriptor of a Batch Normalization operation.
Definition: mkldnn_types.h:1107
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:4663
workspace memory desc
Definition: mkldnn_types.h:1537
engine get_engine() const
Returns the engine of the memory.
Definition: mkldnn.hpp:1429
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:3072
memory::desc weights_desc() const
Queries weights memory descriptor.
Definition: mkldnn.hpp:2579
mkldnn_status_t MKLDNN_API mkldnn_dilated_deconvolution_backward_data_desc_init(mkldnn_deconvolution_desc_t *conv_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *diff_src_desc, const mkldnn_memory_desc_t *weights_desc, const mkldnn_memory_desc_t *diff_dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t dilates, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a dilated deconvolution descriptor conv_desc for backward propagation with respect to dat...
A sum primitive.
Definition: mkldnn_types.h:621
memory::desc weights_iter_desc() const
Queries weights iteration memory descriptor.
Definition: mkldnn.hpp:4368
memory::dim query_s64(query q) const
Queries the memory::dim value (same as int64_t)
Definition: mkldnn.hpp:1835
A user shall query and provide the scratchpad memory to primitives.
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:3423
normalization_flags
Flags for batch normalization primitive.
Definition: mkldnn.hpp:352
Primitive descriptor for GRU forward propagation.
Definition: mkldnn.hpp:4339
GRU descriptor for backward propagation.
Definition: mkldnn.hpp:4412
Undefined memory format kind, used for empty memory descriptors.
Definition: mkldnn_types.h:88
Convolution algorithm(either direct or Winograd) is chosen just in time.
Definition: mkldnn_types.h:652
memory::desc src_layer_desc() const
Queries source layer memory descriptor.
Definition: mkldnn.hpp:4025
memory::desc src_layer_desc() const
Queries source layer memory descriptor.
Definition: mkldnn.hpp:4169
memory consumption – extra (scratch) memory, additional to all inputs and outputs memory (bytes) ...
Definition: mkldnn_types.h:1504
An batch normalization primitive.
Definition: mkldnn_types.h:635
memory::desc weights_layer_desc() const
Queries weights layer memory descriptor.
Definition: mkldnn.hpp:4777
A class for wrapping an Intel(R) MKL-DNN handle.
Definition: mkldnn.hpp:94
memory::desc weights_iter_desc() const
Queries weights iteration memory descriptor.
Definition: mkldnn.hpp:3752
engine(kind akind, size_t index)
Constructs an engine.
Definition: mkldnn.hpp:811
desc(const dims &adims, data_type adata_type, const dims &astrides)
Constructs a memory descriptor by strides.
Definition: mkldnn.hpp:1358
The library manages scratchpad (default)
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_get_scratchpad_mode(const_mkldnn_primitive_attr_t attr, mkldnn_scratchpad_mode_t *mode)
Returns the scratchpad mode set in the attribute attr.
Element-wise operations for forward propagation.
Definition: mkldnn.hpp:3037
desc(algorithm aalgorithm, const memory::desc &data_desc, const memory::desc &diff_data_desc, memory::dim local_size, float alpha, float beta, float k=1.f)
Initializes a descriptor for backward propagation using aalgorithm, memory descriptors data_desc and ...
Definition: mkldnn.hpp:2829
8-bit unsigned integer.
A descriptor of a pooling operation.
Definition: mkldnn_types.h:1048
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:2941
5D CNN weights tensor, an alias to mkldnn_cdeba
Definition: mkldnn_types.h:383
An execution stream.
Definition: mkldnn.hpp:906
1D tensor, an alias to mkldnn_a
Definition: mkldnn_types.h:338
mkldnn_status_t MKLDNN_API mkldnn_lstm_backward_desc_init(mkldnn_rnn_desc_t *rnn_desc, mkldnn_prop_kind_t prop_kind, mkldnn_rnn_direction_t direction, const mkldnn_memory_desc_t *src_layer_desc, const mkldnn_memory_desc_t *src_iter_desc, const mkldnn_memory_desc_t *src_iter_c_desc, const mkldnn_memory_desc_t *weights_layer_desc, const mkldnn_memory_desc_t *weights_iter_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_layer_desc, const mkldnn_memory_desc_t *dst_iter_desc, const mkldnn_memory_desc_t *dst_iter_c_desc, const mkldnn_memory_desc_t *diff_src_layer_desc, const mkldnn_memory_desc_t *diff_src_iter_desc, const mkldnn_memory_desc_t *diff_src_iter_c_desc, const mkldnn_memory_desc_t *diff_weights_layer_desc, const mkldnn_memory_desc_t *diff_weights_iter_desc, const mkldnn_memory_desc_t *diff_bias_desc, const mkldnn_memory_desc_t *diff_dst_layer_desc, const mkldnn_memory_desc_t *diff_dst_iter_desc, const mkldnn_memory_desc_t *diff_dst_iter_c_desc, unsigned flags)
Initializes an LSTM descriptor rnn_desc for backward propagation using prop_kind, direction...
mkldnn_status_t MKLDNN_API mkldnn_concat_primitive_desc_create(mkldnn_primitive_desc_t *concat_primitive_desc, const mkldnn_memory_desc_t *dst_md, int n, int concat_dimension, const mkldnn_memory_desc_t *src_mds, const_mkldnn_primitive_attr_t attr, mkldnn_engine_t engine)
Creates out-of-place concat_primitive_desc for concatenation of n inputs by concat_dimension with res...
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_set_scratchpad_mode(mkldnn_primitive_attr_t attr, mkldnn_scratchpad_mode_t mode)
Sets scratchpad mode.
An batch normalization primitive.
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e, const deconvolution_forward::primitive_desc &hint_fwd_pd)
Initializes a primitive descriptor for deconvolution weight update with attributes defined by attr...
Definition: mkldnn.hpp:2718
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:3005
const char * impl_info_str() const
Returns implementation name.
Definition: mkldnn.hpp:1826
deconvolution descriptor
Definition: mkldnn_types.h:1518
memory::desc dst_iter_desc() const
Queries destination recurrent hidden state memory descriptor.
Definition: mkldnn.hpp:4214
Forward data propagation (inference mode).
desc(prop_kind aprop_kind, const memory::desc &src_desc, float epsilon, normalization_flags flags)
Initializes a batch normalization descriptor for forward propagation using prop_kind (possible values...
Definition: mkldnn.hpp:3277
destination memory desc
memory(const desc &md, const engine &aengine)
Constructs a memory.
Definition: mkldnn.hpp:1417
mkldnn_memory_desc_t data
The underlying C API data structure.
Definition: mkldnn.hpp:1334
mkldnn_primitive_desc_t MKLDNN_API mkldnn_primitive_desc_iterator_fetch(const_mkldnn_primitive_desc_iterator_t iterator)
Fetches the current primitive descriptor.
memory::desc src_iter_c_desc() const
Queries source recurrent cell state memory descriptor.
Definition: mkldnn.hpp:4183
Weights format used in 8bit Winograd convolution.
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
Initializes a primitive descriptor for convolution forward propagation with attributes defined by att...
Definition: mkldnn.hpp:2035
8-bit signed integer.
Definition: mkldnn_types.h:80
Primitive descriptor for eltwise forward propagation.
Definition: mkldnn.hpp:3056
mkldnn_primitive_kind_t
Kinds of primitives.
Definition: mkldnn_types.h:611
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e, const deconvolution_forward::primitive_desc &hint_fwd_pd)
Initializes a primitive descriptor for deconvolution backward propagation with attributes defined by ...
Definition: mkldnn.hpp:2569
Primitive descriptor for shuffle forward propagation.
Definition: mkldnn.hpp:4892
Winograd deconvolution.
Definition: mkldnn_types.h:656
desc(prop_kind aprop_kind, algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &dst_desc, const memory::dims &strides, const memory::dims &dilates, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for dilated convolution forward propagation with bias using prop_kind (possi...
Definition: mkldnn.hpp:2002
3D tensor blocked by 2nd dimension with block size 4
Definition: mkldnn_types.h:217
number of inputs expected
Definition: mkldnn_types.h:1500
memory::desc diff_weights_iter_desc() const
Queries diff weights iteration memory descriptor.
Definition: mkldnn.hpp:4834
Forward data propagation (training mode).
mkldnn_rnn_flags_t
Flags for RNN cell.
Definition: mkldnn_types.h:1164
memory::desc src_layer_desc() const
Queries source layer memory descriptor.
Definition: mkldnn.hpp:4349
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:3303
16-bit/half-precision floating point.
Definition: mkldnn_types.h:72
handle(T t, bool weak=false)
Constructs a C handle wrapper.
Definition: mkldnn.hpp:108
mkldnn_status_t MKLDNN_API mkldnn_deconvolution_backward_weights_desc_init(mkldnn_deconvolution_desc_t *conv_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *diff_weights_desc, const mkldnn_memory_desc_t *diff_bias_desc, const mkldnn_memory_desc_t *diff_dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a deconvolution descriptor conv_desc for backward propagation with respect to weights usi...
memory::desc diff_src_layer_desc() const
Queries diff source layer memory descriptor.
Definition: mkldnn.hpp:3915
Descriptor for batch normalization backward propagation.
Definition: mkldnn.hpp:3357
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
Initializes a primitive descriptor for batch normalization forward propagation with attributes define...
Definition: mkldnn.hpp:3299
Descriptor for batch normalization forward propagation.
Definition: mkldnn.hpp:3266
memory::desc weights_layer_desc() const
Queries weights layer memory descriptor.
Definition: mkldnn.hpp:3747
memory::desc diff_src_iter_desc() const
Queries diff source iteration memory descriptor.
Definition: mkldnn.hpp:3923
primitive_desc(const desc &desc, const engine &e)
Initializes a primitive descriptor for deconvolution forward propagation.
Definition: mkldnn.hpp:2459
void * get_data_handle() const
Returns a handle of the data contained in the memory.
Definition: mkldnn.hpp:1439
memory::desc dst_iter_desc() const
Queries destination iteration memory descriptor.
Definition: mkldnn.hpp:4676
Weights format used in 8bit Winograd convolution.
Definition: mkldnn_types.h:97
4D CNN activations tensor blocked by channels with block size 16, an alias to mkldnn_aBcd16b ...
Definition: mkldnn_types.h:444
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:3637
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:3430
memory::desc dst_iter_desc() const
Queries destination recurrent hidden state memory descriptor.
Definition: mkldnn.hpp:4070
desc(prop_kind aprop_kind, algorithm aalgorithm, const memory::desc &src_desc, memory::dim local_size, float alpha, float beta, float k=1.f)
Initializes a descriptor for forward propagation using prop_kind (possible values are mkldnn::forward...
Definition: mkldnn.hpp:2773
Vanilla RNN for forward propagation.
Definition: mkldnn.hpp:3674
inner product descriptor
Unspecified format kind.
memory::desc dst_layer_desc() const
Queries destination layer memory descriptor.
Definition: mkldnn.hpp:4381
memory::desc src_layer_desc() const
Queries source layer memory descriptor.
Definition: mkldnn.hpp:4636
Descriptor for convolution weight update.
Definition: mkldnn.hpp:2175
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:2584
number of inputs expected
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:4503
memory::desc diff_src_desc() const
Queries diff source memory descriptor.
Definition: mkldnn.hpp:3435
Bidirectional execution of RNN primitive with concatenation of the results.
Definition: mkldnn_types.h:1176
desc get_desc() const
Returns the descriptor of the memory.
Definition: mkldnn.hpp:1421
memory::desc dst_iter_desc() const
Queries destination iteration memory descriptor.
Definition: mkldnn.hpp:4803
permuted 2D tensor
Definition: mkldnn_types.h:197
deconvolution descriptor
5D CNN weights tensor (incl. groups), an alias to mkldnn_acbde
Definition: mkldnn_types.h:396
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:3067
4D tensor blocked by 2nd dimension with block size 8
Average pooling exclude padding.
Definition: mkldnn_types.h:689
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_get_post_ops(const_mkldnn_primitive_attr_t attr, const_mkldnn_post_ops_t *post_ops)
Returns post_ops for given attr.
primitive::kind kind(int index) const
Returns the kind of post operation with index index.
Definition: mkldnn.hpp:573
Forward data propagation (inference mode).
Definition: mkldnn_types.h:594
Convolution algorithm(either direct or Winograd) is chosen just in time.
Descriptor for GRU forward propagation.
Definition: mkldnn.hpp:4295
desc(prop_kind aprop_kind, algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &dst_desc, const memory::dims &strides, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for convolution forward propagation with bias using prop_kind (possible valu...
Definition: mkldnn.hpp:1946
memory::desc diff_weights_layer_desc() const
Queries diff weights layer memory descriptor.
Definition: mkldnn.hpp:3928
A class that provides the destructor for an Intel(R) MKL-DNN C handle.
Definition: mkldnn.hpp:79
data_type
Data type specification.
Definition: mkldnn.hpp:1003
4D CNN activations tensor blocked by channels with block size 8, an alias to mkldnn_aBcd8b ...
Definition: mkldnn_types.h:450
5D CNN weights tensor (incl. groups), an alias to mkldnn_decab
Definition: mkldnn_types.h:394
Direct deconvolution.
Definition: mkldnn_types.h:654
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:4082
Eltwise: abs.
Definition: mkldnn_types.h:666
2D CNN weights tensor, an alias to mkldnn_ab
Definition: mkldnn_types.h:359
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:2312
memory::desc weights_desc() const
Queries weights memory descriptor.
Definition: mkldnn.hpp:2473
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:2865
memory::desc dst_layer_desc() const
Queries destination layer memory descriptor.
Definition: mkldnn.hpp:3765
memory::desc dst_iter_desc() const
Queries destination iteration memory descriptor.
Definition: mkldnn.hpp:3903
desc(algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &dilates, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for dilated convolution weight update with bias using aalgorithm, memory descriptors, strides, dilates padding_l, and padding_r.
Definition: mkldnn.hpp:2232
Local response normalization (LRN) across multiple channels.
A memory descriptor.
Definition: mkldnn.hpp:1331
memory::desc dst_iter_desc() const
Queries destination iteration memory descriptor.
Definition: mkldnn.hpp:3773
memory::desc weights_iter_desc() const
Queries weights iteration memory descriptor.
Definition: mkldnn.hpp:4782
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_get_output_scales(const_mkldnn_primitive_attr_t attr, mkldnn_dim_t *count, int *mask, const float **scales)
Returns count, correspondence scale mask, and a pointer to a constant floating point array of output ...
An inner product primitive.
non-standard 16-bit (bfloat16 w/ 7 bit mantissa) floating point.
void set_rnn_weights_qparams(int mask, const std::vector< float > &scales)
Sets quantization scales weights_scales for RNN weights tensors.
Definition: mkldnn.hpp:761
Eltwise: hyperbolic tangent non-linearity (tanh)
Definition: mkldnn_types.h:660
Undefined memory format tag.
Definition: mkldnn_types.h:175
desc(algorithm aalgorithm, const memory::desc &diff_src_desc, const memory::desc &weights_desc, const memory::desc &diff_dst_desc, const memory::dims &strides, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for deconvolution backward propagation using aalgorithm, memory descriptors...
Definition: mkldnn.hpp:2514
mkldnn_status_t MKLDNN_API mkldnn_engine_get_kind(mkldnn_engine_t engine, mkldnn_engine_kind_t *kind)
Returns the kind of an engine.
mkldnn_status_t MKLDNN_API mkldnn_engine_destroy(mkldnn_engine_t engine)
Destroys an engine.
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:4523
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:3398
primitive_desc(const desc &desc, const engine &e, const batch_normalization_forward::primitive_desc &hint_fwd_pd)
Initializes a primitive descriptor for batch normalization backward propagation.
Definition: mkldnn.hpp:3387
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:2998
plain 2D tensor
Definition: mkldnn_types.h:184
4D CNN activations tensor, an alias to mkldnn_bcda
Definition: mkldnn_types.h:352
memory::desc diff_src_layer_desc() const
Queries diff source layer memory descriptor.
Definition: mkldnn.hpp:4232
5D tensor blocked by 2nd dimension with block size 4
Definition: mkldnn_types.h:267
Primitive or engine failed on execution.
Definition: mkldnn_types.h:62
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:4057
Eltwise: square root.
memory::desc diff_bias_desc() const
Queries diff bias memory descriptor.
Definition: mkldnn.hpp:4260
stream & wait()
Waits for all primitives in the stream to finish.
Definition: mkldnn.hpp:955
Primitive descriptor for convolution forward propagation.
Definition: mkldnn.hpp:2025
mkldnn_status_t MKLDNN_API mkldnn_deconvolution_forward_desc_init(mkldnn_deconvolution_desc_t *conv_desc, mkldnn_prop_kind_t prop_kind, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *weights_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a deconvolution descriptor deconv_desc for forward propagation using prop_kind (possible ...
4D CNN activations tensor blocked by channels with block size 4, an alias to mkldnn_aBcd4b ...
Definition: mkldnn_types.h:447
permuted 5D tensor
Definition: mkldnn_types.h:206
memory::desc diff_src_desc() const
Queries diff source gradient memory descriptor.
Definition: mkldnn.hpp:2146
memory::desc weights_layer_desc() const
Queries weights layer memory descriptor.
Definition: mkldnn.hpp:4363
An LRN primitive.
Definition: mkldnn_types.h:633
source gradient memory desc
mkldnn_status_t MKLDNN_API mkldnn_memory_get_engine(const_mkldnn_memory_t memory, mkldnn_engine_t *engine)
Returns an engine associated with memory.
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:4396
Placeholder memory format tag.
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:4683
mkldnn_status_t MKLDNN_API mkldnn_sum_primitive_desc_create(mkldnn_primitive_desc_t *sum_primitive_desc, const mkldnn_memory_desc_t *dst_mds, int n, const float *scales, const mkldnn_memory_desc_t *src_mds, const_mkldnn_primitive_attr_t attr, mkldnn_engine_t engine)
Creates out-of-place sum_primitive_desc for sum of n inputs multiplied by scale with resulting output...
desc(const memory::desc &diff_desc, const memory::desc &data_desc, int softmax_axis)
Initializes a softmax descriptor for backward propagation using memory descriptors diff_desc and data...
Definition: mkldnn.hpp:3200
memory::desc workspace_desc() const
Queries workspace memory descriptor.
Definition: mkldnn.hpp:3320
void get_output_scales(int &mask, std::vector< float > &scales) const
Gets correspondence scale mask and a constant floating point vector of output scales previously set b...
Definition: mkldnn.hpp:674
Primitive descriptor for LBR_GRU forward propagation.
Definition: mkldnn.hpp:4626
memory::desc dst_layer_desc() const
Queries destination layer memory descriptor.
Definition: mkldnn.hpp:3895
memory::desc weights_layer_desc() const
Queries weights layer memory descriptor.
Definition: mkldnn.hpp:4650
weights memory descriptor desc
Definition: mkldnn_types.h:1533
Descriptor for deconvolution backward propagation.
Definition: mkldnn.hpp:2505
5D RNN weights tensor in the format (num_layers, num_directions, input_channels, num_gates, output_channels).
Definition: mkldnn_types.h:413
3D tensor blocked by 2nd dimension with block size 8
Definition: mkldnn_types.h:223
memory::desc diff_src_iter_desc() const
Queries diff source iteration memory descriptor.
Definition: mkldnn.hpp:4824
Inner product for backward propagation with respect to weights.
Definition: mkldnn.hpp:3593
shuffle descriptor
Definition: mkldnn_types.h:1519
Forward data propagation (training mode).
Definition: mkldnn_types.h:590
mkldnn_status_t MKLDNN_API mkldnn_gru_backward_desc_init(mkldnn_rnn_desc_t *rnn_desc, mkldnn_prop_kind_t prop_kind, mkldnn_rnn_direction_t direction, const mkldnn_memory_desc_t *src_layer_desc, const mkldnn_memory_desc_t *src_iter_desc, const mkldnn_memory_desc_t *weights_layer_desc, const mkldnn_memory_desc_t *weights_iter_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_layer_desc, const mkldnn_memory_desc_t *dst_iter_desc, const mkldnn_memory_desc_t *diff_src_layer_desc, const mkldnn_memory_desc_t *diff_src_iter_desc, const mkldnn_memory_desc_t *diff_weights_layer_desc, const mkldnn_memory_desc_t *diff_weights_iter_desc, const mkldnn_memory_desc_t *diff_bias_desc, const mkldnn_memory_desc_t *diff_dst_layer_desc, const mkldnn_memory_desc_t *diff_dst_iter_desc, unsigned flags)
Initializes a GRU descriptor rnn_desc for backward propagation using prop_kind, direction, and memory descriptors.
plain 4D tensor
Definition: mkldnn_types.h:186
3D CNN weights tensor, an alias to mkldnn_abc
Definition: mkldnn_types.h:363
5D CNN activations tensor blocked by channels with block size 16, an alias to mkldnn_aBcde16b ...
Definition: mkldnn_types.h:435
mkldnn_status_t MKLDNN_API mkldnn_gru_forward_desc_init(mkldnn_rnn_desc_t *rnn_desc, mkldnn_prop_kind_t prop_kind, mkldnn_rnn_direction_t direction, const mkldnn_memory_desc_t *src_layer_desc, const mkldnn_memory_desc_t *src_iter_desc, const mkldnn_memory_desc_t *weights_layer_desc, const mkldnn_memory_desc_t *weights_iter_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_layer_desc, const mkldnn_memory_desc_t *dst_iter_desc, unsigned flags)
Initializes a GRU descriptor rnn_desc for forward propagation using prop_kind, direction, and memory descriptors.
memory::desc diff_bias_desc() const
Queries diff bias memory descriptor.
Definition: mkldnn.hpp:4552
weights grad. memory desc
Definition: mkldnn_types.h:1534
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:3231
LBR_GRU descriptor for backward propagation.
Definition: mkldnn.hpp:4699
Backward bias propagation.
post_ops()
Creates an empty sequence of post operations.
Definition: mkldnn.hpp:562
Descriptor for LBR GRU forward propagation.
Definition: mkldnn.hpp:4582
2D CNN activations tensor, an alias to mkldnn_ba
Definition: mkldnn_types.h:342
An opaque structure to describe a primitive.
void set_scratchpad_mode(scratchpad_mode mode)
Sets scratchpad mode.
Definition: mkldnn.hpp:666
desc(prop_kind aprop_kind, algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &bias_desc, const memory::desc &dst_desc, const memory::dims &strides, const memory::dims &dilates, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for dilated convolution forward propagation without bias using prop_kind (po...
Definition: mkldnn.hpp:1972
Primitive descriptor for RNN forward propagation.
Definition: mkldnn.hpp:3724
mkldnn_data_type_t
Data type specification.
Definition: mkldnn_types.h:68
Convolution backward propagation.
Definition: mkldnn.hpp:2073
memory::desc diff_weights_desc() const
Queries diff weights memory descriptor.
Definition: mkldnn.hpp:2728
Undefined memory format tag.
Definition: mkldnn_types.h:172
convolution descriptor
Definition: mkldnn_types.h:1517
Primitive descriptor for RNN backward propagation.
Definition: mkldnn.hpp:3852
plain 5D tensor
Definition: mkldnn_types.h:187
GRU for backward propagation.
Definition: mkldnn.hpp:4409
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e, const convolution_forward::primitive_desc &hint_fwd_pd)
Initializes primitive descriptor for convolution backward propagation with attributes defined by attr...
Definition: mkldnn.hpp:2141
Primitive descriptor for softmax backward propagation.
Definition: mkldnn.hpp:3209
primitive_desc(const desc &desc, const engine &e, const convolution_forward::primitive_desc &hint_fwd_pd)
Initializes primitive descriptor for convolution backward propagation.
Definition: mkldnn.hpp:2135
memory::desc weights_iter_desc() const
Queries weights iteration memory descriptor.
Definition: mkldnn.hpp:3882
mkldnn_status_t MKLDNN_API mkldnn_memory_desc_init_submemory(mkldnn_memory_desc_t *memory_desc, const mkldnn_memory_desc_t *parent_memory_desc, const mkldnn_dims_t dims, const mkldnn_dims_t offsets)
Initializes a memory_desc for a given parent_memory_desc, with dims sizes and offsets.
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:2795
Eltwise: bounded_relu.
Definition: mkldnn_types.h:672
Descriptor for softmax forward propagation.
Definition: mkldnn.hpp:3149
memory::desc diff_src_iter_desc() const
Queries diff source recurrent hidden state memory descriptor.
Definition: mkldnn.hpp:4240
mkldnn_engine_kind_t
Kinds of engines.
Definition: mkldnn_types.h:1256
memory::desc diff_dst_layer_desc() const
Queries diff destination layer memory descriptor.
Definition: mkldnn.hpp:4844
memory::desc diff_src_desc() const
Queries diff source memory descriptor.
Definition: mkldnn.hpp:2993
destination memory desc
Definition: mkldnn_types.h:1535
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:4905
Memory that describes the data.
Definition: mkldnn.hpp:993
memory::desc diff_src_desc() const
Queries diff source gradient memory descriptor.
Definition: mkldnn.hpp:3571
3D CNN activations tensor blocked by channels with block size 4, an alias to mkldnn_aBc4b ...
Definition: mkldnn_types.h:456
Local response normalization for backward propagation.
Definition: mkldnn.hpp:2819
memory::desc diff_dst_iter_desc() const
Queries diff destination iteration memory descriptor.
Definition: mkldnn.hpp:3951
Deconvolution forward propagation.
Definition: mkldnn.hpp:2336
const void * const_mkldnn_op_desc_t
A pointer to any of the operation descriptors (constant variant).
Definition: mkldnn_types.h:935
runtime estimation (seconds), unimplemented
Deconvolution weight update.
Definition: mkldnn.hpp:2600
destination grad. memory desc
Batch normalization for forward propagation.
Definition: mkldnn.hpp:3263
A reorder primitive.
Definition: mkldnn_types.h:615
void unmap_data(void *mapped_ptr) const
Unmaps the previously mapped data for the memory.
Definition: mkldnn.hpp:1482
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &e)
Initializes primitive descriptor for deconvolution forward propagation with attributes defined by att...
Definition: mkldnn.hpp:2464
eltwise descriptor
4D CNN weights tensor, an alias to mkldnn_cdba
Definition: mkldnn_types.h:373
An unspecified engine.
Definition: mkldnn_types.h:1258
desc(const mkldnn_memory_desc_t &adata)
Constructs a memory descriptor from a C API data structure.
Definition: mkldnn.hpp:1371
int MKLDNN_API mkldnn_post_ops_len(const_mkldnn_post_ops_t post_ops)
Returns the length of post operations for given post_ops.
Undefined memory format tag.
The library manages scratchpad (default)
Definition: mkldnn_types.h:1316
mkldnn_alg_kind_t
Kinds of algorithms.
Definition: mkldnn_types.h:645
Bidirectional execution of RNN primitive with summation of the results.
Definition: mkldnn_types.h:1179
LBR_GRU for backward propagation.
Definition: mkldnn.hpp:4696
Vanilla RNN for backward propagation.
Definition: mkldnn.hpp:3793
memory::desc weights_layer_desc() const
Queries weights layer memory descriptor.
Definition: mkldnn.hpp:4188
4D CNN weights tensor, an alias to mkldnn_bacd
Definition: mkldnn_types.h:379
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:2858
inner product descriptor
Definition: mkldnn_types.h:1525
A pooling primitive.
Definition: mkldnn_types.h:631
Primitive descriptor for pooling backward propagation.
Definition: mkldnn.hpp:2981
mkldnn_status_t MKLDNN_API mkldnn_primitive_create(mkldnn_primitive_t *primitive, const_mkldnn_primitive_desc_t primitive_desc)
Creates a primitive using a primitive_desc descriptor.
const mkldnn_memory_desc_t MKLDNN_API * mkldnn_primitive_desc_query_md(const_mkldnn_primitive_desc_t primitive_desc, mkldnn_query_t what, int index)
Queries primitive descriptor for memory descriptor.
mkldnn_status_t MKLDNN_API mkldnn_primitive_destroy(mkldnn_primitive_t primitive)
Deletes a primitive.
permuted 4D tensor
Definition: mkldnn_types.h:199
plain 1D tensor
Definition: mkldnn_types.h:183
Shuffle for forward propagation.
Definition: mkldnn.hpp:4873
memory::desc dst_desc() const
Queries destination memory descriptor.
Definition: mkldnn.hpp:2934
4D CNN weights tensor (incl. groups), an alias to mkldnn_abcd
Definition: mkldnn_types.h:390
mkldnn_status_t MKLDNN_API mkldnn_convolution_forward_desc_init(mkldnn_convolution_desc_t *conv_desc, mkldnn_prop_kind_t prop_kind, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *weights_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a convolution descriptor conv_desc for forward propagation using prop_kind (possible valu...
op descriptor
Primitive descriptor for batch normalization forward propagation.
Definition: mkldnn.hpp:3289
4D tensor blocked by 2nd dimension with block size 8
Definition: mkldnn_types.h:245
static void wrap_c_api(mkldnn_status_t status, const char *message)
A convenience function for wrapping calls to the C API.
Definition: mkldnn.hpp:72
memory::desc bias_desc() const
Queries bias memory descriptor.
Definition: mkldnn.hpp:2052
memory::desc diff_dst_desc() const
Queries diff destination memory descriptor.
Definition: mkldnn.hpp:2156
permuted 5D tensor
Definition: mkldnn_types.h:205
Forward data propagation (alias for mkldnn_forward_training).
Definition: mkldnn_types.h:598
lrn descriptor
Definition: mkldnn_types.h:1523
4D tensor blocked by 2nd dimension with block size 4
Definition: mkldnn_types.h:237
memory::desc src_desc() const
Queries source memory descriptor.
Definition: mkldnn.hpp:2297
bool next_impl()
Advances the next implementation for the given op descriptor.
Definition: mkldnn.hpp:1848
mkldnn_status_t MKLDNN_API mkldnn_inner_product_backward_weights_desc_init(mkldnn_inner_product_desc_t *ip_desc, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *diff_weights_desc, const mkldnn_memory_desc_t *diff_bias_desc, const mkldnn_memory_desc_t *diff_dst_desc)
Initializes an inner product descriptor ip_desc for backward propagation with respect to weights usin...
handle()
Empty constructor.
Definition: mkldnn.hpp:121
plain 6D tensor
Definition: mkldnn_types.h:188
const char * what() const noexcept override
Returns the explanatory string.
Definition: mkldnn.hpp:65
GRU for forward propagation.
Definition: mkldnn.hpp:4292
mkldnn_status_t MKLDNN_API mkldnn_dilated_deconvolution_forward_desc_init(mkldnn_deconvolution_desc_t *conv_desc, mkldnn_prop_kind_t prop_kind, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *weights_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t dilates, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r)
Initializes a dilated deconvolution descriptor deconv_desc for forward propagation using prop_kind (p...
mkldnn_status_t MKLDNN_API mkldnn_primitive_attr_set_rnn_weights_qparams(mkldnn_primitive_attr_t attr, mkldnn_dim_t count, int mask, const float *weights_scales)
Sets quantization scales weights_scales for RNN weights tensors.
Undefined memory format kind, used for empty memory descriptors.
desc(prop_kind aprop_kind, algorithm aalgorithm, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &bias_desc, const memory::desc &dst_desc, const memory::dims &strides, const memory::dims &padding_l, const memory::dims &padding_r)
Initializes a descriptor for deconvolution forward propagation with bias using prop_kind (possible va...
Definition: mkldnn.hpp:2350
int64_t mkldnn_dim_t
A type to describe tensor dimension.
Definition: mkldnn_types.h:760
void append_eltwise(float scale, algorithm alg, float alpha, float beta)
Appends eltwise post operation.
Definition: mkldnn.hpp:621
source gradient memory desc
Definition: mkldnn_types.h:1532
2D CNN weights tensor, an alias to mkldnn_ba
Definition: mkldnn_types.h:361
primitive kind
Definition: mkldnn_types.h:1498
memory::desc diff_src_desc() const
Queries diff source memory descriptor.
Definition: mkldnn.hpp:2853
An opaque structure to describe a primitive descriptor iterator.
mkldnn_status_t MKLDNN_API mkldnn_memory_desc_init_by_tag(mkldnn_memory_desc_t *memory_desc, int ndims, const mkldnn_dims_t dims, mkldnn_data_type_t data_type, mkldnn_format_tag_t tag)
Initializes a memory_desc memory descriptor using ndims, dims, data_type, and format tag...
mkldnn_status_t MKLDNN_API mkldnn_memory_get_data_handle(const_mkldnn_memory_t memory, void **handle)
For a memory, returns the data handle.
memory::desc dst_layer_desc() const
Queries destination layer memory descriptor.
Definition: mkldnn.hpp:4062
memory::desc diff_bias_desc() const
Queries diff bias memory descriptor.
Definition: mkldnn.hpp:2307
4D RNN states tensor in the format (num_layers, num_directions, batch, state channels).
Definition: mkldnn_types.h:406
workspace memory desc
mkldnn_status_t MKLDNN_API mkldnn_inner_product_forward_desc_init(mkldnn_inner_product_desc_t *ip_desc, mkldnn_prop_kind_t prop_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *weights_desc, const mkldnn_memory_desc_t *bias_desc, const mkldnn_memory_desc_t *dst_desc)
Initializes an inner product descriptor ip_desc for forward propagation using prop_kind (possible val...