Deep Neural Network Library (DNNL)  1.3.0
Performance library for Deep Learning
dnnl.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2016-2020 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 DNNL_HPP
21 #define DNNL_HPP
22 
23 #include "dnnl_config.h"
24 
26 #include <algorithm>
27 #include <cstdlib>
28 #include <iterator>
29 #include <memory>
30 #include <string>
31 #include <vector>
32 #include <unordered_map>
33 
34 #include "dnnl.h"
35 
36 #if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL
37 #include <CL/cl.h>
38 #endif
39 
41 // __cpp_exceptions is referred from
42 // https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_exceptions.html
43 // gcc < 5 does not define __cpp_exceptions but __EXCEPTIONS,
44 // Microsoft C++ Compiler does not provide an option to disable exceptions
45 #ifndef DNNL_ENABLE_EXCEPTIONS
46 #if __cpp_exceptions || __EXCEPTIONS \
47  || (defined(_MSC_VER) && !defined(__clang__))
48 #define DNNL_ENABLE_EXCEPTIONS 1
49 #else
50 #define DNNL_ENABLE_EXCEPTIONS 0
51 #endif
52 #endif
53 
54 #if defined(__GNUC__) || defined(__clang__)
55 #define DNNL_TRAP() __builtin_trap()
56 #elif defined(__INTEL_COMPILER) || defined(_MSC_VER)
57 #define DNNL_TRAP() __debugbreak()
58 #else
59 #error "unknown compiler"
60 #endif
61 
62 #if DNNL_ENABLE_EXCEPTIONS
63 #define DNNL_THROW_ERROR(status, msg) throw error(status, msg)
64 #else
65 #include <cstdio>
66 #define DNNL_THROW_ERROR(status, msg) \
67  do { \
68  fputs(msg, stderr); \
69  DNNL_TRAP(); \
70  } while (0)
71 #endif
72 
75 
77 namespace dnnl {
78 
82 
87 struct error : public std::exception {
89  const char *message;
90 
95  error(dnnl_status_t status, const char *message)
96  : status(status), message(message) {}
97 
99  const char *what() const noexcept override { return message; }
100 
106  static void wrap_c_api(dnnl_status_t status, const char *message) {
107  if (status != dnnl_success) DNNL_THROW_ERROR(status, message);
108  }
109 };
110 
112 template <typename T>
113 void validate_container_size(const T &v, const char *error_message,
114  int min_size = 1, int max_size = -1) {
115  const int size = (int)v.size();
116  if (size < min_size || (max_size >= 0 && size > max_size))
117  DNNL_THROW_ERROR(dnnl_invalid_arguments, error_message);
118 }
120 
122 template <typename T>
123 struct handle_traits {};
124 
138 template <typename T, typename traits = handle_traits<T>>
139 struct handle {
140 private:
141  static dnnl_status_t dummy_destructor(T) { return dnnl_success; }
142  std::shared_ptr<typename std::remove_pointer<T>::type> data_ {0};
143 
144 protected:
145  bool operator==(const T other) const { return other == data_.get(); }
146  bool operator!=(const T other) const { return !(*this == other); }
147 
148 public:
156  handle() = default;
157 
159  handle(const handle<T, traits> &) = default;
161  handle<T, traits> &operator=(const handle<T, traits> &) = default;
163  handle(handle<T, traits> &&) = default;
166 
172  explicit handle(T t, bool weak = false) { reset(t, weak); }
173 
179  void reset(T t, bool weak = false) {
180  data_.reset(t, weak ? &dummy_destructor : traits::destructor);
181  }
182 
188  T get(bool allow_empty = false) const {
189  T result = data_.get();
190  if (allow_empty == false && result == nullptr)
191  DNNL_THROW_ERROR(
192  dnnl_invalid_arguments, "object is not initialized");
193  return result;
194  }
195 
200  explicit operator T() const { return get(true); }
201 
205  explicit operator bool() const { return get(true) != nullptr; }
206 
213  bool operator==(const handle<T, traits> &other) const {
214  return other.data_.get() == data_.get();
215  }
216 
223  bool operator!=(const handle &other) const { return !(*this == other); }
224 };
225 
227 template <>
228 struct handle_traits<dnnl_memory_t> {
229  static dnnl_status_t destructor(dnnl_memory_t p) {
230  return dnnl_memory_destroy(p);
231  }
232 };
233 
234 template <>
235 struct handle_traits<dnnl_primitive_desc_t> {
236  static dnnl_status_t destructor(dnnl_primitive_desc_t p) {
237  return dnnl_primitive_desc_destroy(p);
238  }
239 };
240 
241 template <>
242 struct handle_traits<dnnl_primitive_t> {
243  static dnnl_status_t destructor(dnnl_primitive_t p) {
244  return dnnl_primitive_destroy(p);
245  }
246 };
247 
248 template <>
249 struct handle_traits<dnnl_primitive_desc_iterator_t> {
250  static dnnl_status_t destructor(dnnl_primitive_desc_iterator_t p) {
252  }
253 };
255 
257 
258 struct stream;
259 struct error;
260 struct memory;
261 struct primitive_desc;
262 
267 
271 
273 struct primitive : public handle<dnnl_primitive_t> {
274  friend struct error;
275  friend struct stream;
276 
278  enum class kind {
288  sum = dnnl_sum,
300  lrn = dnnl_lrn,
308  rnn = dnnl_rnn,
317  };
318 
319  using handle::handle;
320 
322  primitive() = default;
323 
328 
332  primitive(const primitive_desc &pd);
333 
339 
343  inline kind get_kind() const;
344 
357  void execute(
358  stream &stream, const std::unordered_map<int, memory> &args) const;
359 };
360 
366  return static_cast<dnnl_primitive_kind_t>(kind);
367 }
368 
372  "could not get a primitive descriptor from a primitive");
373  return pd;
374 }
375 
378  // TODO (Roma): the code below is only needed because get_primitive_desc
379  // returns a C type.
382  pd, dnnl_query_primitive_kind, 0, (void *)&kind),
383  "could not get a primitive kind from a primitive descriptor");
384  return static_cast<dnnl::primitive::kind>(kind);
385 }
386 
388 
400 
402 enum class scratchpad_mode {
425 };
426 
432  return static_cast<dnnl_scratchpad_mode_t>(mode);
433 }
434 
436 enum class prop_kind {
460 };
461 
467  return static_cast<dnnl_prop_kind_t>(kind);
468 }
469 
471 enum class algorithm {
473  undef = dnnl_alg_kind_undef,
574 };
575 
580  return static_cast<dnnl_alg_kind_t>(algorithm);
581 }
582 
584 
587 
589 enum class normalization_flags : unsigned {
598 
605 
611 };
612 
617  return static_cast<dnnl_normalization_flags_t>(flags);
618 }
619 
621 
624 
626 enum class rnn_flags : unsigned {
629 };
630 
635  return static_cast<dnnl_rnn_flags_t>(flags);
636 }
637 
638 #define DNNL_DEFINE_BITMASK_OPS(enum_name) \
639  inline enum_name operator|(enum_name lhs, enum_name rhs) { \
640  return static_cast<enum_name>( \
641  static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); \
642  } \
643 \
644  inline enum_name operator&(enum_name lhs, enum_name rhs) { \
645  return static_cast<enum_name>( \
646  static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); \
647  } \
648 \
649  inline enum_name operator^(enum_name lhs, enum_name rhs) { \
650  return static_cast<enum_name>( \
651  static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); \
652  } \
653 \
654  inline enum_name &operator|=(enum_name &lhs, enum_name rhs) { \
655  lhs = static_cast<enum_name>( \
656  static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); \
657  return lhs; \
658  } \
659 \
660  inline enum_name &operator&=(enum_name &lhs, enum_name rhs) { \
661  lhs = static_cast<enum_name>( \
662  static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); \
663  return lhs; \
664  } \
665 \
666  inline enum_name &operator^=(enum_name &lhs, enum_name rhs) { \
667  lhs = static_cast<enum_name>( \
668  static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); \
669  return lhs; \
670  } \
671 \
672  inline enum_name operator~(enum_name rhs) { \
673  return static_cast<enum_name>(~static_cast<unsigned>(rhs)); \
674  }
675 
676 DNNL_DEFINE_BITMASK_OPS(normalization_flags)
677 DNNL_DEFINE_BITMASK_OPS(rnn_flags)
678 
679 enum class rnn_direction {
693 };
694 
699  return static_cast<dnnl_rnn_direction_t>(dir);
700 }
701 
703 
706 
713 enum class query {
716 
721 
726 
735 
740 
745 
748 
751 
784 
803 };
804 
809  return static_cast<dnnl_query_t>(query);
810 }
811 
813 
815 
826 
828 template <>
829 struct handle_traits<dnnl_engine_t> {
830  static dnnl_status_t destructor(dnnl_engine_t p) {
831  return dnnl_engine_destroy(p);
832  }
833 };
835 
837 struct engine : public handle<dnnl_engine_t> {
838  friend struct primitive;
839  friend struct reorder;
840 
842  enum class kind {
846  cpu = dnnl_cpu,
848  gpu = dnnl_gpu,
849  };
850 
851  using handle::handle;
852 
855  engine() = default;
856 
861  static size_t get_count(kind kind) {
862  return dnnl_engine_get_count(convert_to_c(kind));
863  }
864 
870  engine(kind kind, size_t index) {
873  dnnl_engine_create(&engine, convert_to_c(kind), index),
874  "could not create an engine");
875  reset(engine);
876  }
877 
878 #if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL
879  engine(kind kind, cl_device_id device, cl_context context) {
888  &engine, convert_to_c(kind), device, context),
889  "could not create an engine");
890  reset(engine);
891  }
892 #endif
893 
899  dnnl_engine_t c_engine;
902  dnnl::convert_to_c(dnnl::query::engine), 0, &c_engine),
903  "could not get an engine from a primitive_desc");
904  reset(c_engine, true);
905  }
906 
909  kind get_kind() const {
912  "could not get kind of an engine");
913  return static_cast<engine::kind>(kind);
914  }
915 
916 #if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL
917  cl_context get_ocl_context() const {
920  cl_context context = nullptr;
922  "could not get an OpenCL context fron an engine");
923  return context;
924  }
925 
928  cl_device_id get_ocl_device() const {
929  cl_device_id device = nullptr;
931  "could not get an OpenCL device fron an engine");
932  return device;
933  }
934 #endif
935 
941  template <typename primitive_desc>
942  static engine query(const primitive_desc &pd) {
943  return query(pd, dnnl::query::engine);
944  }
945 
946 private:
947  static dnnl_engine_kind_t convert_to_c(kind kind) {
948  return static_cast<dnnl_engine_kind_t>(kind);
949  }
950 
951  template <typename primitive_desc>
952  static engine query(const primitive_desc &pd, dnnl::query what) {
953  dnnl_engine_t c_engine;
955  dnnl::convert_to_c(what), 0, &c_engine),
956  "could not get an engine from a primitive_desc");
957  return engine(c_engine, true);
958  }
959 };
960 
962 
970 
972 template <>
973 struct handle_traits<dnnl_stream_t> {
974  static dnnl_status_t destructor(dnnl_stream_t p) {
975  return dnnl_stream_destroy(p);
976  }
977 };
979 
981 struct stream : public handle<dnnl_stream_t> {
982  using handle::handle;
983 
985  enum class flags : unsigned {
995  };
996 
999  stream() = default;
1000 
1009  static_cast<dnnl_stream_flags_t>(flags)),
1010  "could not create a stream");
1011  reset(stream);
1012  }
1013 
1014 #if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL
1015  stream(const engine &engine, cl_command_queue queue) {
1022  "could not create a stream");
1023  reset(stream);
1024  }
1025 
1028  cl_command_queue get_ocl_command_queue() const {
1029  cl_command_queue queue = nullptr;
1031  "could not get an OpenCL command queue from a stream");
1032  return queue;
1033  }
1034 #endif
1035 
1040  dnnl_stream_wait(get()), "could not wait on a stream");
1041  return *this;
1042  }
1043 };
1044 
1045 DNNL_DEFINE_BITMASK_OPS(stream::flags)
1046 
1047 
1112 
1119 struct memory : public handle<dnnl_memory_t> {
1121  typedef dnnl_dim_t dim;
1124  typedef std::vector<dim> dims;
1125 
1132  template <typename T>
1133  static void validate_dims(const std::vector<T> &v, int min_size = 0) {
1134  validate_container_size(
1135  v, "dimensions are invalid", min_size, DNNL_MAX_NDIMS);
1136  }
1137 
1139  enum class data_type {
1143  f16 = dnnl_f16,
1145  bf16 = dnnl_bf16,
1147  f32 = dnnl_f32,
1149  s32 = dnnl_s32,
1151  s8 = dnnl_s8,
1153  u8 = dnnl_u8,
1154  };
1155 
1157  enum class format_kind {
1162  any = dnnl_format_kind_any,
1166  blocked = dnnl_blocked,
1168  wino = dnnl_format_kind_wino,
1170  packed = dnnl_format_kind_rnn_packed,
1171  };
1172 
1213  enum class format_tag {
1218  any = dnnl_format_tag_any,
1219 
1221  a = dnnl_a,
1222 
1224  ab = dnnl_ab,
1226  ba = dnnl_ba,
1227 
1229  abc = dnnl_abc,
1231  acb = dnnl_acb,
1233  bac = dnnl_bac,
1235  bca = dnnl_bca,
1237  cba = dnnl_cba,
1238 
1240  abcd = dnnl_abcd,
1242  acdb = dnnl_acdb,
1244  bacd = dnnl_bacd,
1246  bcda = dnnl_bcda,
1248  cdba = dnnl_cdba,
1249 
1251  abcde = dnnl_abcde,
1253  abdec = dnnl_abdec,
1255  acbde = dnnl_acbde,
1257  acdeb = dnnl_acdeb,
1259  bcdea = dnnl_bcdea,
1261  cdeba = dnnl_cdeba,
1263  decab = dnnl_decab,
1265  abcdef = dnnl_abcdef,
1267  acbdef = dnnl_acbdef,
1269  defcab = dnnl_defcab,
1270 
1272  x = a,
1274  nc = ab,
1276  cn = ba,
1278  tn = ab,
1280  nt = ba,
1282  ncw = abc,
1284  nwc = acb,
1286  nchw = abcd,
1288  nhwc = acdb,
1290  chwn = bcda,
1292  ncdhw = abcde,
1294  ndhwc = acdeb,
1295 
1297  oi = ab,
1299  io = ba,
1301  oiw = abc,
1303  owi = acb,
1305  wio = cba,
1307  iwo = bca,
1309  oihw = abcd,
1311  hwio = cdba,
1313  ohwi = acdb,
1315  ihwo = bcda,
1317  iohw = bacd,
1319  oidhw = abcde,
1321  dhwio = cdeba,
1323  odhwi = acdeb,
1325  idhwo = bcdea,
1326 
1328  goiw = abcd,
1330  goihw = abcde,
1332  hwigo = decab,
1334  giohw = acbde,
1336  goidhw = abcdef,
1338  giodhw = acbdef,
1340  dhwigo = defcab,
1341 
1343  tnc = abc,
1345  ntc = bac,
1348  ldnc = abcd,
1355  ldigo = abcde,
1362  ldgoi = abdec,
1369  ldgo = abcd,
1370 
1371  // Opaque blocked formats
1372 
1373  Abc16a = dnnl_Abc16a,
1374  ABc16a16b = dnnl_ABc16a16b,
1375  ABc4a4b = dnnl_ABc4a4b,
1376  aBc16b = dnnl_aBc16b,
1377  ABc16b16a = dnnl_ABc16b16a,
1378  Abc4a = dnnl_Abc4a,
1379  aBc4b = dnnl_aBc4b,
1380  ABc4b16a4b = dnnl_ABc4b16a4b,
1381  ABc2b8a4b = dnnl_ABc2b8a4b,
1382  ABc4b4a = dnnl_ABc4b4a,
1383  ABc8a16b2a = dnnl_ABc8a16b2a,
1384  ABc8a8b = dnnl_ABc8a8b,
1385  aBc8b = dnnl_aBc8b,
1386  ABc8b16a2b = dnnl_ABc8b16a2b,
1387  ABc8b8a = dnnl_ABc8b8a,
1388  Abcd16a = dnnl_Abcd16a,
1389  ABcd16a16b = dnnl_ABcd16a16b,
1390  aBcd16b = dnnl_aBcd16b,
1391  ABcd16b16a = dnnl_ABcd16b16a,
1392  aBCd16b16c = dnnl_aBCd16b16c,
1393  aBCd16c16b = dnnl_aBCd16c16b,
1394  Abcd4a = dnnl_Abcd4a,
1395  aBcd4b = dnnl_aBcd4b,
1396  ABcd4b16a4b = dnnl_ABcd4b16a4b,
1397  ABcd2b8a4b = dnnl_ABcd2b8a4b,
1398  ABcd4b4a = dnnl_ABcd4b4a,
1399  ABcd4a4b = dnnl_ABcd4a4b,
1400  aBCd4c16b4c = dnnl_aBCd4c16b4c,
1401  aBCd2c8b4c = dnnl_aBCd2c8b4c,
1402  aBCd4c4b = dnnl_aBCd4c4b,
1403  aBCd4b4c = dnnl_aBCd4b4c,
1404  ABcd8a16b2a = dnnl_ABcd8a16b2a,
1405  ABcd8a8b = dnnl_ABcd8a8b,
1407  aBcd8b = dnnl_aBcd8b,
1408  ABcd8b16a2b = dnnl_ABcd8b16a2b,
1409  aBCd8b16c2b = dnnl_aBCd8b16c2b,
1411  ABcd8b8a = dnnl_ABcd8b8a,
1412  aBCd8b8c = dnnl_aBCd8b8c,
1413  aBCd8c16b2c = dnnl_aBCd8c16b2c,
1414  aBCd8c8b = dnnl_aBCd8c8b,
1415  Abcde16a = dnnl_Abcde16a,
1416  ABcde16a16b = dnnl_ABcde16a16b,
1417  aBcde16b = dnnl_aBcde16b,
1418  ABcde16b16a = dnnl_ABcde16b16a,
1419  aBCde16b16c = dnnl_aBCde16b16c,
1420  aBCde16c16b = dnnl_aBCde16c16b,
1421  aBCde2c8b4c = dnnl_aBCde2c8b4c,
1422  Abcde4a = dnnl_Abcde4a,
1423  aBcde4b = dnnl_aBcde4b,
1424  ABcde4b4a = dnnl_ABcde4b4a,
1425  ABcde4a4b = dnnl_ABcde4a4b,
1426  aBCde4b4c = dnnl_aBCde4b4c,
1427  aBCde4c16b4c = dnnl_aBCde4c16b4c,
1428  aBCde4c4b = dnnl_aBCde4c4b,
1429  Abcde8a = dnnl_Abcde8a,
1430  ABcde8a8b = dnnl_ABcde8a8b,
1431  aBcde8b = dnnl_aBcde8b,
1432  ABcde8b16a2b = dnnl_ABcde8b16a2b,
1433  ABcde4b16a4b = dnnl_ABcde4b16a4b,
1434  ABcde2b8a4b = dnnl_ABcde2b8a4b,
1435  aBCde8b16c2b = dnnl_aBCde8b16c2b,
1436  ABcde8b8a = dnnl_ABcde8b8a,
1437  aBCde8b8c = dnnl_aBCde8b8c,
1438  ABcd4a8b8a4b = dnnl_ABcd4a8b8a4b,
1439  ABcd2a8b8a2b = dnnl_ABcd2a8b8a2b,
1440  aBCde4b8c8b4c = dnnl_aBCde4b8c8b4c,
1441  aBCde2b8c8b2c = dnnl_aBCde2b8c8b2c,
1442  aBCde8c16b2c = dnnl_aBCde8c16b2c,
1443  aBCde8c8b = dnnl_aBCde8c8b,
1444  aBcdef16b = dnnl_aBcdef16b,
1445  aBCdef16b16c = dnnl_aBCdef16b16c,
1446  aBCdef16c16b = dnnl_aBCdef16c16b,
1447  aBcdef4b = dnnl_aBcdef4b,
1448  aBCdef4c4b = dnnl_aBCdef4c4b,
1449  aBCdef4b4c = dnnl_aBCdef4b4c,
1450  aBCdef8b8c = dnnl_aBCdef8b8c,
1451  aBCdef8c16b2c = dnnl_aBCdef8c16b2c,
1452  aBCdef4c16b4c = dnnl_aBCdef4c16b4c,
1453  aBCdef8c8b = dnnl_aBCdef8c8b,
1454  aBdc16b = dnnl_aBdc16b,
1455  aBdc4b = dnnl_aBdc4b,
1456  aBdc8b = dnnl_aBdc8b,
1457  aBdec16b = dnnl_aBdec16b,
1458  aBdec4b = dnnl_aBdec4b,
1459  aBdec8b = dnnl_aBdec8b,
1460  aBdefc16b = dnnl_aBdefc16b,
1461  aCBdef16c16b = dnnl_aCBdef16c16b,
1462  aCBdef16b16c = dnnl_aCBdef16b16c,
1463  aBdefc4b = dnnl_aBdefc4b,
1464  aBdefc8b = dnnl_aBdefc8b,
1465  Acb16a = dnnl_Acb16a,
1466  Acb4a = dnnl_Acb4a,
1467  Acb8a = dnnl_Acb8a,
1468  aCBd16b16c = dnnl_aCBd16b16c,
1469  aCBd16c16b = dnnl_aCBd16c16b,
1470  aCBde16b16c = dnnl_aCBde16b16c,
1471  aCBde16c16b = dnnl_aCBde16c16b,
1472  Acdb16a = dnnl_Acdb16a,
1473  Acdb4a = dnnl_Acdb4a,
1474  Acdb8a = dnnl_Acdb8a,
1475  Acdeb16a = dnnl_Acdeb16a,
1476  Acdeb4a = dnnl_Acdeb4a,
1477  Acdeb8a = dnnl_Acdeb8a,
1478  BAc16a16b = dnnl_BAc16a16b,
1479  BAc16b16a = dnnl_BAc16b16a,
1480  BAcd16a16b = dnnl_BAcd16a16b,
1481  BAcd16b16a = dnnl_BAcd16b16a,
1482  ABcd32a32b = dnnl_ABcd32a32b,
1483  BAcde16b16a = dnnl_BAcde16b16a,
1484  BAcde16a16b = dnnl_BAcde16a16b,
1485  aBdec32b = dnnl_aBdec32b,
1486  Abcdef16a = dnnl_Abcdef16a,
1487  Acdb32a = dnnl_Acdb32a,
1488  format_tag_last = dnnl_format_tag_last,
1489 
1490  nCdhw16c = dnnl_nCdhw16c,
1491  nCdhw4c = dnnl_nCdhw4c,
1492  nCdhw8c = dnnl_nCdhw8c,
1493  nChw16c = dnnl_nChw16c,
1494  nChw4c = dnnl_nChw4c,
1495  nChw8c = dnnl_nChw8c,
1496  nCw16c = dnnl_nCw16c,
1497  nCw4c = dnnl_nCw4c,
1498  nCw8c = dnnl_nCw8c,
1499  NCw16n16c = dnnl_NCw16n16c,
1500  NChw16n16c = dnnl_NChw16n16c,
1501  NCdhw16n16c = dnnl_NCdhw16n16c,
1502  NChw32n32c = dnnl_NChw32n32c,
1503  IOhw16i16o = dnnl_IOhw16i16o,
1504  Ohwi32o = dnnl_Ohwi32o,
1505  IOdhw16i16o = dnnl_IOdhw16i16o,
1506  gIOhw16i16o = dnnl_gIOhw16i16o,
1507  gOhwi32o = dnnl_gOhwi32o,
1508  Goidhw16g = dnnl_Goidhw16g,
1509  IOw16o16i = dnnl_IOw16o16i,
1510  OIw16i16o = dnnl_OIw16i16o,
1511  IOw16i16o = dnnl_IOw16i16o,
1512  gIOw16i16o = dnnl_gIOw16i16o,
1513  OIw16o16i = dnnl_OIw16o16i,
1514  Oiw16o = dnnl_Oiw16o,
1515  OIw4i16o4i = dnnl_OIw4i16o4i,
1516  OIw2i8o4i = dnnl_OIw2i8o4i,
1517  OIw4i4o = dnnl_OIw4i4o,
1518  OIw4o4i = dnnl_OIw4o4i,
1519  Oiw4o = dnnl_Oiw4o,
1520  OIw8i16o2i = dnnl_OIw8i16o2i,
1521  OIw8i8o = dnnl_OIw8i8o,
1522  OIw8o16i2o = dnnl_OIw8o16i2o,
1523  OIw8o8i = dnnl_OIw8o8i,
1524  Owi16o = dnnl_Owi16o,
1525  OwI16o2i = dnnl_OwI16o2i,
1526  Owi4o = dnnl_Owi4o,
1527  Owi8o = dnnl_Owi8o,
1528  IOhw16o16i = dnnl_IOhw16o16i,
1529  Ohwi16o = dnnl_Ohwi16o,
1530  OhwI16o2i = dnnl_OhwI16o2i,
1531  Ohwi4o = dnnl_Ohwi4o,
1532  Ohwi8o = dnnl_Ohwi8o,
1533  OIhw16i16o = dnnl_OIhw16i16o,
1534  OIhw16o16i = dnnl_OIhw16o16i,
1535  Oihw16o = dnnl_Oihw16o,
1536  OIhw4i16o4i = dnnl_OIhw4i16o4i,
1537  OIhw4i4o = dnnl_OIhw4i4o,
1538  OIhw4o4i = dnnl_OIhw4o4i,
1539  Oihw4o = dnnl_Oihw4o,
1540  OIhw8i16o2i = dnnl_OIhw8i16o2i,
1541  OIhw8i8o = dnnl_OIhw8i8o,
1542  OIhw8o16i2o = dnnl_OIhw8o16i2o,
1543  OIhw8o8i = dnnl_OIhw8o8i,
1544  OIhw2i8o4i = dnnl_OIhw2i8o4i,
1545  IOdhw16o16i = dnnl_IOdhw16o16i,
1546  Odhwi16o = dnnl_Odhwi16o,
1547  OdhwI16o2i = dnnl_OdhwI16o2i,
1548  Odhwi4o = dnnl_Odhwi4o,
1549  Odhwi8o = dnnl_Odhwi8o,
1550  OIdhw16i16o = dnnl_OIdhw16i16o,
1551  OIdhw16o16i = dnnl_OIdhw16o16i,
1552  Oidhw16o = dnnl_Oidhw16o,
1553  OIdhw4i4o = dnnl_OIdhw4i4o,
1554  OIdhw4o4i = dnnl_OIdhw4o4i,
1555  Oidhw4o = dnnl_Oidhw4o,
1556  OIdhw8i16o2i = dnnl_OIdhw8i16o2i,
1557  OIdhw4i16o4i = dnnl_OIdhw4i16o4i,
1558  OIdhw2i8o4i = dnnl_OIdhw2i8o4i,
1559  OIdhw8i8o = dnnl_OIdhw8i8o,
1560  OIdhw8o8i = dnnl_OIdhw8o8i,
1561  gIOw16o16i = dnnl_gIOw16o16i,
1562  gOIw16i16o = dnnl_gOIw16i16o,
1563  gOIw16o16i = dnnl_gOIw16o16i,
1564  gOiw16o = dnnl_gOiw16o,
1565  gOIw4i16o4i = dnnl_gOIw4i16o4i,
1566  gOIw2i8o4i = dnnl_gOIw2i8o4i,
1567  gOIw4i4o = dnnl_gOIw4i4o,
1568  gOIw4o4i = dnnl_gOIw4o4i,
1569  gOiw4o = dnnl_gOiw4o,
1570  gOIw8i16o2i = dnnl_gOIw8i16o2i,
1571  gOIw8i8o = dnnl_gOIw8i8o,
1572  gOIw8o16i2o = dnnl_gOIw8o16i2o,
1573  gOIw8o8i = dnnl_gOIw8o8i,
1574  gOwi16o = dnnl_gOwi16o,
1575  gOwI16o2i = dnnl_gOwI16o2i,
1576  gOwi4o = dnnl_gOwi4o,
1577  gOwi8o = dnnl_gOwi8o,
1578  Goiw8g = dnnl_Goiw8g,
1579  Goiw16g = dnnl_Goiw16g,
1580  gIOhw16o16i = dnnl_gIOhw16o16i,
1581  gOhwi16o = dnnl_gOhwi16o,
1582  gOhwI16o2i = dnnl_gOhwI16o2i,
1583  gOhwi4o = dnnl_gOhwi4o,
1584  gOhwi8o = dnnl_gOhwi8o,
1585  Goihw16g = dnnl_Goihw16g,
1586  gOIhw16i16o = dnnl_gOIhw16i16o,
1587  gOIhw16o16i = dnnl_gOIhw16o16i,
1588  gOihw16o = dnnl_gOihw16o,
1589  gOIhw4i16o4i = dnnl_gOIhw4i16o4i,
1590  gOIhw2i8o4i = dnnl_gOIhw2i8o4i,
1591  gOIhw4i4o = dnnl_gOIhw4i4o,
1592  gOIhw4o4i = dnnl_gOIhw4o4i,
1593  gOihw4o = dnnl_gOihw4o,
1594  Goihw8g = dnnl_Goihw8g,
1595  gOIhw8i16o2i = dnnl_gOIhw8i16o2i,
1596  gOIhw8i8o = dnnl_gOIhw8i8o,
1597  gOIhw8o16i2o = dnnl_gOIhw8o16i2o,
1598  OIhw4o8i8o4i = dnnl_OIhw4o8i8o4i,
1599  OIhw2o8i8o2i = dnnl_OIhw2o8i8o2i,
1600  gOIhw4o8i8o4i = dnnl_gOIhw4o8i8o4i,
1601  gOIhw2o8i8o2i = dnnl_gOIhw2o8i8o2i,
1602  gOIhw8o8i = dnnl_gOIhw8o8i,
1603  gIOdhw16i16o = dnnl_gIOdhw16i16o,
1604  gIOdhw16o16i = dnnl_gIOdhw16o16i,
1605  gOdhwi16o = dnnl_gOdhwi16o,
1606  gOdhwI16o2i = dnnl_gOdhwI16o2i,
1607  gOdhwi4o = dnnl_gOdhwi4o,
1608  gOdhwi8o = dnnl_gOdhwi8o,
1609  gOIdhw16i16o = dnnl_gOIdhw16i16o,
1610  gOIdhw16o16i = dnnl_gOIdhw16o16i,
1611  gOidhw16o = dnnl_gOidhw16o,
1612  gOIdhw4i4o = dnnl_gOIdhw4i4o,
1613  gOIdhw4o4i = dnnl_gOIdhw4o4i,
1614  gOidhw4o = dnnl_gOidhw4o,
1615  gOIdhw8i16o2i = dnnl_gOIdhw8i16o2i,
1616  gOIdhw4i16o4i = dnnl_gOIdhw4i16o4i,
1617  gOIdhw2i8o4i = dnnl_gOIdhw2i8o4i,
1618  gOIdhw8i8o = dnnl_gOIdhw8i8o,
1619  gOIdhw8o8i = dnnl_gOIdhw8o8i,
1620  };
1621 
1623  struct desc {
1624  friend struct memory;
1627 
1630  desc() : data() {}
1631 
1647  format_tag format_tag, bool allow_empty = false)
1648  : data() {
1649  validate_dims(dims);
1651  (int)dims.size(), dims.data(), convert_to_c(data_type),
1653  if (!allow_empty)
1655  "could not construct a memory descriptor using a "
1656  "format tag");
1657  }
1658 
1674  const memory::dims &strides, bool allow_empty = false)
1675  : data() {
1676  validate_dims(dims);
1677  if (!strides.empty()) validate_dims(strides, (int)dims.size());
1679  (int)dims.size(), dims.data(), convert_to_c(data_type),
1680  strides.empty() ? nullptr : &strides[0]);
1681  if (!allow_empty)
1683  "could not construct a memory descriptor using "
1684  "strides");
1685  }
1686 
1690  desc(const dnnl_memory_desc_t &data) : data(data) {}
1691 
1694  //
1704  const memory::dims &offsets, bool allow_empty = false) const {
1705  validate_dims(dims, data.ndims);
1706  validate_dims(offsets, data.ndims);
1709  &sub_md, &data, dims.data(), offsets.data());
1710  if (!allow_empty)
1711  error::wrap_c_api(status, "could not construct a sub-memory");
1712  return desc(sub_md);
1713  }
1714 
1759  desc reshape(const memory::dims &dims, bool allow_empty = false) const {
1760  if (data.ndims) validate_dims(dims, 1);
1763  &out_md, &data, (int)dims.size(), dims.data());
1764  if (!allow_empty)
1766  status, "could not reshape a memory descriptor");
1767  return desc(out_md);
1768  }
1769 
1806  desc permute_axes(const std::vector<int> &permutation,
1807  bool allow_empty = false) const {
1808  validate_dims(permutation, data.ndims);
1811  &out_md, &data, permutation.data());
1812  if (!allow_empty)
1814  "could not permute axes of a memory descriptor");
1815  return desc(out_md);
1816  }
1817 
1822  memory::dims dims() const {
1823  return memory::dims(data.dims, data.dims + data.ndims);
1824  }
1825 
1829  return static_cast<memory::data_type>(data.data_type);
1830  }
1831 
1836  size_t get_size() const { return dnnl_memory_desc_get_size(&data); }
1837 
1841  bool is_zero() const { return data.ndims == 0; }
1842 
1847  bool operator==(const desc &other) const {
1848  return dnnl_memory_desc_equal(&data, &other.data) != 0;
1849  }
1850 
1855  bool operator!=(const desc &other) const { return !operator==(other); }
1856  };
1857 
1858  // Default constructor.
1859  //
1860  // Constructs an empty memory object, which can be used to indicate absence
1861  // of a parameter.
1862  memory() = default;
1863 
1883  memory(const desc &md, const engine &engine, void *handle) {
1884  dnnl_memory_t result;
1886  dnnl_memory_create(&result, &md.data, engine.get(), handle),
1887  "could not create a memory object");
1888  reset(result);
1889  }
1890 
1897  memory(const desc &md, const engine &engine)
1898  : memory(md, engine, DNNL_MEMORY_ALLOCATE) {}
1899 
1901  desc get_desc() const {
1902  const dnnl_memory_desc_t *cdesc;
1904  "could not get a memory descriptor from a memory object");
1905  return desc(*cdesc);
1906  }
1907 
1909  engine get_engine() const {
1910  dnnl_engine_t c_engine;
1911  error::wrap_c_api(dnnl_memory_get_engine(get(), &c_engine),
1912  "could not get an engine from a memory object");
1913  return engine(c_engine, true);
1914  }
1915 
1919  void *get_data_handle() const {
1920  void *handle;
1922  "could not get a native handle from a memory object");
1923  return handle;
1924  }
1925 
1952  void set_data_handle(void *handle) const {
1954  "could not set native handle of a memory object");
1955  }
1956 
1976  template <typename T = void>
1977  T *map_data() const {
1978  void *mapped_ptr;
1979  error::wrap_c_api(dnnl_memory_map_data(get(), &mapped_ptr),
1980  "could not map memory object data");
1981  return static_cast<T *>(mapped_ptr);
1982  }
1983 
1995  void unmap_data(void *mapped_ptr) const {
1996  error::wrap_c_api(dnnl_memory_unmap_data(get(), mapped_ptr),
1997  "could not unmap memory object data");
1998  }
1999 
2000 #if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL
2001  cl_mem get_ocl_mem_object() const {
2003  cl_mem mem_object;
2005  "could not get OpenCL buffer object from a memory object");
2006  return mem_object;
2007  }
2008 
2016  void set_ocl_mem_object(cl_mem mem_object) {
2018  "could not set OpenCL buffer object from a memory object");
2019  }
2020 #endif
2021 
2022  static dnnl_data_type_t convert_to_c(data_type data_type) {
2023  return static_cast<dnnl_data_type_t>(data_type);
2024  }
2025  static dnnl_format_tag_t convert_to_c(format_tag format) {
2026  return static_cast<dnnl_format_tag_t>(format);
2027  }
2028 };
2029 
2030 inline bool operator==(dnnl_data_type_t a, memory::data_type b) {
2031  return a == memory::convert_to_c(b);
2032 }
2033 inline bool operator!=(dnnl_data_type_t a, memory::data_type b) {
2034  return !(a == b);
2035 }
2036 inline bool operator==(memory::data_type a, dnnl_data_type_t b) {
2037  return b == a;
2038 }
2039 inline bool operator!=(memory::data_type a, dnnl_data_type_t b) {
2040  return !(a == b);
2041 }
2042 
2043 inline bool operator==(dnnl_format_tag_t a, memory::format_tag b) {
2044  return a == memory::convert_to_c(b);
2045 }
2046 inline bool operator!=(dnnl_format_tag_t a, memory::format_tag b) {
2047  return !(a == b);
2048 }
2049 inline bool operator==(memory::format_tag a, dnnl_format_tag_t b) {
2050  return b == a;
2051 }
2052 inline bool operator!=(memory::format_tag a, dnnl_format_tag_t b) {
2053  return !(a == b);
2054 }
2055 
2057 
2065 
2067 template <>
2068 struct handle_traits<dnnl_post_ops_t> {
2069  static dnnl_status_t destructor(dnnl_post_ops_t p) {
2070  return dnnl_post_ops_destroy(p);
2071  }
2072 };
2074 
2082 struct post_ops : public handle<dnnl_post_ops_t> {
2084 
2087  dnnl_post_ops_t result;
2089  dnnl_post_ops_create(&result), "could not create post-ops");
2090  reset(result);
2091  }
2092 
2094  int len() const { return dnnl_post_ops_len(get()); }
2095 
2099  primitive::kind kind(int index) const {
2101  "post-ops index is out of range");
2102  return static_cast<primitive::kind>(
2103  dnnl_post_ops_get_kind(get(), index));
2104  }
2105 
2128  void append_sum(float scale = 1.) {
2130  "could not append a sum post-op");
2131  }
2132 
2137  void get_params_sum(int index, float &scale) const {
2138  error::wrap_c_api(dnnl_post_ops_get_params_sum(get(), index, &scale),
2139  "could not get parameters of a sum post-op");
2140  }
2141 
2158  float scale, algorithm algorithm, float alpha, float beta) {
2160  convert_to_c(algorithm), alpha, beta),
2161  "could not append an elementwise post-op");
2162  }
2163 
2171  void get_params_eltwise(int index, float &scale, algorithm &algorithm,
2172  float &alpha, float &beta) const {
2173  dnnl_alg_kind_t c_alg;
2175  get(), index, &scale, &c_alg, &alpha, &beta),
2176  "could not get parameters of an elementwise post-op");
2177  algorithm = static_cast<dnnl::algorithm>(c_alg);
2178  }
2179 
2208  void append_dw_k3s1p1(memory::data_type weights_data_type,
2209  memory::data_type bias_data_type, memory::data_type dst_data_type,
2210  int mask, const std::vector<float> &scales) {
2211 
2213  memory::convert_to_c(weights_data_type),
2214  memory::convert_to_c(bias_data_type),
2215  memory::convert_to_c(dst_data_type),
2216  scales.size(), mask, &scales[0]),
2217  "could not append depthwise post-op");
2218  }
2219 
2234  void get_params_dw_k3s1p1(int index, memory::data_type &weights_data_type,
2235  memory::data_type &bias_data_type, memory::data_type &dst_data_type,
2236  int &mask, std::vector<float> &scales) const {
2237 
2238  dnnl_data_type_t c_weights_data_type;
2239  dnnl_data_type_t c_bias_data_type;
2240  dnnl_data_type_t c_dst_data_type;
2241  dnnl_dim_t count;
2242  int c_mask;
2243  const float *c_scales;
2245  &c_weights_data_type, &c_bias_data_type,
2246  &c_dst_data_type, &count, &c_mask, &c_scales),
2247  "could not get parameters of depthwise post-op");
2248 
2249  weights_data_type = static_cast<memory::data_type>(c_weights_data_type);
2250  bias_data_type = static_cast<memory::data_type>(c_bias_data_type);
2251  dst_data_type = static_cast<memory::data_type>(c_dst_data_type);
2252  scales.resize(count);
2253 
2254  mask = c_mask;
2255  for (dnnl_dim_t c = 0; c < count; ++c)
2256  scales[c] = c_scales[c];
2257  return;
2258  }
2259 
2293  void append_dw_k3s2p1(memory::data_type weights_data_type,
2294  memory::data_type bias_data_type, memory::data_type dst_data_type,
2295  int mask, const std::vector<float> &scales) {
2296 
2298  memory::convert_to_c(weights_data_type),
2299  memory::convert_to_c(bias_data_type),
2300  memory::convert_to_c(dst_data_type),
2301  scales.size(), mask, &scales[0]),
2302  "could not append depthwise post-op");
2303  }
2304 
2319  void get_params_dw_k3s2p1(int index, memory::data_type &weights_data_type,
2320  memory::data_type &bias_data_type, memory::data_type &dst_data_type,
2321  int &mask, std::vector<float> &scales) const {
2322 
2323  dnnl_data_type_t c_weights_data_type;
2324  dnnl_data_type_t c_bias_data_type;
2325  dnnl_data_type_t c_dst_data_type;
2326  dnnl_dim_t count;
2327  int c_mask;
2328  const float *c_scales;
2330  &c_weights_data_type, &c_bias_data_type,
2331  &c_dst_data_type, &count, &c_mask, &c_scales),
2332  "could not get parameters of depthwise post-op");
2333 
2334  weights_data_type = static_cast<memory::data_type>(c_weights_data_type);
2335  bias_data_type = static_cast<memory::data_type>(c_bias_data_type);
2336  dst_data_type = static_cast<memory::data_type>(c_dst_data_type);
2337  scales.resize(count);
2338 
2339  mask = c_mask;
2340  for (dnnl_dim_t c = 0; c < count; ++c)
2341  scales[c] = c_scales[c];
2342  return;
2343  }
2344 };
2345 
2347 template <>
2348 struct handle_traits<dnnl_primitive_attr_t> {
2349  static dnnl_status_t destructor(dnnl_primitive_attr_t p) {
2350  return dnnl_primitive_attr_destroy(p);
2351  }
2352 };
2354 
2358 struct primitive_attr : public handle<dnnl_primitive_attr_t> {
2360 
2363  dnnl_primitive_attr_t result;
2365  "could not create primitive attribute");
2366  reset(result);
2367  }
2368 
2375  : handle<dnnl_primitive_attr_t>(attr) {}
2376 
2379  dnnl_scratchpad_mode_t result;
2382  "could not get primitive scratchpad mode attribute");
2383  return scratchpad_mode(result);
2384  }
2385 
2391  get(), dnnl::convert_to_c(mode)),
2392  "could not set primitive scratchpad mode attribute");
2393  }
2394 
2404  void get_output_scales(int &mask, std::vector<float> &scales) const {
2405  dnnl_dim_t count;
2406  int c_mask;
2407  const float *c_scales;
2409  get(), &count, &c_mask, &c_scales),
2410  "could not get primitive output scales attribute");
2411  scales.resize(count);
2412 
2413  mask = c_mask;
2414  for (dnnl_dim_t c = 0; c < count; ++c)
2415  scales[c] = c_scales[c];
2416  }
2417 
2460  void set_output_scales(int mask, const std::vector<float> &scales) {
2463  get(), (dnnl_dim_t)scales.size(), mask, scales.data()),
2464  "could not set primitive output scales attribute");
2465  }
2466 
2478  void get_scales(int arg, int &mask, std::vector<float> &scales) const {
2479  dnnl_dim_t count;
2480  int c_mask;
2481  const float *c_scales;
2483  get(), arg, &count, &c_mask, &c_scales),
2484  "could not get scales");
2485  scales.resize(count);
2486 
2487  mask = c_mask;
2488  for (dnnl_dim_t c = 0; c < count; ++c)
2489  scales[c] = c_scales[c];
2490  }
2491 
2508  void set_scales(int arg, int mask, const std::vector<float> &scales) {
2510  dnnl_primitive_attr_set_scales(get(), arg,
2511  (dnnl_dim_t)scales.size(), mask, scales.data()),
2512  "could not set scales");
2513  }
2514 
2526  int arg, int &mask, std::vector<int32_t> &zero_points) const {
2527  dnnl_dim_t count;
2528  int c_mask;
2529  const int32_t *c_zero_points;
2531  get(), arg, &count, &c_mask, &c_zero_points),
2532  "could not get primitive zero points attribute");
2533  zero_points.resize(count);
2534 
2535  mask = c_mask;
2536  for (dnnl_dim_t c = 0; c < count; ++c)
2537  zero_points[c] = c_zero_points[c];
2538  }
2539 
2561  int arg, int mask, const std::vector<int32_t> &zero_points) {
2563  (dnnl_dim_t)zero_points.size(), mask,
2564  zero_points.data()),
2565  "could not set primitive zero points attribute");
2566  }
2567 
2571  const post_ops get_post_ops() const {
2572  post_ops result;
2573  const_dnnl_post_ops_t c_result;
2575  "could not get primitive post-ops attribute");
2576  result.reset(const_cast<dnnl_post_ops_t>(c_result), true);
2577  return result;
2578  }
2579 
2588  void set_post_ops(const post_ops ops) {
2590  "could not set primitive post-ops attribute");
2591  }
2592 
2626  void set_rnn_data_qparams(float scale, float shift) {
2628  dnnl_primitive_attr_set_rnn_data_qparams(get(), scale, shift),
2629  "could not get primitive RNN data quantization parameters "
2630  "attributes");
2631  }
2632 
2659  void set_rnn_weights_qparams(int mask, const std::vector<float> &scales) {
2661  (int)scales.size(), mask, scales.data()),
2662  "could not get primitive RNN weights quantization parameters "
2663  "attributes");
2664  }
2665 };
2666 
2668 
2671 
2673 struct primitive_desc_base : public handle<dnnl_primitive_desc_t> {
2675 
2677  primitive_desc_base() = default;
2678 
2681  engine get_engine() const { return engine::query(*this); }
2682 
2685  const char *impl_info_str() const {
2686  const char *res;
2688  get(), dnnl_query_impl_info_str, 0, &res),
2689  "could not retrieve implementation info string from a "
2690  "primitive descriptor");
2691  return res;
2692  }
2693 
2698  memory::dim res;
2700  get(), dnnl::convert_to_c(what), 0, &res);
2701  return status == dnnl_success ? res : 0;
2702  }
2703 
2718  memory::desc query_md(query what, int idx = 0) const {
2719  std::vector<query> valid_q {query::src_md, query::diff_src_md,
2723  if (!std::any_of(valid_q.cbegin(), valid_q.cend(),
2724  [=](query q) { return what == q; }))
2725  DNNL_THROW_ERROR(dnnl_invalid_arguments,
2726  "memory descriptor query is invalid");
2727 
2729  get(), dnnl::convert_to_c(what), idx);
2730  return cdesc ? memory::desc(*cdesc) : memory::desc();
2731  }
2732 
2738  memory::desc src_desc(int idx) const {
2739  return query_md(query::src_md, idx);
2740  }
2741 
2747  memory::desc dst_desc(int idx) const {
2748  return query_md(query::dst_md, idx);
2749  }
2750 
2756  memory::desc weights_desc(int idx) const {
2757  return query_md(query::weights_md, idx);
2758  }
2759 
2765  memory::desc diff_src_desc(int idx) const {
2766  return query_md(query::diff_src_md, idx);
2767  }
2768 
2774  memory::desc diff_dst_desc(int idx) const {
2775  return query_md(query::diff_dst_md, idx);
2776  }
2777 
2784  return query_md(query::diff_weights_md, idx);
2785  }
2786 
2787  // Separate versions without the index argument for documentation
2788  // purposes.
2789 
2794  memory::desc src_desc() const { return src_desc(0); }
2795 
2800  memory::desc dst_desc() const { return dst_desc(0); }
2801 
2806  memory::desc weights_desc() const { return weights_desc(0); }
2807 
2813 
2819 
2825 
2831  return query_md(query::workspace_md, 0);
2832  }
2833 
2840  return query_md(query::scratchpad_md, 0);
2841  }
2842 
2846  dnnl_engine_t c_engine;
2849  0, &c_engine),
2850  "could not retrieve scratchpad engine from a primitive "
2851  "descriptor");
2852  return engine(c_engine, true);
2853  }
2854 
2858  const_dnnl_primitive_attr_t const_c_attr;
2859  error::wrap_c_api(dnnl_primitive_desc_get_attr(get(), &const_c_attr),
2860  "could not get attributes from a primitive descriptor");
2861  dnnl_primitive_attr_t c_attr;
2862  error::wrap_c_api(dnnl_primitive_attr_clone(&c_attr, const_c_attr),
2863  "could not clone primitive attributes");
2864  return primitive_attr(c_attr);
2865  }
2866 
2870  dnnl_primitive_kind_t kind;
2872  dnnl_query_primitive_kind, 0, (void *)&kind),
2873  "could not get primitive kind from a primitive descriptor");
2874  return static_cast<dnnl::primitive::kind>(kind);
2875  }
2876 
2877 protected:
2882  dnnl_primitive_desc_t new_pd;
2884  "could not clone a primitive descriptor");
2885  reset(new_pd);
2886  }
2887 
2903  : primitive_desc_base(pd, prim_kind, dnnl::prop_kind::undef) {}
2904 
2918  : primitive_desc_base(pd, prim_kind, prop_kind, prop_kind) {}
2919 
2934  dnnl::primitive::kind prim_kind, dnnl::prop_kind prop_kind1,
2935  dnnl::prop_kind prop_kind2) {
2936  // It is OK to pass an empty primitive descriptor
2937  if (pd == nullptr) return;
2938 
2939  dnnl_status_t rc;
2940 
2941  dnnl_primitive_kind_t c_prim_kind = convert_to_c(prim_kind);
2942  dnnl_prop_kind_t c_prop_kind1 = convert_to_c(prop_kind1);
2943  dnnl_prop_kind_t c_prop_kind2 = convert_to_c(prop_kind2);
2944 
2945  // Check that primitive kind matches
2946  dnnl_primitive_kind_t pd_kind;
2948  pd, dnnl_query_primitive_kind, 0, (void *)&pd_kind);
2950  rc, "could not get primitive kind from a primitive descriptor");
2951  if (pd_kind != c_prim_kind)
2952  DNNL_THROW_ERROR(dnnl_invalid_arguments,
2953  "primitive descriptor operation kind mismatch");
2954 
2955  // Check that propagation kind matches
2956  dnnl_prop_kind_t pd_prop_kind;
2958  pd, dnnl_query_prop_kind, 0, (void *)&pd_prop_kind);
2959 
2960  // Something went wrong
2961  if (rc != dnnl_success && rc != dnnl_unimplemented)
2962  DNNL_THROW_ERROR(dnnl_invalid_arguments,
2963  "could not get propagation kind from the primitive "
2964  "descriptor");
2965 
2966  // Everything is fine
2967  if ((rc == dnnl_unimplemented && c_prop_kind1 == dnnl_prop_kind_undef)
2968  || (rc == dnnl_success
2969  && (pd_prop_kind == c_prop_kind1
2970  || pd_prop_kind == c_prop_kind2))) {
2971  reset_with_clone(pd);
2972  return;
2973  }
2974 
2975  // We could get the propagation kind but there is a mismatch
2976  DNNL_THROW_ERROR(dnnl_invalid_arguments,
2977  "primitive descriptor propagation kind mismatch");
2978  }
2979 
2980  using base = primitive_desc_base;
2981 };
2982 
2984 
2993 
2995 struct reorder : public primitive {
2999 
3001  primitive_desc() = default;
3002 
3018  primitive_desc(const engine &src_engine, const memory::desc &src_md,
3019  const engine &dst_engine, const memory::desc &dst_md,
3020  const primitive_attr &attr = primitive_attr()) {
3021  dnnl_primitive_desc_t result;
3024  src_engine.get(), &dst_md.data, dst_engine.get(),
3025  attr.get()),
3026  "could not create a primitive descriptor for a reorder "
3027  "primitive");
3028  reset(result);
3029  }
3030 
3038  primitive_desc(const memory &src, const memory &dst,
3039  const primitive_attr &attr = primitive_attr()) {
3040  dnnl_primitive_desc_t result;
3041  auto src_md = src.get_desc();
3042  auto dst_md = dst.get_desc();
3045  src.get_engine().get(), &dst_md.data,
3046  dst.get_engine().get(), attr.get()),
3047  "could not create a primitive descriptor for a reorder "
3048  "primitive");
3049  reset(result);
3050  }
3051 
3058 
3063  }
3064 
3069  }
3070 
3072  memory::desc src_desc() const { return base::src_desc(0); }
3073 
3075  memory::desc dst_desc() const { return base::dst_desc(0); }
3076  };
3077 
3079  reorder() = default;
3080 
3083  reorder(const primitive_desc &pd) : primitive(pd.get()) {}
3084 
3092  reorder(const memory &src, const memory &dst,
3093  const primitive_attr &attr = primitive_attr())
3094  : primitive(primitive_desc(src, dst, attr).get()) {}
3095 
3096  using primitive::execute;
3097 
3104  void execute(stream stream, memory &src, memory &dst) const {
3106  }
3107 };
3108 
3110 
3118 
3120 inline std::vector<dnnl_memory_desc_t> convert_to_c(
3121  const std::vector<memory::desc> &mems) {
3122  std::vector<dnnl_memory_desc_t> c_mems;
3123  c_mems.reserve(mems.size());
3124  for (const auto &s : mems)
3125  c_mems.push_back(s.data);
3126  return c_mems;
3127 }
3129 
3131 struct concat : public primitive {
3135 
3137  primitive_desc() = default;
3138 
3158  primitive_desc(const memory::desc &dst, int concat_dimension,
3159  const std::vector<memory::desc> &srcs, const engine &engine,
3160  const primitive_attr &attr = primitive_attr()) {
3161  auto c_srcs = convert_to_c(srcs);
3162 
3163  dnnl_primitive_desc_t result;
3166  (int)c_srcs.size(), concat_dimension, c_srcs.data(),
3167  attr.get(), engine.get()),
3168  "could not create a primitive descriptor for a concat "
3169  "primitive");
3170  reset(result);
3171  }
3172 
3185  primitive_desc(int concat_dimension,
3186  const std::vector<memory::desc> &srcs, const engine &engine,
3187  const primitive_attr &attr = primitive_attr()) {
3188  auto c_api_srcs = convert_to_c(srcs);
3189 
3190  dnnl_primitive_desc_t result;
3192  dnnl_concat_primitive_desc_create(&result, nullptr,
3193  (int)c_api_srcs.size(), concat_dimension,
3194  c_api_srcs.data(), attr.get(), engine.get()),
3195  "could not create a primitive descriptor for a concat "
3196  "primitive");
3197  reset(result);
3198  }
3199 
3206 
3208  memory::desc src_desc(int idx = 0) const { return base::src_desc(idx); }
3209 
3211  memory::desc dst_desc() const { return base::dst_desc(0); }
3212  };
3213 
3215  concat() = default;
3216 
3219  concat(const primitive_desc &pd) : primitive(pd.get()) {}
3220 };
3221 
3223 
3231 
3233 struct sum : public primitive {
3237 
3239  primitive_desc() = default;
3240 
3259  const std::vector<float> &scales,
3260  const std::vector<memory::desc> &srcs, const engine &engine,
3261  const primitive_attr &attr = primitive_attr()) {
3262  validate_container_size(scales,
3263  "counts of scales and sources are not equal",
3264  (int)srcs.size(), (int)srcs.size());
3265 
3266  auto c_api_srcs = convert_to_c(srcs);
3267 
3268  dnnl_primitive_desc_t result;
3270  dnnl_sum_primitive_desc_create(&result, &dst.data,
3271  (int)c_api_srcs.size(), scales.data(),
3272  c_api_srcs.data(), attr.get(), engine.get()),
3273  "could not create a primitive descriptor for a sum "
3274  "primitive");
3275  reset(result);
3276  }
3277 
3288  primitive_desc(const std::vector<float> &scales,
3289  const std::vector<memory::desc> &srcs, const engine &engine,
3290  const primitive_attr &attr = primitive_attr()) {
3291  validate_container_size(scales,
3292  "counts of scales and sources are not equal",
3293  (int)srcs.size(), (int)srcs.size());
3294 
3295  auto c_api_srcs = convert_to_c(srcs);
3296  dnnl_primitive_desc_t result;
3298  dnnl_sum_primitive_desc_create(&result, nullptr,
3299  (int)c_api_srcs.size(), scales.data(),
3300  c_api_srcs.data(), attr.get(), engine.get()),
3301  "could not create a primitive descriptor for a sum "
3302  "primitive");
3303  reset(result);
3304  }
3305 
3312 
3314  memory::desc src_desc(int idx = 0) const { return base::src_desc(idx); }
3315 
3317  memory::desc dst_desc() const { return base::dst_desc(0); }
3318  };
3319 
3321  sum() = default;
3322 
3325  sum(const primitive_desc &pd) : primitive(pd.get()) {}
3326 };
3327 
3329 
3332 
3337 
3338  primitive_desc() = default;
3339 
3363  const engine &engine, const_dnnl_primitive_desc_t hint_fwd_pd,
3364  bool allow_empty = false)
3365  : allow_empty_(allow_empty) {
3366  dnnl_primitive_desc_iterator_t iterator = nullptr;
3368  desc, attr ? attr->get() : nullptr, engine.get(), hint_fwd_pd);
3369  if (!allow_empty)
3371  status, "could not create a primitive descriptor iterator");
3372  pd_iterator.reset(iterator);
3373  fetch_impl();
3374  }
3375 
3380  bool next_impl() {
3382  = dnnl_primitive_desc_iterator_next(pd_iterator.get());
3383  if (status == dnnl_iterator_ends) return false;
3385  status, "could not advance a primitive descriptor iterator");
3386  fetch_impl();
3387  return true;
3388  }
3389 
3390 private:
3391  bool allow_empty_ = false;
3393  void fetch_impl() {
3395  pd_iterator.get(allow_empty_));
3396  error::wrap_c_api(pd != nullptr || allow_empty_ ? dnnl_success
3398  "could not fetch a primitive descriptor from a primitive "
3399  "descriptor iterator");
3400  reset(pd);
3401  }
3402 };
3403 
3405 
3415 
3419  struct desc {
3421 
3455  const memory::desc &src_desc, const memory::desc &weights_desc,
3456  const memory::desc &bias_desc, const memory::desc &dst_desc,
3457  const memory::dims &strides, const memory::dims &padding_l,
3458  const memory::dims &padding_r) {
3459  memory::validate_dims(strides, src_desc.data.ndims - 2);
3460  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
3461  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
3465  convert_to_c(algorithm), &src_desc.data,
3466  &weights_desc.data, &bias_desc.data, &dst_desc.data,
3467  &strides[0], &padding_l[0], &padding_r[0]),
3468  "could not create a descriptor for a convolution forward "
3469  "propagation primitive");
3470  }
3471 
3502  const memory::desc &src_desc, const memory::desc &weights_desc,
3503  const memory::desc &dst_desc, const memory::dims &strides,
3504  const memory::dims &padding_l, const memory::dims &padding_r) {
3505  memory::validate_dims(strides, src_desc.data.ndims - 2);
3506  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
3507  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
3511  convert_to_c(algorithm), &src_desc.data,
3512  &weights_desc.data, nullptr, &dst_desc.data,
3513  &strides[0], &padding_l[0], &padding_r[0]),
3514  "could not create a descriptor for a convolution forward "
3515  "propagation primitive");
3516  }
3517 
3553  const memory::desc &src_desc, const memory::desc &weights_desc,
3554  const memory::desc &bias_desc, const memory::desc &dst_desc,
3555  const memory::dims &strides, const memory::dims &dilates,
3556  const memory::dims &padding_l, const memory::dims &padding_r) {
3557  memory::validate_dims(strides, src_desc.data.ndims - 2);
3558  memory::validate_dims(dilates, src_desc.data.ndims - 2);
3559  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
3560  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
3563  convert_to_c(algorithm), &src_desc.data,
3564  &weights_desc.data, &bias_desc.data,
3565  &dst_desc.data, &strides[0], &dilates[0],
3566  &padding_l[0], &padding_r[0]),
3567  "could not create a descriptor for a dilated convolution "
3568  "forward propagation primitive");
3569  }
3570 
3603  const memory::desc &src_desc, const memory::desc &weights_desc,
3604  const memory::desc &dst_desc, const memory::dims &strides,
3605  const memory::dims &dilates, const memory::dims &padding_l,
3606  const memory::dims &padding_r) {
3607  memory::validate_dims(strides, src_desc.data.ndims - 2);
3608  memory::validate_dims(dilates, src_desc.data.ndims - 2);
3609  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
3610  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
3613  convert_to_c(algorithm), &src_desc.data,
3614  &weights_desc.data, nullptr,
3615  &dst_desc.data, &strides[0], &dilates[0],
3616  &padding_l[0], &padding_r[0]),
3617  "could not create a descriptor for a dilated convolution "
3618  "forward propagation primitive");
3619  }
3620  };
3621 
3625  primitive_desc() = default;
3626 
3638  bool allow_empty = false)
3639  : dnnl::primitive_desc(
3640  &desc.data, nullptr, engine, nullptr, allow_empty) {}
3641 
3654  const engine &engine, bool allow_empty = false)
3655  : dnnl::primitive_desc(
3656  &desc.data, &attr, engine, nullptr, allow_empty) {}
3657 
3665  : dnnl::primitive_desc(pd, dnnl::primitive::kind::convolution,
3668 
3670  memory::desc src_desc() const { return base::src_desc(0); }
3671 
3674 
3676  memory::desc dst_desc() const { return base::dst_desc(0); }
3677 
3683  };
3684 
3686  convolution_forward() = default;
3687 
3692 };
3693 
3696 
3698  struct desc {
3700 
3727  desc(algorithm algorithm, const memory::desc &diff_src_desc,
3728  const memory::desc &weights_desc,
3729  const memory::desc &diff_dst_desc, const memory::dims &strides,
3730  const memory::dims &padding_l, const memory::dims &padding_r) {
3731  memory::validate_dims(strides, diff_src_desc.data.ndims - 2);
3732  memory::validate_dims(padding_l, diff_src_desc.data.ndims - 2);
3733  memory::validate_dims(padding_r, diff_src_desc.data.ndims - 2);
3736  convert_to_c(algorithm), &diff_src_desc.data,
3737  &weights_desc.data, &diff_dst_desc.data,
3738  &strides[0], &padding_l[0], &padding_r[0]),
3739  "could not create a descriptor for a convolution backward "
3740  "propagation primitive");
3741  }
3742 
3771  desc(algorithm algorithm, const memory::desc &diff_src_desc,
3772  const memory::desc &weights_desc,
3773  const memory::desc &diff_dst_desc, const memory::dims &strides,
3774  const memory::dims &dilates, const memory::dims &padding_l,
3775  const memory::dims &padding_r) {
3776  memory::validate_dims(strides, diff_src_desc.data.ndims - 2);
3777  memory::validate_dims(dilates, diff_src_desc.data.ndims - 2);
3778  memory::validate_dims(padding_l, diff_src_desc.data.ndims - 2);
3779  memory::validate_dims(padding_r, diff_src_desc.data.ndims - 2);
3782  convert_to_c(algorithm), &diff_src_desc.data,
3783  &weights_desc.data, &diff_dst_desc.data,
3784  &strides[0], &dilates[0], &padding_l[0],
3785  &padding_r[0]),
3786  "could not create a descriptor for a dilated convolution "
3787  "backward propagation primitive");
3788  }
3789  };
3790 
3794  primitive_desc() = default;
3795 
3810  const convolution_forward::primitive_desc &hint_fwd_pd,
3811  bool allow_empty = false)
3812  : dnnl::primitive_desc(&desc.data, nullptr, engine,
3813  hint_fwd_pd.get(), allow_empty) {}
3814 
3830  const engine &engine,
3831  const convolution_forward::primitive_desc &hint_fwd_pd,
3832  bool allow_empty = false)
3833  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
3834  allow_empty) {}
3835 
3843  : dnnl::primitive_desc(pd, dnnl::primitive::kind::convolution,
3845 
3848 
3851 
3854  };
3855 
3857  convolution_backward_data() = default;
3858 
3863 };
3864 
3868  struct desc {
3870 
3901  const memory::desc &diff_weights_desc,
3902  const memory::desc &diff_bias_desc,
3903  const memory::desc &diff_dst_desc, const memory::dims &strides,
3904  const memory::dims &padding_l, const memory::dims &padding_r) {
3905  memory::validate_dims(strides, src_desc.data.ndims - 2);
3906  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
3907  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
3910  convert_to_c(algorithm), &src_desc.data,
3911  &diff_weights_desc.data, &diff_bias_desc.data,
3912  &diff_dst_desc.data, &strides[0], &padding_l[0],
3913  &padding_r[0]),
3914  "could not create a descriptor for a convolution weights "
3915  "update primitive");
3916  }
3917 
3945  const memory::desc &diff_weights_desc,
3946  const memory::desc &diff_dst_desc, const memory::dims &strides,
3947  const memory::dims &padding_l, const memory::dims &padding_r) {
3948  memory::validate_dims(strides, src_desc.data.ndims - 2);
3949  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
3950  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
3952  convert_to_c(algorithm), &src_desc.data,
3953  &diff_weights_desc.data, nullptr,
3954  &diff_dst_desc.data, &strides[0],
3955  &padding_l[0], &padding_r[0]),
3956  "could not create a descriptor for a convolution weights "
3957  "update primitive");
3958  }
3959 
3992  const memory::desc &diff_weights_desc,
3993  const memory::desc &diff_bias_desc,
3994  const memory::desc &diff_dst_desc, const memory::dims &strides,
3995  const memory::dims &dilates, const memory::dims &padding_l,
3996  const memory::dims &padding_r) {
3997  memory::validate_dims(strides, src_desc.data.ndims - 2);
3998  memory::validate_dims(dilates, src_desc.data.ndims - 2);
3999  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
4000  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
4003  convert_to_c(algorithm), &src_desc.data,
4004  &diff_weights_desc.data, &diff_bias_desc.data,
4005  &diff_dst_desc.data, &strides[0], &dilates[0],
4006  &padding_l[0], &padding_r[0]),
4007  "could not create a descriptor for a dilated convolution "
4008  "weights gradient primitive");
4009  }
4010 
4040  const memory::desc &diff_weights_desc,
4041  const memory::desc &diff_dst_desc, const memory::dims &strides,
4042  const memory::dims &dilates, const memory::dims &padding_l,
4043  const memory::dims &padding_r) {
4044  memory::validate_dims(strides, src_desc.data.ndims - 2);
4045  memory::validate_dims(dilates, src_desc.data.ndims - 2);
4046  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
4047  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
4050  convert_to_c(algorithm), &src_desc.data,
4051  &diff_weights_desc.data, nullptr,
4052  &diff_dst_desc.data, &strides[0], &dilates[0],
4053  &padding_l[0], &padding_r[0]),
4054  "could not create a descriptor for a dilated convolution "
4055  "weights gradient primitive");
4056  }
4057  };
4058 
4062  primitive_desc() = default;
4063 
4077  const convolution_forward::primitive_desc &hint_fwd_pd,
4078  bool allow_empty = false)
4079  : dnnl::primitive_desc(&desc.data, nullptr, engine,
4080  hint_fwd_pd.get(), allow_empty) {}
4081 
4096  const engine &engine,
4097  const convolution_forward::primitive_desc &hint_fwd_pd,
4098  bool allow_empty = false)
4099  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
4100  allow_empty) {}
4101 
4109  : dnnl::primitive_desc(pd, dnnl::primitive::kind::convolution,
4111 
4113  memory::desc src_desc() const { return base::src_desc(0); }
4114 
4117  return base::diff_weights_desc(0);
4118  }
4119 
4122 
4128  return base::diff_weights_desc(1);
4129  }
4130  };
4131 
4133  convolution_backward_weights() = default;
4134 
4139 };
4140 
4142 //
4150 
4154  struct desc {
4156 
4189  const memory::desc &src_desc, const memory::desc &weights_desc,
4190  const memory::desc &bias_desc, const memory::desc &dst_desc,
4191  const memory::dims &strides, const memory::dims &padding_l,
4192  const memory::dims &padding_r) {
4193  memory::validate_dims(strides, src_desc.data.ndims - 2);
4194  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
4195  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
4199  convert_to_c(algorithm), &src_desc.data,
4200  &weights_desc.data, &bias_desc.data, &dst_desc.data,
4201  &strides[0], &padding_l[0], &padding_r[0]),
4202  "could not create a descriptor for a deconvolution forward "
4203  "propagation primitive");
4204  }
4205 
4235  const memory::desc &src_desc, const memory::desc &weights_desc,
4236  const memory::desc &dst_desc, const memory::dims &strides,
4237  const memory::dims &padding_l, const memory::dims &padding_r) {
4238  memory::validate_dims(strides, src_desc.data.ndims - 2);
4239  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
4240  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
4244  convert_to_c(algorithm), &src_desc.data,
4245  &weights_desc.data, nullptr, &dst_desc.data,
4246  &strides[0], &padding_l[0], &padding_r[0]),
4247  "could not create a descriptor for a deconvolution forward "
4248  "propagation primitive");
4249  }
4250 
4285  const memory::desc &src_desc, const memory::desc &weights_desc,
4286  const memory::desc &bias_desc, const memory::desc &dst_desc,
4287  const memory::dims &strides, const memory::dims &dilates,
4288  const memory::dims &padding_l, const memory::dims &padding_r) {
4289  memory::validate_dims(strides, src_desc.data.ndims - 2);
4290  memory::validate_dims(dilates, src_desc.data.ndims - 2);
4291  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
4292  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
4294  &data, dnnl::convert_to_c(prop_kind),
4295  convert_to_c(algorithm), &src_desc.data,
4296  &weights_desc.data, &bias_desc.data,
4297  &dst_desc.data, &strides[0], &dilates[0],
4298  &padding_l[0], &padding_r[0]),
4299  "could not create a descriptor for a dilated deconvolution "
4300  "forward propagation primitive");
4301  }
4302 
4334  const memory::desc &src_desc, const memory::desc &weights_desc,
4335  const memory::desc &dst_desc, const memory::dims &strides,
4336  const memory::dims &dilates, const memory::dims &padding_l,
4337  const memory::dims &padding_r) {
4338  memory::validate_dims(strides, src_desc.data.ndims - 2);
4339  memory::validate_dims(dilates, src_desc.data.ndims - 2);
4340  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
4341  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
4343  &data, dnnl::convert_to_c(prop_kind),
4344  convert_to_c(algorithm), &src_desc.data,
4345  &weights_desc.data, nullptr,
4346  &dst_desc.data, &strides[0], &dilates[0],
4347  &padding_l[0], &padding_r[0]),
4348  "could not create a descriptor for a dilated deconvolution "
4349  "forward propagation primitive");
4350  }
4351  };
4352 
4356  primitive_desc() = default;
4357 
4369  bool allow_empty = false)
4370  : dnnl::primitive_desc(
4371  &desc.data, nullptr, engine, nullptr, allow_empty) {}
4372 
4385  const engine &engine, bool allow_empty = false)
4386  : dnnl::primitive_desc(
4387  &desc.data, &attr, engine, nullptr, allow_empty) {}
4388 
4396  : dnnl::primitive_desc(pd, dnnl::primitive::kind::deconvolution,
4399 
4401  memory::desc src_desc() const { return base::src_desc(0); }
4402 
4405 
4407  memory::desc dst_desc() const { return base::dst_desc(0); }
4408 
4411  };
4412 
4414  deconvolution_forward() = default;
4415 
4420 };
4421 
4425  struct desc {
4427 
4453  desc(algorithm algorithm, const memory::desc &diff_src_desc,
4454  const memory::desc &weights_desc,
4455  const memory::desc &diff_dst_desc, const memory::dims &strides,
4456  const memory::dims &padding_l, const memory::dims &padding_r) {
4457  memory::validate_dims(strides, diff_src_desc.data.ndims - 2);
4458  memory::validate_dims(padding_l, diff_src_desc.data.ndims - 2);
4459  memory::validate_dims(padding_r, diff_src_desc.data.ndims - 2);
4462  convert_to_c(algorithm), &diff_src_desc.data,
4463  &weights_desc.data, &diff_dst_desc.data,
4464  &strides[0], &padding_l[0], &padding_r[0]),
4465  "could not create a descriptor for a deconvolution "
4466  "backward propagation primitive");
4467  }
4468 
4496  desc(algorithm algorithm, const memory::desc &diff_src_desc,
4497  const memory::desc &weights_desc,
4498  const memory::desc &diff_dst_desc, const memory::dims &strides,
4499  const memory::dims &dilates, const memory::dims &padding_l,
4500  const memory::dims &padding_r) {
4501  memory::validate_dims(strides, diff_src_desc.data.ndims - 2);
4502  memory::validate_dims(dilates, diff_src_desc.data.ndims - 2);
4503  memory::validate_dims(padding_l, diff_src_desc.data.ndims - 2);
4504  memory::validate_dims(padding_r, diff_src_desc.data.ndims - 2);
4507  convert_to_c(algorithm), &diff_src_desc.data,
4508  &weights_desc.data, &diff_dst_desc.data,
4509  &strides[0], &dilates[0], &padding_l[0],
4510  &padding_r[0]),
4511  "could not create a descriptor for a dilated deconvolution "
4512  "backward propagation primitive");
4513  }
4514  };
4515 
4519  primitive_desc() = default;
4520 
4535  const deconvolution_forward::primitive_desc &hint_fwd_pd,
4536  bool allow_empty = false)
4537  : dnnl::primitive_desc(&desc.data, nullptr, engine,
4538  hint_fwd_pd.get(), allow_empty) {}
4539 
4555  const engine &engine,
4556  const deconvolution_forward::primitive_desc &hint_fwd_pd,
4557  bool allow_empty = false)
4558  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
4559  allow_empty) {}
4560 
4568  : dnnl::primitive_desc(pd, dnnl::primitive::kind::deconvolution,
4570 
4573 
4576 
4579  };
4580 
4582  deconvolution_backward_data() = default;
4583 
4588 };
4589 
4593  struct desc {
4595 
4625  const memory::desc &diff_weights_desc,
4626  const memory::desc &diff_bias_desc,
4627  const memory::desc &diff_dst_desc, const memory::dims &strides,
4628  const memory::dims &padding_l, const memory::dims &padding_r) {
4629  memory::validate_dims(strides, src_desc.data.ndims - 2);
4630  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
4631  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
4634  convert_to_c(algorithm), &src_desc.data,
4635  &diff_weights_desc.data, &diff_bias_desc.data,
4636  &diff_dst_desc.data, &strides[0], &padding_l[0],
4637  &padding_r[0]),
4638  "could not create a descriptor for a deconvolution weights "
4639  "update primitive");
4640  }
4641 
4668  const memory::desc &diff_weights_desc,
4669  const memory::desc &diff_dst_desc, const memory::dims &strides,
4670  const memory::dims &padding_l, const memory::dims &padding_r) {
4671  memory::validate_dims(strides, src_desc.data.ndims - 2);
4672  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
4673  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
4675  &data, convert_to_c(algorithm),
4676  &src_desc.data, &diff_weights_desc.data,
4677  nullptr, &diff_dst_desc.data, &strides[0],
4678  &padding_l[0], &padding_r[0]),
4679  "could not create a descriptor for a deconvolution weights "
4680  "update primitive");
4681  }
4682 
4714  const memory::desc &diff_weights_desc,
4715  const memory::desc &diff_bias_desc,
4716  const memory::desc &diff_dst_desc, const memory::dims &strides,
4717  const memory::dims &dilates, const memory::dims &padding_l,
4718  const memory::dims &padding_r) {
4719  memory::validate_dims(strides, src_desc.data.ndims - 2);
4720  memory::validate_dims(dilates, src_desc.data.ndims - 2);
4721  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
4722  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
4725  convert_to_c(algorithm), &src_desc.data,
4726  &diff_weights_desc.data, &diff_bias_desc.data,
4727  &diff_dst_desc.data, &strides[0], &dilates[0],
4728  &padding_l[0], &padding_r[0]),
4729  "could not create a descriptor for a dilated deconvolution "
4730  "weights gradient primitive");
4731  }
4732 
4761  const memory::desc &diff_weights_desc,
4762  const memory::desc &diff_dst_desc, const memory::dims &strides,
4763  const memory::dims &dilates, const memory::dims &padding_l,
4764  const memory::dims &padding_r) {
4765  memory::validate_dims(strides, src_desc.data.ndims - 2);
4766  memory::validate_dims(dilates, src_desc.data.ndims - 2);
4767  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
4768  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
4771  convert_to_c(algorithm), &src_desc.data,
4772  &diff_weights_desc.data, nullptr,
4773  &diff_dst_desc.data, &strides[0], &dilates[0],
4774  &padding_l[0], &padding_r[0]),
4775  "could not create a descriptor for a dilated deconvolution "
4776  "weights gradient primitive");
4777  }
4778  };
4779 
4783  primitive_desc() = default;
4784 
4799  const deconvolution_forward::primitive_desc &hint_fwd_pd,
4800  bool allow_empty = false)
4801  : dnnl::primitive_desc(&desc.data, nullptr, engine,
4802  hint_fwd_pd.get(), allow_empty) {}
4803 
4819  const engine &engine,
4820  const deconvolution_forward::primitive_desc &hint_fwd_pd,
4821  bool allow_empty = false)
4822  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
4823  allow_empty) {}
4824 
4832  : dnnl::primitive_desc(pd, dnnl::primitive::kind::deconvolution,
4834 
4836  memory::desc src_desc() const { return base::src_desc(0); }
4837 
4840  return base::diff_weights_desc(0);
4841  }
4842 
4845 
4848  return base::diff_weights_desc(1);
4849  }
4850  };
4851 
4853  deconvolution_backward_weights() = default;
4854 
4859 };
4860 
4862 
4871 
4873 struct lrn_forward : public primitive {
4875  struct desc {
4876  dnnl_lrn_desc_t data;
4877 
4903  const memory::desc &data_desc, memory::dim local_size,
4904  float alpha, float beta, float k = 1.f) {
4907  convert_to_c(algorithm), &data_desc.data,
4908  local_size, alpha, beta, k),
4909  "could not create a descriptor for a lrn forward "
4910  "propagation primitive");
4911  }
4912  };
4913 
4917  primitive_desc() = default;
4918 
4929  bool allow_empty = false)
4930  : dnnl::primitive_desc(
4931  &desc.data, nullptr, engine, nullptr, allow_empty) {}
4932 
4944  const engine &engine, bool allow_empty = false)
4945  : dnnl::primitive_desc(
4946  &desc.data, &attr, engine, nullptr, allow_empty) {}
4947 
4955  : dnnl::primitive_desc(pd, dnnl::primitive::kind::lrn,
4958 
4960  memory::desc src_desc() const { return base::src_desc(0); }
4961 
4963  memory::desc dst_desc() const { return base::dst_desc(0); }
4964 
4967  };
4968 
4970  lrn_forward() = default;
4971 
4976 };
4977 
4979 struct lrn_backward : public primitive {
4981  struct desc {
4982  dnnl_lrn_desc_t data;
4983 
5008  const memory::desc &diff_data_desc, memory::dim local_size,
5009  float alpha, float beta, float k = 1.f) {
5012  &diff_data_desc.data, &data_desc.data, local_size,
5013  alpha, beta, k),
5014  "could not create a descriptor for a lrn backward "
5015  "propagation primitive");
5016  }
5017  };
5018 
5022  primitive_desc() = default;
5023 
5037  const lrn_forward::primitive_desc &hint_fwd_pd,
5038  bool allow_empty = false)
5039  : dnnl::primitive_desc(&desc.data, nullptr, engine,
5040  hint_fwd_pd.get(), allow_empty) {}
5041 
5056  const engine &engine,
5057  const lrn_forward::primitive_desc &hint_fwd_pd,
5058  bool allow_empty = false)
5059  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
5060  allow_empty) {}
5061 
5069  : dnnl::primitive_desc(pd, dnnl::primitive::kind::lrn,
5071 
5074 
5077 
5080  };
5081 
5083  lrn_backward() = default;
5084 
5089 };
5090 
5092 
5100 
5102 struct pooling_forward : public primitive {
5104  struct desc {
5105  dnnl_pooling_desc_t data;
5106 
5137  const memory::desc &src_desc, const memory::desc &dst_desc,
5138  const memory::dims &strides, const memory::dims &kernel,
5139  const memory::dims &padding_l, const memory::dims &padding_r) {
5140  memory::validate_dims(strides, src_desc.data.ndims - 2);
5141  memory::validate_dims(kernel, src_desc.data.ndims - 2);
5142  memory::validate_dims(padding_l, src_desc.data.ndims - 2);
5143  memory::validate_dims(padding_r, src_desc.data.ndims - 2);
5146  convert_to_c(algorithm), &src_desc.data,
5147  &dst_desc.data, &strides[0], &kernel[0],
5148  &padding_l[0], &padding_r[0]),
5149  "could not create a descriptor for a pooling forward "
5150  "propagation primitive");
5151  }
5152  };
5153 
5157  primitive_desc() = default;
5158 
5169  bool allow_empty = false)
5170  : dnnl::primitive_desc(
5171  &desc.data, nullptr, engine, nullptr, allow_empty) {}
5172 
5184  const engine &engine, bool allow_empty = false)
5185  : dnnl::primitive_desc(
5186  &desc.data, &attr, engine, nullptr, allow_empty) {}
5187 
5195  : dnnl::primitive_desc(pd, dnnl::primitive::kind::pooling,
5198 
5200  memory::desc src_desc() const { return base::src_desc(0); }
5201 
5203  memory::desc dst_desc() const { return base::dst_desc(0); }
5204 
5207  };
5208 
5210  pooling_forward() = default;
5211 
5216 };
5217 
5219 struct pooling_backward : public primitive {
5221  struct desc {
5222  dnnl_pooling_desc_t data;
5223 
5249  desc(algorithm algorithm, const memory::desc &diff_src_desc,
5250  const memory::desc &diff_dst_desc, const memory::dims &strides,
5251  const memory::dims &kernel, const memory::dims &padding_l,
5252  const memory::dims &padding_r) {
5253  memory::validate_dims(strides, diff_src_desc.data.ndims - 2);
5254  memory::validate_dims(kernel, diff_src_desc.data.ndims - 2);
5255  memory::validate_dims(padding_l, diff_src_desc.data.ndims - 2);
5256  memory::validate_dims(padding_r, diff_src_desc.data.ndims - 2);
5259  convert_to_c(algorithm), &diff_src_desc.data,
5260  &diff_dst_desc.data, &strides[0], &kernel[0],
5261  &padding_l[0], &padding_r[0]),
5262  "could not create a descriptor for a pooling backward "
5263  "propagation primitive");
5264  }
5265  };
5266 
5270  primitive_desc() = default;
5271 
5285  const pooling_forward::primitive_desc &hint_fwd_pd,
5286  bool allow_empty = false)
5287  : dnnl::primitive_desc(&desc.data, nullptr, engine,
5288  hint_fwd_pd.get(), allow_empty) {}
5289 
5304  const engine &engine,
5305  const pooling_forward::primitive_desc &hint_fwd_pd,
5306  bool allow_empty = false)
5307  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
5308  allow_empty) {}
5309 
5317  : dnnl::primitive_desc(pd, dnnl::primitive::kind::pooling,
5319 
5322 
5325 
5328  };
5329 
5331  pooling_backward() = default;
5332 
5337 };
5338 
5340 
5361 
5363 struct eltwise_forward : public primitive {
5365  struct desc {
5366  dnnl_eltwise_desc_t data;
5367 
5387  const memory::desc &data_desc, float alpha = 0,
5388  float beta = 0) {
5392  &data_desc.data, alpha, beta),
5393  "could not create a descriptor for an eltwise forward "
5394  "propagation primitive");
5395  }
5396  };
5397 
5401  primitive_desc() = default;
5402 
5414  bool allow_empty = false)
5415  : dnnl::primitive_desc(
5416  &desc.data, nullptr, engine, nullptr, allow_empty) {}
5417 
5430  const engine &engine, bool allow_empty = false)
5431  : dnnl::primitive_desc(
5432  &desc.data, &attr, engine, nullptr, allow_empty) {}
5433 
5441  : dnnl::primitive_desc(pd, dnnl::primitive::kind::eltwise,
5444 
5446  memory::desc src_desc() const { return base::src_desc(0); }
5447 
5449  memory::desc dst_desc() const { return base::dst_desc(0); }
5450  };
5451 
5453  eltwise_forward() = default;
5454 
5459 };
5460 
5462 struct eltwise_backward : public primitive {
5464  struct desc {
5465  dnnl_eltwise_desc_t data;
5466 
5485  desc(algorithm algorithm, const memory::desc &diff_data_desc,
5486  const memory::desc &data_desc, float alpha = 0,
5487  float beta = 0) {
5490  dnnl::convert_to_c(algorithm), &diff_data_desc.data,
5491  &data_desc.data, alpha, beta),
5492  "could not create a descriptor for an eltwise backward "
5493  "propagation primitive");
5494  }
5495  };
5496 
5500  primitive_desc() = default;
5501 
5516  const eltwise_forward::primitive_desc &hint_fwd_pd,
5517  bool allow_empty = false)
5518  : dnnl::primitive_desc(&desc.data, nullptr, engine,
5519  hint_fwd_pd.get(), allow_empty) {}
5520 
5536  const engine &engine,
5537  const eltwise_forward::primitive_desc &hint_fwd_pd,
5538  bool allow_empty = false)
5539  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
5540  allow_empty) {}
5541 
5549  : dnnl::primitive_desc(pd, dnnl::primitive::kind::eltwise,
5551 
5553  memory::desc src_desc() const { return base::src_desc(0); }
5554 
5557 
5560  };
5561 
5563  eltwise_backward() = default;
5564 
5569 };
5570 
5572 
5580 
5582 struct softmax_forward : public primitive {
5584  struct desc {
5585  dnnl_softmax_desc_t data;
5586 
5588  desc() = default;
5589 
5605  int softmax_axis) {
5608  &data_desc.data, softmax_axis),
5609  "could not create a descriptor for a softmax forward "
5610  "propagation primitive");
5611  }
5612  };
5613 
5617  primitive_desc() = default;
5618 
5630  bool allow_empty = false)
5631  : dnnl::primitive_desc(
5632  &desc.data, nullptr, engine, nullptr, allow_empty) {}
5633 
5646  const engine &engine, bool allow_empty = false)
5647  : dnnl::primitive_desc(
5648  &desc.data, &attr, engine, nullptr, allow_empty) {}
5649 
5657  : dnnl::primitive_desc(pd, dnnl::primitive::kind::softmax,
5660 
5662  memory::desc src_desc() const { return base::src_desc(0); }
5663 
5665  memory::desc dst_desc() const { return base::dst_desc(0); }
5666  };
5667 
5669  softmax_forward() = default;
5670 
5675 };
5676 
5678 struct softmax_backward : public primitive {
5680  struct desc {
5681  dnnl_softmax_desc_t data;
5682 
5684  desc() = default;
5685 
5700  desc(const memory::desc &diff_data_desc, const memory::desc &data_desc,
5701  int softmax_axis) {
5703  dnnl_softmax_backward_desc_init(&data, &diff_data_desc.data,
5704  &data_desc.data, softmax_axis),
5705  "could not create a descriptor for a softmax backward "
5706  "propagation primitive");
5707  }
5708  };
5709 
5713  primitive_desc() = default;
5714 
5729  const softmax_forward::primitive_desc &hint_fwd_pd,
5730  bool allow_empty = false)
5731  : dnnl::primitive_desc(&desc.data, nullptr, engine,
5732  hint_fwd_pd.get(), allow_empty) {}
5733 
5749  const engine &engine,
5750  const softmax_forward::primitive_desc &hint_fwd_pd,
5751  bool allow_empty = false)
5752  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
5753  allow_empty) {}
5754 
5762  : dnnl::primitive_desc(pd, dnnl::primitive::kind::softmax,
5764 
5766  memory::desc dst_desc() const { return base::dst_desc(0); }
5767 
5770 
5773  };
5774 
5776  softmax_backward() = default;
5777 
5782 };
5783 
5785 
5793 
5797  struct desc {
5799 
5801  desc() = default;
5802 
5818  int logsoftmax_axis) {
5821  &data_desc.data, logsoftmax_axis),
5822  "could not create a descriptor for a logsoftmax forward "
5823  "propagation primitive");
5824  }
5825  };
5826 
5830  primitive_desc() = default;
5831 
5843  bool allow_empty = false)
5844  : dnnl::primitive_desc(
5845  &desc.data, nullptr, engine, nullptr, allow_empty) {}
5846 
5859  const engine &engine, bool allow_empty = false)
5860  : dnnl::primitive_desc(
5861  &desc.data, &attr, engine, nullptr, allow_empty) {}
5862 
5870  : dnnl::primitive_desc(pd,
5871  // Logsoftmax and softmax share the implementation and
5872  // currently report the same primitive kind. Hence this
5873  // must be softmax and not logsoftmax.
5874  dnnl::primitive::kind::softmax,
5877 
5879  memory::desc src_desc() const { return base::src_desc(0); }
5880 
5882  memory::desc dst_desc() const { return base::dst_desc(0); }
5883  };
5884 
5886  logsoftmax_forward() = default;
5887 
5892 };
5893 
5897  struct desc {
5899 
5901  desc() = default;
5902 
5917  desc(const memory::desc &diff_data_desc, const memory::desc &data_desc,
5918  int logsoftmax_axis) {
5920  &diff_data_desc.data, &data_desc.data,
5921  logsoftmax_axis),
5922  "could not create a descriptor for a logsoftmax backward "
5923  "propagation primitive");
5924  }
5925  };
5926 
5930  primitive_desc() = default;
5931 
5946  const logsoftmax_forward::primitive_desc &hint_fwd_pd,
5947  bool allow_empty = false)
5948  : dnnl::primitive_desc(&desc.data, nullptr, engine,
5949  hint_fwd_pd.get(), allow_empty) {}
5950 
5966  const engine &engine,
5967  const logsoftmax_forward::primitive_desc &hint_fwd_pd,
5968  bool allow_empty = false)
5969  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
5970  allow_empty) {}
5971 
5979  : dnnl::primitive_desc(pd,
5980  // Logsoftmax and softmax share the implementation and
5981  // currently report the same primitive kind. Hence this
5982  // must be softmax and not logsoftmax.
5983  dnnl::primitive::kind::softmax,
5985 
5987  memory::desc dst_desc() const { return base::dst_desc(0); }
5988 
5991 
5994  };
5995 
5997  logsoftmax_backward() = default;
5998 
6003 };
6004 
6006 
6026 
6030  struct desc {
6032 
6076  desc(prop_kind prop_kind, const memory::desc &data_desc, float epsilon,
6077  normalization_flags flags) {
6080  dnnl::convert_to_c(prop_kind), &data_desc.data,
6081  epsilon, convert_to_c(flags)),
6082  "could not create a descriptor for a batch normalization "
6083  "forward propagation primitive");
6084  }
6085  };
6086 
6091  primitive_desc() = default;
6092 
6104  bool allow_empty = false)
6105  : dnnl::primitive_desc(
6106  &desc.data, nullptr, engine, nullptr, allow_empty) {}
6107 
6120  const engine &engine, bool allow_empty = false)
6121  : dnnl::primitive_desc(
6122  &desc.data, &attr, engine, nullptr, allow_empty) {}
6123 
6131  : dnnl::primitive_desc(pd,
6132  dnnl::primitive::kind::batch_normalization,
6135 
6137  memory::desc src_desc() const { return base::src_desc(0); }
6138 
6140  memory::desc dst_desc() const { return base::dst_desc(0); }
6141 
6144 
6147 
6150  memory::desc mean_desc() const { return stat_desc(mean); }
6151 
6154  memory::desc variance_desc() const { return stat_desc(var); }
6155 
6156  private:
6157  enum {
6158  mean = 1,
6159  var = 2,
6160  };
6161  memory::desc stat_desc(int kind) const {
6166  &p),
6167  "could not retrieve a descriptor from a primitive "
6168  "descriptor for batch normalization forward propagation "
6169  "primitive");
6170  return query_md(p->flags & dnnl_use_global_stats ? query::src_md
6171  : query::dst_md,
6172  kind);
6173  }
6174  };
6175 
6177  batch_normalization_forward() = default;
6178 
6183 };
6184 
6188  struct desc {
6190 
6222  desc(prop_kind prop_kind, const memory::desc &diff_data_desc,
6223  const memory::desc &data_desc, float epsilon,
6224  normalization_flags flags) {
6227  dnnl::convert_to_c(prop_kind), &diff_data_desc.data,
6228  &data_desc.data, epsilon, convert_to_c(flags)),
6229  "could not create a descriptor for a batch normalization "
6230  "backward propagation primitive");
6231  }
6232  };
6233 
6238  primitive_desc() = default;
6239 
6255  bool allow_empty = false)
6256  : dnnl::primitive_desc(&desc.data, nullptr, engine,
6257  hint_fwd_pd.get(), allow_empty) {}
6258 
6274  const engine &engine,
6276  bool allow_empty = false)
6277  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
6278  allow_empty) {}
6279 
6287  : dnnl::primitive_desc(pd,
6288  dnnl::primitive::kind::batch_normalization,
6290  }
6291 
6293  memory::desc src_desc() const { return base::src_desc(0); }
6294 
6297 
6299  memory::desc dst_desc() const { return base::dst_desc(0); }
6300 
6303 
6306 
6309  return base::diff_weights_desc(0);
6310  }
6311 
6314 
6317  return query_md(query::src_md, 2);
6318  }
6319 
6322  };
6323 
6325  batch_normalization_backward() = default;
6326 
6331 };
6332 
6334 
6356 
6360  struct desc {
6362 
6398  const memory::desc &stat_desc, float epsilon,
6399  normalization_flags flags) {
6402  dnnl::convert_to_c(prop_kind), &data_desc.data,
6403  &stat_desc.data, epsilon, convert_to_c(flags)),
6404  "could not create a descriptor for a layer normalization "
6405  "forward propagation primitive");
6406  }
6407 
6441  desc(prop_kind prop_kind, const memory::desc &data_desc, float epsilon,
6442  normalization_flags flags) {
6445  dnnl::convert_to_c(prop_kind), &data_desc.data,
6446  nullptr, epsilon, convert_to_c(flags)),
6447  "could not create a descriptor for a layer normalization "
6448  "forward propagation primitive");
6449  }
6450  };
6451 
6456  primitive_desc() = default;
6457 
6469  bool allow_empty = false)
6470  : dnnl::primitive_desc(
6471  &desc.data, nullptr, engine, nullptr, allow_empty) {}
6472 
6485  const engine &engine, bool allow_empty = false)
6486  : dnnl::primitive_desc(
6487  &desc.data, &attr, engine, nullptr, allow_empty) {}
6488 
6496  : dnnl::primitive_desc(pd,
6497  dnnl::primitive::kind::layer_normalization,
6500 
6502  memory::desc src_desc() const { return base::src_desc(0); }
6503 
6505  memory::desc dst_desc() const { return base::dst_desc(0); }
6506 
6509 
6512 
6514  memory::desc mean_desc() const { return stat_desc(mean); }
6515 
6517  memory::desc variance_desc() const { return stat_desc(var); }
6518 
6519  private:
6520  enum {
6521  mean = 1,
6522  var = 2,
6523  };
6524  memory::desc stat_desc(int kind) const {
6529  &p),
6530  "could not retrieve a descriptor from a primitive "
6531  "descriptor for layer normalization forward propagation "
6532  "primitive");
6533  return query_md(p->flags & dnnl_use_global_stats ? query::src_md
6534  : query::dst_md,
6535  kind);
6536  }
6537  };
6538 
6540  layer_normalization_forward() = default;
6541 
6546 };
6547 
6551  struct desc {
6553 
6583  desc(prop_kind prop_kind, const memory::desc &diff_data_desc,
6584  const memory::desc &data_desc, const memory::desc &stat_desc,
6585  float epsilon, normalization_flags flags) {
6588  dnnl::convert_to_c(prop_kind), &diff_data_desc.data,
6589  &data_desc.data, &stat_desc.data, epsilon,
6590  convert_to_c(flags)),
6591  "could not create a descriptor for a batch normalization "
6592  "backward propagation primitive");
6593  }
6594 
6623  desc(prop_kind prop_kind, const memory::desc &diff_data_desc,
6624  const memory::desc &data_desc, float epsilon,
6625  normalization_flags flags) {
6628  &diff_data_desc.data, &data_desc.data,
6629  nullptr, epsilon, convert_to_c(flags)),
6630  "could not create a descriptor for a batch normalization "
6631  "backward propagation primitive");
6632  }
6633  };
6634 
6639  primitive_desc() = default;
6640 
6656  bool allow_empty = false)
6657  : dnnl::primitive_desc(&desc.data, nullptr, engine,
6658  hint_fwd_pd.get(), allow_empty) {}
6659 
6675  const engine &engine,
6677  bool allow_empty = false)
6678  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
6679  allow_empty) {}
6680 
6688  : dnnl::primitive_desc(pd,
6689  dnnl::primitive::kind::layer_normalization,
6691  }
6692 
6694  memory::desc src_desc() const { return base::src_desc(0); }
6695 
6698 
6700  memory::desc dst_desc() const { return base::dst_desc(0); }
6701 
6704 
6707 
6710  return base::diff_weights_desc(0);
6711  }
6712 
6715 
6718  return query_md(query::src_md, 2);
6719  }
6720 
6723  };
6724 
6726  layer_normalization_backward() = default;
6727 
6732 };
6733 
6735 
6743 
6747  struct desc {
6749 
6773  const memory::desc &weights_desc, const memory::desc &bias_desc,
6774  const memory::desc &dst_desc) {
6777  &src_desc.data, &weights_desc.data,
6778  &bias_desc.data, &dst_desc.data),
6779  "could not create a descriptor for an inner product "
6780  "forward propagation primitive");
6781  }
6782 
6804  const memory::desc &weights_desc,
6805  const memory::desc &dst_desc) {
6808  dnnl::convert_to_c(prop_kind), &src_desc.data,
6809  &weights_desc.data, nullptr, &dst_desc.data),
6810  "could not create a descriptor for an inner product "
6811  "forward propagation primitive");
6812  }
6813  };
6814 
6818  primitive_desc() = default;
6819 
6831  bool allow_empty = false)
6832  : dnnl::primitive_desc(
6833  &desc.data, nullptr, engine, nullptr, allow_empty) {}
6834 
6847  const engine &engine, bool allow_empty = false)
6848  : dnnl::primitive_desc(
6849  &desc.data, &attr, engine, nullptr, allow_empty) {}
6850 
6858  : dnnl::primitive_desc(pd, dnnl::primitive::kind::inner_product,
6861 
6863  memory::desc src_desc() const { return base::src_desc(0); }
6864 
6867 
6869  memory::desc dst_desc() const { return base::dst_desc(0); }
6870 
6873  };
6874 
6876  inner_product_forward() = default;
6877 
6882 };
6883 
6887  struct desc {
6889 
6907  desc(const memory::desc &diff_src_desc,
6908  const memory::desc &weights_desc,
6909  const memory::desc &diff_dst_desc) {
6911  &diff_src_desc.data, &weights_desc.data,
6912  &diff_dst_desc.data),
6913  "could not create a descriptor for an inner product "
6914  "backward propagation primitive");
6915  }
6916  };
6917 
6922  primitive_desc() = default;
6923 
6938  const inner_product_forward::primitive_desc &hint_fwd_pd,
6939  bool allow_empty = false)
6940  : dnnl::primitive_desc(&desc.data, nullptr, engine,
6941  hint_fwd_pd.get(), allow_empty) {}
6942 
6958  const engine &engine,
6959  const inner_product_forward::primitive_desc &hint_fwd_pd,
6960  bool allow_empty = false)
6961  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
6962  allow_empty) {}
6963 
6971  : dnnl::primitive_desc(pd, dnnl::primitive::kind::inner_product,
6973 
6976 
6979 
6982  };
6983 
6985  inner_product_backward_data() = default;
6986 
6991 };
6992 
6996  struct desc {
6998 
7018  desc(const memory::desc &src_desc,
7019  const memory::desc &diff_weights_desc,
7020  const memory::desc &diff_bias_desc,
7021  const memory::desc &diff_dst_desc) {
7024  &src_desc.data, &diff_weights_desc.data,
7025  &diff_bias_desc.data, &diff_dst_desc.data),
7026  "could not create a descriptor for an inner product "
7027  "weights gradient primitive");
7028  }
7029 
7047  desc(const memory::desc &src_desc,
7048  const memory::desc &diff_weights_desc,
7049  const memory::desc &diff_dst_desc) {
7052  &src_desc.data, &diff_weights_desc.data, nullptr,
7053  &diff_dst_desc.data),
7054  "could not create a descriptor for an inner product "
7055  "weights gradient primitive");
7056  }
7057  };
7058 
7062  primitive_desc() = default;
7063 
7078  const inner_product_forward::primitive_desc &hint_fwd_pd,
7079  bool allow_empty = false)
7080  : dnnl::primitive_desc(&desc.data, nullptr, engine,
7081  hint_fwd_pd.get(), allow_empty) {}
7082 
7098  const engine &engine,
7099  const inner_product_forward::primitive_desc &hint_fwd_pd,
7100  bool allow_empty = false)
7101  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
7102  allow_empty) {}
7103 
7111  : dnnl::primitive_desc(pd, dnnl::primitive::kind::inner_product,
7113 
7115  memory::desc src_desc() const { return base::src_desc(0); }
7116 
7119  return base::diff_weights_desc(0);
7120  }
7121 
7124 
7127  return base::diff_weights_desc(1);
7128  }
7129  };
7130 
7132  inner_product_backward_weights() = default;
7133 
7138 };
7139 
7141 
7149 
7152  using primitive_desc::primitive_desc;
7153 
7155  rnn_primitive_desc_base() = default;
7156 
7165  dnnl::algorithm cell_kind)
7166  : rnn_primitive_desc_base(pd, prop_kind, prop_kind, cell_kind) {}
7167 
7172  }
7173 
7180  }
7181 
7186  }
7187 
7192  }
7193 
7198  }
7199 
7204  }
7205 
7212  }
7213 
7218  }
7219 
7226  }
7227 
7232  }
7233 
7238  }
7239 
7246  }
7247 
7252  }
7253 
7258  }
7259 
7264  }
7265 
7269  return base::query_md(
7271  }
7272 
7279  }
7280 
7285  }
7286 
7293  }
7294 
7299  }
7300 
7301 protected:
7302  using rnn_base = rnn_primitive_desc_base;
7303 
7304  // (Deliberately not using doxygen comments)
7305  //
7306  // Constructs an RNN primitive descriptor base from a C API primitive
7307  // descriptor while checking that it actually describes the expected
7308  // primitive by comparing propagation and primitive kinds. Caller can
7309  // pass two options propagation kinds. This is typically used to check
7310  // that propagation kind is inference or training forward propagation.
7311  //
7312  // @param pd C API primitive descriptor.
7313  // @param prop_kind1 Expected propagation kind.
7314  // @param prop_kind2 Expected propagation kind.
7315  // @param cell_kind Expected cell kind.
7317  dnnl::prop_kind prop_kind1, dnnl::prop_kind prop_kind2,
7318  dnnl::algorithm cell_kind) {
7320  dnnl_status_t rc;
7322  error::wrap_c_api(rc,
7323  "could not retrieve a descriptor from a primitive descriptor "
7324  "for an RNN primitive");
7325 
7326  dnnl_prop_kind_t c_prop_kind1 = convert_to_c(prop_kind1);
7327  dnnl_prop_kind_t c_prop_kind2 = convert_to_c(prop_kind2);
7328  dnnl_alg_kind_t c_cell_kind = convert_to_c(cell_kind);
7329 
7330  bool ok = rnn_d->primitive_kind == dnnl_rnn
7331  && (rnn_d->prop_kind == c_prop_kind1
7332  || rnn_d->prop_kind == c_prop_kind2)
7333  && rnn_d->cell_kind == c_cell_kind;
7334 
7335  if (!ok)
7336  DNNL_THROW_ERROR(dnnl_invalid_arguments,
7337  "mismatch between expected and provided descriptors for an "
7338  "RNN primitive");
7339 
7340  reset_with_clone(pd);
7341  }
7342 };
7343 
7347  struct desc {
7348  dnnl_rnn_desc_t data;
7349 
7404  const memory::desc &src_layer_desc,
7405  const memory::desc &src_iter_desc,
7406  const memory::desc &weights_layer_desc,
7407  const memory::desc &weights_iter_desc,
7408  const memory::desc &bias_desc,
7409  const memory::desc &dst_layer_desc,
7410  const memory::desc &dst_iter_desc,
7411  rnn_flags flags = rnn_flags::undef, float alpha = 0.0f,
7412  float beta = 0.0f) {
7416  dnnl::convert_to_c(activation),
7417  dnnl::convert_to_c(direction), &src_layer_desc.data,
7418  &src_iter_desc.data, &weights_layer_desc.data,
7419  &weights_iter_desc.data, &bias_desc.data,
7420  &dst_layer_desc.data, &dst_iter_desc.data,
7421  dnnl::convert_to_c(flags), alpha, beta),
7422  "could not create a descriptor for a vanilla RNN forward "
7423  "propagation primitive");
7424  }
7425  };
7426 
7430  primitive_desc() = default;
7431 
7443  bool allow_empty = false)
7445  &desc.data, nullptr, engine, nullptr, allow_empty) {}
7446 
7459  const engine &engine, bool allow_empty = false)
7461  &desc.data, &attr, engine, nullptr, allow_empty) {}
7462 
7472  dnnl::algorithm::vanilla_rnn) {}
7473 
7476  return rnn_base::src_layer_desc();
7477  }
7478 
7481 
7485  }
7486 
7489  return rnn_base::weights_iter_desc();
7490  }
7491 
7494 
7497  return rnn_base::dst_layer_desc();
7498  }
7499 
7502 
7505  return rnn_base::workspace_desc();
7506  }
7507  };
7508 
7510  vanilla_rnn_forward() = default;
7511 
7516 };
7517 
7521  struct desc {
7522  dnnl_rnn_desc_t data;
7523 
7600  const memory::desc &src_layer_desc,
7601  const memory::desc &src_iter_desc,
7602  const memory::desc &weights_layer_desc,
7603  const memory::desc &weights_iter_desc,
7604  const memory::desc &bias_desc,
7605  const memory::desc &dst_layer_desc,
7606  const memory::desc &dst_iter_desc,
7607  const memory::desc &diff_src_layer_desc,
7608  const memory::desc &diff_src_iter_desc,
7609  const memory::desc &diff_weights_layer_desc,
7610  const memory::desc &diff_weights_iter_desc,
7611  const memory::desc &diff_bias_desc,
7612  const memory::desc &diff_dst_layer_desc,
7613  const memory::desc &diff_dst_iter_desc,
7614  rnn_flags flags = rnn_flags::undef, float alpha = 0.0f,
7615  float beta = 0.0f) {
7619  dnnl::convert_to_c(activation),
7620  dnnl::convert_to_c(direction), &src_layer_desc.data,
7621  &src_iter_desc.data, &weights_layer_desc.data,
7622  &weights_iter_desc.data, &bias_desc.data,
7623  &dst_layer_desc.data, &dst_iter_desc.data,
7624  &diff_src_layer_desc.data, &diff_src_iter_desc.data,
7625  &diff_weights_layer_desc.data,
7626  &diff_weights_iter_desc.data, &diff_bias_desc.data,
7627  &diff_dst_layer_desc.data, &diff_dst_iter_desc.data,
7628  dnnl::convert_to_c(flags), alpha, beta),
7629  "could not create a descriptor for a vanilla RNN backward "
7630  "propagation primitive");
7631  }
7632  };
7633 
7637  primitive_desc() = default;
7638 
7653  const vanilla_rnn_forward::primitive_desc &hint_fwd_pd,
7654  bool allow_empty = false)
7655  : rnn_primitive_desc_base(&desc.data, nullptr, engine,
7656  hint_fwd_pd.get(), allow_empty) {}
7657 
7673  const engine &engine,
7674  const vanilla_rnn_forward::primitive_desc &hint_fwd_pd,
7675  bool allow_empty = false)
7676  : rnn_primitive_desc_base(&desc.data, &attr, engine,
7677  hint_fwd_pd.get(), allow_empty) {}
7678 
7687  dnnl::algorithm::vanilla_rnn) {}
7688 
7691  return rnn_base::src_layer_desc();
7692  }
7693 
7696 
7700  }
7701 
7704  return rnn_base::weights_iter_desc();
7705  }
7706 
7709 
7712  return rnn_base::dst_layer_desc();
7713  }
7714 
7717 
7720  return rnn_base::workspace_desc();
7721  }
7722 
7726  }
7727 
7731  }
7732 
7736  }
7737 
7741  }
7742 
7745  return rnn_base::diff_bias_desc();
7746  }
7747 
7751  }
7752 
7756  }
7757  };
7758 
7760  vanilla_rnn_backward() = default;
7761 
7766 };
7767 
7769 struct lstm_forward : public primitive {
7771  struct desc {
7772  dnnl_rnn_desc_t data;
7773 
7836  const memory::desc &src_layer_desc,
7837  const memory::desc &src_iter_desc,
7838  const memory::desc &src_iter_c_desc,
7839  const memory::desc &weights_layer_desc,
7840  const memory::desc &weights_iter_desc,
7841  const memory::desc &weights_peephole_desc,
7842  const memory::desc &bias_desc,
7843  const memory::desc &dst_layer_desc,
7844  const memory::desc &dst_iter_desc,
7845  const memory::desc &dst_iter_c_desc,
7846  rnn_flags flags = rnn_flags::undef) {
7850  dnnl::convert_to_c(direction), &src_layer_desc.data,
7851  &src_iter_desc.data, &src_iter_c_desc.data,
7852  &weights_layer_desc.data, &weights_iter_desc.data,
7853  &weights_peephole_desc.data, &bias_desc.data,
7854  &dst_layer_desc.data, &dst_iter_desc.data,
7855  &dst_iter_c_desc.data, dnnl::convert_to_c(flags)),
7856  "could not create a descriptor for an LSTM forward "
7857  "propagation primitive");
7858  }
7859 
7912  const memory::desc &src_layer_desc,
7913  const memory::desc &src_iter_desc,
7914  const memory::desc &src_iter_c_desc,
7915  const memory::desc &weights_layer_desc,
7916  const memory::desc &weights_iter_desc,
7917  const memory::desc &bias_desc,
7918  const memory::desc &dst_layer_desc,
7919  const memory::desc &dst_iter_desc,
7920  const memory::desc &dst_iter_c_desc,
7921  rnn_flags flags = rnn_flags::undef) {
7925  dnnl::convert_to_c(direction), &src_layer_desc.data,
7926  &src_iter_desc.data, &src_iter_c_desc.data,
7927  &weights_layer_desc.data, &weights_iter_desc.data,
7928  &bias_desc.data, &dst_layer_desc.data,
7929  &dst_iter_desc.data, &dst_iter_c_desc.data,
7930  dnnl::convert_to_c(flags)),
7931  "could not create a descriptor for an LSTM forward "
7932  "propagation primitive");
7933  }
7934  };
7935 
7939  primitive_desc() = default;
7940 
7951  bool allow_empty = false)
7953  &desc.data, nullptr, engine, nullptr, allow_empty) {}
7954 
7966  const engine &engine, bool allow_empty = false)
7968  &desc.data, &attr, engine, nullptr, allow_empty) {}
7969 
7980 
7983  return rnn_base::src_layer_desc();
7984  }
7985 
7988 
7991  return rnn_base::src_iter_c_desc();
7992  }
7993 
7997  }
7998 
8001  return rnn_base::weights_iter_desc();
8002  }
8003 
8007  }
8008 
8011 
8014  return rnn_base::dst_layer_desc();
8015  }
8016 
8019 
8022  return rnn_base::dst_iter_c_desc();
8023  }
8024 
8027  return rnn_base::workspace_desc();
8028  }
8029  };
8030 
8032  lstm_forward() = default;
8033 
8038 };
8039 
8041 struct lstm_backward : public primitive {
8043  struct desc {
8044  dnnl_rnn_desc_t data;
8045 
8147  const memory::desc &src_layer_desc,
8148  const memory::desc &src_iter_desc,
8149  const memory::desc &src_iter_c_desc,
8150  const memory::desc &weights_layer_desc,
8151  const memory::desc &weights_iter_desc,
8152  const memory::desc &weights_peephole_desc,
8153  const memory::desc &bias_desc,
8154  const memory::desc &dst_layer_desc,
8155  const memory::desc &dst_iter_desc,
8156  const memory::desc &dst_iter_c_desc,
8157  const memory::desc &diff_src_layer_desc,
8158  const memory::desc &diff_src_iter_desc,
8159  const memory::desc &diff_src_iter_c_desc,
8160  const memory::desc &diff_weights_layer_desc,
8161  const memory::desc &diff_weights_iter_desc,
8162  const memory::desc &diff_weights_peephole_desc,
8163  const memory::desc &diff_bias_desc,
8164  const memory::desc &diff_dst_layer_desc,
8165  const memory::desc &diff_dst_iter_desc,
8166  const memory::desc &diff_dst_iter_c_desc,
8167  rnn_flags flags = rnn_flags::undef) {
8171  dnnl::convert_to_c(direction), &src_layer_desc.data,
8172  &src_iter_desc.data, &src_iter_c_desc.data,
8173  &weights_layer_desc.data, &weights_iter_desc.data,
8174  &weights_peephole_desc.data, &bias_desc.data,
8175  &dst_layer_desc.data, &dst_iter_desc.data,
8176  &dst_iter_c_desc.data, &diff_src_layer_desc.data,
8177  &diff_src_iter_desc.data,
8178  &diff_src_iter_c_desc.data,
8179  &diff_weights_layer_desc.data,
8180  &diff_weights_iter_desc.data,
8181  &diff_weights_peephole_desc.data,
8182  &diff_bias_desc.data, &diff_dst_layer_desc.data,
8183  &diff_dst_iter_desc.data,
8184  &diff_dst_iter_c_desc.data,
8185  dnnl::convert_to_c(flags)),
8186  "could not create a descriptor for an LSTM backward "
8187  "propagation primitive");
8188  }
8189 
8273  const memory::desc &src_layer_desc,
8274  const memory::desc &src_iter_desc,
8275  const memory::desc &src_iter_c_desc,
8276  const memory::desc &weights_layer_desc,
8277  const memory::desc &weights_iter_desc,
8278  const memory::desc &bias_desc,
8279  const memory::desc &dst_layer_desc,
8280  const memory::desc &dst_iter_desc,
8281  const memory::desc &dst_iter_c_desc,
8282  const memory::desc &diff_src_layer_desc,
8283  const memory::desc &diff_src_iter_desc,
8284  const memory::desc &diff_src_iter_c_desc,
8285  const memory::desc &diff_weights_layer_desc,
8286  const memory::desc &diff_weights_iter_desc,
8287  const memory::desc &diff_bias_desc,
8288  const memory::desc &diff_dst_layer_desc,
8289  const memory::desc &diff_dst_iter_desc,
8290  const memory::desc &diff_dst_iter_c_desc,
8291  rnn_flags flags = rnn_flags::undef) {
8295  dnnl::convert_to_c(direction), &src_layer_desc.data,
8296  &src_iter_desc.data, &src_iter_c_desc.data,
8297  &weights_layer_desc.data, &weights_iter_desc.data,
8298  &bias_desc.data, &dst_layer_desc.data,
8299  &dst_iter_desc.data, &dst_iter_c_desc.data,
8300  &diff_src_layer_desc.data, &diff_src_iter_desc.data,
8301  &diff_src_iter_c_desc.data,
8302  &diff_weights_layer_desc.data,
8303  &diff_weights_iter_desc.data, &diff_bias_desc.data,
8304  &diff_dst_layer_desc.data, &diff_dst_iter_desc.data,
8305  &diff_dst_iter_c_desc.data,
8306  dnnl::convert_to_c(flags)),
8307  "could not create a descriptor for an LSTM backward "
8308  "propagation primitive");
8309  }
8310  };
8311 
8315  primitive_desc() = default;
8316 
8330  const lstm_forward::primitive_desc &hint_fwd_pd,
8331  bool allow_empty = false)
8332  : rnn_primitive_desc_base(&desc.data, nullptr, engine,
8333  hint_fwd_pd.get(), allow_empty) {}
8334 
8349  const engine &engine,
8350  const lstm_forward::primitive_desc &hint_fwd_pd,
8351  bool allow_empty = false)
8352  : rnn_primitive_desc_base(&desc.data, &attr, engine,
8353  hint_fwd_pd.get(), allow_empty) {}
8354 
8364 
8367  return rnn_base::src_layer_desc();
8368  }
8369 
8372 
8375  return rnn_base::src_iter_c_desc();
8376  }
8377 
8381  }
8382 
8385  return rnn_base::weights_iter_desc();
8386  }
8387 
8391  }
8392 
8395 
8398  return rnn_base::dst_layer_desc();
8399  }
8400 
8403 
8406  return rnn_base::dst_iter_c_desc();
8407  }
8408 
8411  return rnn_base::workspace_desc();
8412  }
8413 
8417  }
8418 
8422  }
8423 
8427  }
8428 
8432  }
8433 
8437  }
8438 
8442  }
8443 
8446  return rnn_base::diff_bias_desc();
8447  }
8448 
8452  }
8453 
8457  }
8458 
8462  }
8463  };
8464 
8466  lstm_backward() = default;
8467 
8472 };
8473 
8475 struct gru_forward : public primitive {
8477  struct desc {
8478  dnnl_rnn_desc_t data;
8479 
8526  const memory::desc &src_layer_desc,
8527  const memory::desc &src_iter_desc,
8528  const memory::desc &weights_layer_desc,
8529  const memory::desc &weights_iter_desc,
8530  const memory::desc &bias_desc,
8531  const memory::desc &dst_layer_desc,
8532  const memory::desc &dst_iter_desc,
8533  rnn_flags flags = rnn_flags::undef) {
8537  dnnl::convert_to_c(direction), &src_layer_desc.data,
8538  &src_iter_desc.data, &weights_layer_desc.data,
8539  &weights_iter_desc.data, &bias_desc.data,
8540  &dst_layer_desc.data, &dst_iter_desc.data,
8541  dnnl::convert_to_c(flags)),
8542  "could not create a descriptor for a GRU forward "
8543  "propagation primitive");
8544  }
8545  };
8546 
8550  primitive_desc() = default;
8551 
8562  bool allow_empty = false)
8564  &desc.data, nullptr, engine, nullptr, allow_empty) {}
8565 
8577  const engine &engine, bool allow_empty = false)
8579  &desc.data, &attr, engine, nullptr, allow_empty) {}
8580 
8590  dnnl::algorithm::vanilla_gru) {}
8591 
8594  return rnn_base::src_layer_desc();
8595  }
8596 
8599 
8603  }
8604 
8607  return rnn_base::weights_iter_desc();
8608  }
8609 
8612 
8615  return rnn_base::dst_layer_desc();
8616  }
8617 
8620 
8623  return rnn_base::workspace_desc();
8624  }
8625  };
8626 
8628  gru_forward() = default;
8629 
8634 };
8635 
8637 struct gru_backward : public primitive {
8639  struct desc {
8640  dnnl_rnn_desc_t data;
8641 
8709  const memory::desc &src_layer_desc,
8710  const memory::desc &src_iter_desc,
8711  const memory::desc &weights_layer_desc,
8712  const memory::desc &weights_iter_desc,
8713  const memory::desc &bias_desc,
8714  const memory::desc &dst_layer_desc,
8715  const memory::desc &dst_iter_desc,
8716  const memory::desc &diff_src_layer_desc,
8717  const memory::desc &diff_src_iter_desc,
8718  const memory::desc &diff_weights_layer_desc,
8719  const memory::desc &diff_weights_iter_desc,
8720  const memory::desc &diff_bias_desc,
8721  const memory::desc &diff_dst_layer_desc,
8722  const memory::desc &diff_dst_iter_desc,
8723  rnn_flags flags = rnn_flags::undef) {
8727  dnnl::convert_to_c(direction), &src_layer_desc.data,
8728  &src_iter_desc.data, &weights_layer_desc.data,
8729  &weights_iter_desc.data, &bias_desc.data,
8730  &dst_layer_desc.data, &dst_iter_desc.data,
8731  &diff_src_layer_desc.data, &diff_src_iter_desc.data,
8732  &diff_weights_layer_desc.data,
8733  &diff_weights_iter_desc.data, &diff_bias_desc.data,
8734  &diff_dst_layer_desc.data, &diff_dst_iter_desc.data,
8735  dnnl::convert_to_c(flags)),
8736  "could not create a descriptor for a GRU backward "
8737  "propagation primitive");
8738  }
8739  };
8740 
8744  primitive_desc() = default;
8745 
8759  const gru_forward::primitive_desc &hint_fwd_pd,
8760  bool allow_empty = false)
8761  : rnn_primitive_desc_base(&desc.data, nullptr, engine,
8762  hint_fwd_pd.get(), allow_empty) {}
8763 
8778  const engine &engine,
8779  const gru_forward::primitive_desc &hint_fwd_pd,
8780  bool allow_empty = false)
8781  : rnn_primitive_desc_base(&desc.data, &attr, engine,
8782  hint_fwd_pd.get(), allow_empty) {}
8783 
8792  dnnl::algorithm::vanilla_gru) {}
8793 
8796  return rnn_base::src_layer_desc();
8797  }
8798 
8801 
8805  }
8806 
8809  return rnn_base::weights_iter_desc();
8810  }
8811 
8814 
8817  return rnn_base::dst_layer_desc();
8818  }
8819 
8822 
8825  return rnn_base::workspace_desc();
8826  }
8827 
8831  }
8832 
8836  }
8837 
8841  }
8842 
8846  }
8847 
8850  return rnn_base::diff_bias_desc();
8851  }
8852 
8856  }
8857 
8861  }
8862  };
8863 
8865  gru_backward() = default;
8866 
8871 };
8872 
8874 struct lbr_gru_forward : public primitive {
8876  struct desc {
8877  dnnl_rnn_desc_t data;
8878 
8925  const memory::desc &src_layer_desc,
8926  const memory::desc &src_iter_desc,
8927  const memory::desc &weights_layer_desc,
8928  const memory::desc &weights_iter_desc,
8929  const memory::desc &bias_desc,
8930  const memory::desc &dst_layer_desc,
8931  const memory::desc &dst_iter_desc,
8932  rnn_flags flags = rnn_flags::undef) {
8936  dnnl::convert_to_c(direction), &src_layer_desc.data,
8937  &src_iter_desc.data, &weights_layer_desc.data,
8938  &weights_iter_desc.data, &bias_desc.data,
8939  &dst_layer_desc.data, &dst_iter_desc.data,
8940  dnnl::convert_to_c(flags)),
8941  "could not create a descriptor for an LBR GRU forward "
8942  "propagation primitive");
8943  }
8944  };
8945 
8949  primitive_desc() = default;
8950 
8962  bool allow_empty = false)
8964  &desc.data, nullptr, engine, nullptr, allow_empty) {}
8965 
8978  const engine &engine, bool allow_empty = false)
8980  &desc.data, &attr, engine, nullptr, allow_empty) {}
8981 
8991  dnnl::algorithm::lbr_gru) {}
8992 
8995  return rnn_base::src_layer_desc();
8996  }
8997 
9000 
9004  }
9005 
9008  return rnn_base::weights_iter_desc();
9009  }
9010 
9013 
9016  return rnn_base::dst_layer_desc();
9017  }
9018 
9021 
9024  return rnn_base::workspace_desc();
9025  }
9026  };
9027 
9029  lbr_gru_forward() = default;
9030 
9035 };
9036 
9038 struct lbr_gru_backward : public primitive {
9040  struct desc {
9041  dnnl_rnn_desc_t data;
9042 
9111  const memory::desc &src_layer_desc,
9112  const memory::desc &src_iter_desc,
9113  const memory::desc &weights_layer_desc,
9114  const memory::desc &weights_iter_desc,
9115  const memory::desc &bias_desc,
9116  const memory::desc &dst_layer_desc,
9117  const memory::desc &dst_iter_desc,
9118  const memory::desc &diff_src_layer_desc,
9119  const memory::desc &diff_src_iter_desc,
9120  const memory::desc &diff_weights_layer_desc,
9121  const memory::desc &diff_weights_iter_desc,
9122  const memory::desc &diff_bias_desc,
9123  const memory::desc &diff_dst_layer_desc,
9124  const memory::desc &diff_dst_iter_desc,
9125  rnn_flags flags = rnn_flags::undef) {
9129  dnnl::convert_to_c(direction), &src_layer_desc.data,
9130  &src_iter_desc.data, &weights_layer_desc.data,
9131  &weights_iter_desc.data, &bias_desc.data,
9132  &dst_layer_desc.data, &dst_iter_desc.data,
9133  &diff_src_layer_desc.data, &diff_src_iter_desc.data,
9134  &diff_weights_layer_desc.data,
9135  &diff_weights_iter_desc.data, &diff_bias_desc.data,
9136  &diff_dst_layer_desc.data, &diff_dst_iter_desc.data,
9137  dnnl::convert_to_c(flags)),
9138  "could not create a descriptor for an LBR GRU backward "
9139  "propagation primitive");
9140  }
9141  };
9142 
9146  primitive_desc() = default;
9147 
9162  const lbr_gru_forward::primitive_desc &hint_fwd_pd,
9163  bool allow_empty = false)
9164  : rnn_primitive_desc_base(&desc.data, nullptr, engine,
9165  hint_fwd_pd.get(), allow_empty) {}
9166 
9182  const engine &engine,
9183  const lbr_gru_forward::primitive_desc &hint_fwd_pd,
9184  bool allow_empty = false)
9185  : rnn_primitive_desc_base(&desc.data, &attr, engine,
9186  hint_fwd_pd.get(), allow_empty) {}
9187 
9197 
9200  return rnn_base::src_layer_desc();
9201  }
9202 
9205 
9209  }
9210 
9213  return rnn_base::weights_iter_desc();
9214  }
9215 
9218 
9221  return rnn_base::dst_layer_desc();
9222  }
9223 
9226 
9229  return rnn_base::workspace_desc();
9230  }
9231 
9235  }
9236 
9240  }
9241 
9245  }
9246 
9250  }
9251 
9254  return rnn_base::diff_bias_desc();
9255  }
9256 
9260  }
9261 
9265  }
9266  };
9267 
9269  lbr_gru_backward() = default;
9270 
9275 };
9276 
9278 
9286 
9288 struct shuffle_forward : public primitive {
9290  struct desc {
9291  dnnl_shuffle_desc_t data;
9292 
9308  desc(prop_kind prop_kind, const memory::desc &data_desc, int axis,
9309  int group_size) {
9312  &data_desc.data, axis, group_size),
9313  "could not create a descriptor for a shuffle forward "
9314  "propagation primitive");
9315  }
9316  };
9317 
9321  primitive_desc() = default;
9322 
9335  const primitive_attr &attr = primitive_attr(),
9336  bool allow_empty = false)
9337  : dnnl::primitive_desc(
9338  &desc.data, &attr, engine, nullptr, allow_empty) {}
9339 
9347  : dnnl::primitive_desc(pd, dnnl::primitive::kind::shuffle,
9350 
9352  memory::desc src_desc() const { return base::src_desc(0); }
9353 
9355  memory::desc dst_desc() const { return base::dst_desc(0); }
9356  };
9357 
9359  shuffle_forward() = default;
9360 
9365 };
9366 
9368 struct shuffle_backward : public primitive {
9371  struct desc {
9372  dnnl_shuffle_desc_t data;
9373 
9387  desc(const memory::desc &diff_data_desc, int axis, int group_size) {
9389  &diff_data_desc.data, axis, group_size),
9390  "could not create a descriptor for a shuffle backward "
9391  "propagation primitive");
9392  }
9393  };
9394 
9398  primitive_desc() = default;
9399 
9415  const shuffle_forward::primitive_desc &hint_fwd_pd,
9416  const primitive_attr &attr = primitive_attr(),
9417  bool allow_empty = false)
9418  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
9419  allow_empty) {}
9420 
9428  : dnnl::primitive_desc(pd, dnnl::primitive::kind::shuffle,
9430 
9433 
9436  };
9437 
9439  shuffle_backward() = default;
9440 
9445 };
9446 
9448 
9456 
9458 struct binary : public primitive {
9460  struct desc {
9463 
9465  desc() = default;
9466 
9482  const memory::desc &src1, const memory::desc &dst) {
9485  &src0.data, &src1.data, &dst.data),
9486  "could not create a descriptor for a binary operation "
9487  "primitive");
9488  }
9489  };
9490 
9494  primitive_desc() = default;
9495 
9506  bool allow_empty = false)
9507  : dnnl::primitive_desc(
9508  &desc.data, nullptr, engine, nullptr, allow_empty) {}
9509 
9521  const engine &engine, bool allow_empty = false)
9522  : dnnl::primitive_desc(
9523  &desc.data, &attr, engine, nullptr, allow_empty) {}
9524 
9531 
9533  memory::desc src_desc(int idx = 0) const { return base::src_desc(idx); }
9534 
9536  memory::desc src0_desc() const { return base::src_desc(0); }
9537 
9539  memory::desc src1_desc() const { return base::src_desc(1); }
9540 
9542  memory::desc dst_desc() const { return base::dst_desc(0); }
9543  };
9544 
9546  binary() = default;
9547 
9551  binary(const primitive_desc &pd) : primitive(pd) {}
9552 };
9553 
9555 
9565 
9567 struct matmul : public primitive {
9569  struct desc {
9570  dnnl_matmul_desc_t data;
9571 
9584  desc(const memory::desc &src_desc, const memory::desc &weights_desc,
9585  const memory::desc &dst_desc) {
9587  dnnl_matmul_desc_init(&data, &src_desc.data,
9588  &weights_desc.data, nullptr, &dst_desc.data),
9589  "could not create a descriptor for a matmul primitive");
9590  }
9591 
9606  desc(const memory::desc &src_desc, const memory::desc &weights_desc,
9607  const memory::desc &bias_desc, const memory::desc &dst_desc) {
9608  error::wrap_c_api(dnnl_matmul_desc_init(&data, &src_desc.data,
9609  &weights_desc.data, &bias_desc.data,
9610  &dst_desc.data),
9611  "could not create a descriptor for a matmul primitive");
9612  }
9613  };
9614 
9618  primitive_desc() = default;
9619 
9629  bool allow_empty = false)
9630  : dnnl::primitive_desc(
9631  &desc.data, nullptr, engine, nullptr, allow_empty) {}
9632 
9643  const engine &engine, bool allow_empty = false)
9644  : dnnl::primitive_desc(
9645  &desc.data, &attr, engine, nullptr, allow_empty) {}
9646 
9653 
9656 
9659  return query_md(query::weights_md, 0);
9660  }
9661 
9664  return query_md(query::weights_md, 1);
9665  }
9666 
9669  };
9670 
9672  matmul() = default;
9673 
9676  matmul(const primitive_desc &pd) : primitive(pd) {}
9677 };
9678 
9680 
9690 
9694  struct desc {
9696 
9703  //
9719  const memory::desc &src_desc, const memory::desc &dst_desc) {
9722  convert_to_c(algorithm), nullptr,
9723  &src_desc.data, &dst_desc.data),
9724  "could not create a resampling forward descriptor");
9725  }
9726 
9742  const std::vector<float> &factors,
9743  const memory::desc &src_desc) {
9744  memory::validate_dims(factors, src_desc.data.ndims - 2);
9747  convert_to_c(algorithm), &factors[0],
9748  &src_desc.data, nullptr),
9749  "could not create a resampling forward descriptor");
9750  }
9751 
9758  //
9775  const std::vector<float> &factors, const memory::desc &src_desc,
9776  const memory::desc &dst_desc) {
9777  if (!factors.empty())
9778  memory::validate_dims(factors, src_desc.data.ndims - 2);
9781  convert_to_c(algorithm), factors.data(),
9782  &src_desc.data, &dst_desc.data),
9783  "could not create a resampling forward descriptor");
9784  }
9785  };
9786 
9790  primitive_desc() = default;
9791 
9803  bool allow_empty = false)
9804  : dnnl::primitive_desc(
9805  &desc.data, nullptr, engine, nullptr, allow_empty) {}
9806 
9819  const engine &engine, bool allow_empty = false)
9820  : dnnl::primitive_desc(
9821  &desc.data, &attr, engine, nullptr, allow_empty) {}
9822 
9830  : dnnl::primitive_desc(pd, dnnl::primitive::kind::resampling,
9833 
9835  memory::desc src_desc() const { return base::src_desc(0); }
9836 
9838  memory::desc dst_desc() const { return base::dst_desc(0); }
9839  };
9840 
9842  resampling_forward() = default;
9843 
9848 };
9849 
9853  struct desc {
9855 
9870  desc(algorithm algorithm, const memory::desc &diff_src_desc,
9871  const memory::desc &diff_dst_desc) {
9873  convert_to_c(algorithm), nullptr,
9874  &diff_src_desc.data, &diff_dst_desc.data),
9875  "could not create a resampling backward data descriptor");
9876  }
9877 
9893  desc(algorithm algorithm, const std::vector<float> &factors,
9894  const memory::desc &diff_src_desc,
9895  const memory::desc &diff_dst_desc) {
9896  if (!factors.empty())
9897  memory::validate_dims(factors, diff_src_desc.data.ndims - 2);
9899  convert_to_c(algorithm), factors.data(),
9900  &diff_src_desc.data, &diff_dst_desc.data),
9901  "could not create a resampling backward data descriptor");
9902  }
9903  };
9904 
9908  primitive_desc() = default;
9909 
9924  const resampling_forward::primitive_desc &hint_fwd_pd,
9925  bool allow_empty = false)
9926  : dnnl::primitive_desc(&desc.data, nullptr, engine,
9927  hint_fwd_pd.get(), allow_empty) {}
9928 
9944  const engine &engine,
9945  const resampling_forward::primitive_desc &hint_fwd_pd,
9946  bool allow_empty = false)
9947  : dnnl::primitive_desc(&desc.data, &attr, engine, hint_fwd_pd.get(),
9948  allow_empty) {}
9949 
9957  : dnnl::primitive_desc(pd, dnnl::primitive::kind::resampling,
9959 
9962 
9965  };
9966 
9968  resampling_backward() = default;
9969 
9974 };
9975 
9977 
9979 
9985 
9988 
9990 enum class status {
10005 };
10006 
10008 inline status set_verbose(int level) {
10009  return static_cast<status>(dnnl_set_verbose(level));
10010 }
10011 
10013 inline const version_t *version() {
10014  return dnnl_version();
10015 }
10016 
10018 inline status set_jit_dump(int enable) {
10019  return static_cast<status>(dnnl_set_jit_dump(enable));
10020 }
10021 
10023 inline status set_jit_profiling_flags(unsigned flags) {
10024  return static_cast<status>(dnnl_set_jit_profiling_flags(flags));
10025 }
10026 
10028 inline status set_jit_profiling_jitdumpdir(const std::string &dir) {
10029  return static_cast<status>(dnnl_set_jit_profiling_jitdumpdir(dir.c_str()));
10030 }
10031 
10033 enum class cpu_isa {
10052 };
10053 
10056  return static_cast<status>(
10057  dnnl_set_max_cpu_isa(static_cast<dnnl_cpu_isa_t>(isa)));
10058 }
10059 
10061 
10068 
10070 inline status sgemm(char transa, char transb, dnnl_dim_t M, dnnl_dim_t N,
10071  dnnl_dim_t K, float alpha, const float *A, dnnl_dim_t lda,
10072  const float *B, dnnl_dim_t ldb, float beta, float *C, dnnl_dim_t ldc) {
10073  return static_cast<status>(dnnl_sgemm(
10074  transa, transb, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc));
10075 }
10076 
10078 inline status gemm_u8s8s32(char transa, char transb, char offsetc, dnnl_dim_t M,
10079  dnnl_dim_t N, dnnl_dim_t K, float alpha, const uint8_t *A,
10080  dnnl_dim_t lda, uint8_t ao, const int8_t *B, dnnl_dim_t ldb, int8_t bo,
10081  float beta, int32_t *C, dnnl_dim_t ldc, const int32_t *co) {
10082  return static_cast<status>(dnnl_gemm_u8s8s32(transa, transb, offsetc, M, N,
10083  K, alpha, A, lda, ao, B, ldb, bo, beta, C, ldc, co));
10084 }
10085 
10087 inline status gemm_s8s8s32(char transa, char transb, char offsetc, dnnl_dim_t M,
10088  dnnl_dim_t N, dnnl_dim_t K, float alpha, const int8_t *A,
10089  dnnl_dim_t lda, int8_t ao, const int8_t *B, dnnl_dim_t ldb, int8_t bo,
10090  float beta, int32_t *C, dnnl_dim_t ldc, const int32_t *co) {
10091  return static_cast<status>(dnnl_gemm_s8s8s32(transa, transb, offsetc, M, N,
10092  K, alpha, A, lda, ao, B, ldb, bo, beta, C, ldc, co));
10093 }
10094 
10096 
10097 // implementation section
10098 
10101  dnnl_primitive_t result;
10103  "could not create a primitive");
10104  reset(result);
10105 }
10106 
10107 inline primitive::primitive(const primitive_desc &pd) : primitive(pd.get()) {}
10108 
10109 inline void primitive::execute(
10110  stream &stream, const std::unordered_map<int, memory> &args) const {
10111  std::vector<dnnl_exec_arg_t> c_args;
10112  c_args.reserve(args.size());
10113  for (const auto &a : args)
10114  c_args.push_back({a.first, a.second.get(true)});
10115 
10116  error::wrap_c_api(dnnl_primitive_execute(get(), stream.get(),
10117  (int)c_args.size(), c_args.data()),
10118  "could not execute a primitive");
10119 }
10121 
10122 #undef DNNL_DEFINE_BITMASK_OPS
10123 
10124 } // namespace dnnl
10125 
10127 
10128 #endif
Layer normalization forward propagation primitive.
Definition: dnnl.hpp:6358
dnnl_status_t DNNL_API dnnl_primitive_attr_create(dnnl_primitive_attr_t *attr)
Creates an empty (default) primitive attributes with all the parameters set to their default values...
desc(algorithm algorithm, 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)
Constructs a descriptor for a convolution backward propagation primitive.
Definition: dnnl.hpp:3727
dnnl_status_t DNNL_API dnnl_post_ops_get_params_dw_k3s1p1(const_dnnl_post_ops_t post_ops, int index, dnnl_data_type_t *weights_data_type, dnnl_data_type_t *bias_data_type, dnnl_data_type_t *dst_data_type, dnnl_dim_t *count, int *mask, const float **scales)
Returns the parameters of an depthwise post-op with stride 1.
A layer normalization primitive.
Definition: dnnl_types.h:693
cl_device_id get_ocl_device() const
Returns the OpenCL device associated with the engine.
Definition: dnnl.hpp:928
dnnl_status_t DNNL_API dnnl_primitive_attr_set_rnn_data_qparams(dnnl_primitive_attr_t attr, const float scale, const float shift)
Set quantization scale and shift parameters for RNN data tensors.
dnnl_status_t DNNL_API dnnl_post_ops_get_params_dw_k3s2p1(const_dnnl_post_ops_t post_ops, int index, dnnl_data_type_t *weights_data_type, dnnl_data_type_t *bias_data_type, dnnl_data_type_t *dst_data_type, dnnl_dim_t *count, int *mask, const float **scales)
Returns the parameters of an depthwise post-op with stride 2.
deconvolution_forward(const primitive_desc &pd)
Constructs a deconvolution forward propagation primitive.
Definition: dnnl.hpp:4419
primitive_desc(const desc &desc, const engine &engine, const resampling_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a resampling backward propagation primitive.
Definition: dnnl.hpp:9923
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for an LSTM forward propagation primitive.
Definition: dnnl.hpp:7965
destination grad. memory desc
Definition: dnnl_types.h:1991
void * get_data_handle() const
Returns the underlying memory buffer.
Definition: dnnl.hpp:1919
An element-wise primitive.
Definition: dnnl_types.h:683
flags
Stream flags. Can be combined using the bitwise OR operator.
Definition: dnnl.hpp:985
memory::desc diff_weights_desc() const
Returns a diff weights memory descriptor.
Definition: dnnl.hpp:4839
Primitive descriptor for a shuffle forward propagation primitive.
Definition: dnnl.hpp:9319
dnnl_status_t DNNL_API dnnl_lstm_forward_desc_init(dnnl_rnn_desc_t *rnn_desc, dnnl_prop_kind_t prop_kind, dnnl_rnn_direction_t direction, const dnnl_memory_desc_t *src_layer_desc, const dnnl_memory_desc_t *src_iter_desc, const dnnl_memory_desc_t *src_iter_c_desc, const dnnl_memory_desc_t *weights_layer_desc, const dnnl_memory_desc_t *weights_iter_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_layer_desc, const dnnl_memory_desc_t *dst_iter_desc, const dnnl_memory_desc_t *dst_iter_c_desc, unsigned flags)
Initializes a descriptor for LSTM forward propagation primitive.
Elementwise: soft_relu.
lrn_backward(const primitive_desc &pd)
Constructs an LRN backward propagation primitive.
Definition: dnnl.hpp:5088
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for reorder primitive from a C API primitive descriptor which must ...
Definition: dnnl.hpp:3056
prop_kind
Propagation kind.
Definition: dnnl.hpp:436
primitive_desc(const desc &desc, const engine &engine, const gru_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a GRU backward propagation primitive.
Definition: dnnl.hpp:8758
memory::desc dst_layer_desc() const
Returns destination layer memory descriptor.
Definition: dnnl.hpp:7496
memory::desc diff_dst_desc(int idx) const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:2774
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:9655
memory::desc src_iter_c_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:8374
dnnl_status_t DNNL_API dnnl_gemm_s8s8s32(char transa, char transb, char offsetc, dnnl_dim_t M, dnnl_dim_t N, dnnl_dim_t K, float alpha, const int8_t *A, dnnl_dim_t lda, int8_t ao, const int8_t *B, dnnl_dim_t ldb, int8_t bo, float beta, int32_t *C, dnnl_dim_t ldc, const int32_t *co)
Performs integer matrix-matrix multiply on 8-bit signed matrix A, 8-bit signed matrix B...
execution engine
Definition: dnnl_types.h:1942
primitive_desc(const desc &desc, const engine &engine, const logsoftmax_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a logsoftmax backward propagation primitive.
Definition: dnnl.hpp:5945
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a pooling forward propagation primitive.
Definition: dnnl.hpp:5168
A batch normalization primitive.
Definition: dnnl_types.h:691
sum()=default
Default constructor. Produces an empty object.
desc(const memory::desc &diff_src_desc, const memory::desc &weights_desc, const memory::desc &diff_dst_desc)
Constructs a descriptor for an inner product backward propagation primitive.
Definition: dnnl.hpp:6907
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:5769
primitive_desc()=default
Default constructor. Produces an empty object.
dnnl_status_t DNNL_API dnnl_primitive_desc_get_attr(const_dnnl_primitive_desc_t primitive_desc, const_dnnl_primitive_attr_t *attr)
Returns a constant reference to the attributes of a primitive descriptor.
Deconvolution forward propagation primitive.
Definition: dnnl.hpp:4152
Eltwise: bounded_relu.
Definition: dnnl_types.h:738
memory::desc weights_iter_desc() const
Returns weights iteration memory descriptor.
Definition: dnnl.hpp:9007
primitive_desc(const desc &desc, const engine &engine, const convolution_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a convolution backward propagation primitive.
Definition: dnnl.hpp:3809
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:4960
Undefined memory format tag.
Definition: dnnl_types.h:169
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const lrn_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an LRN backward propagation primitive.
Definition: dnnl.hpp:5055
3D tensor blocked by 2nd dimension with block size 16
Definition: dnnl_types.h:210
shuffle_backward(const primitive_desc &pd)
Constructs a shuffle backward propagation primitive.
Definition: dnnl.hpp:9444
A tensor in a generic format described by the stride and blocking values in each dimension.
Definition: dnnl_types.h:89
memory::desc diff_dst_iter_desc() const
Returns diff destination iteration memory descriptor.
Definition: dnnl.hpp:8455
Primitive descriptor for a pooling forward propagation primitive.
Definition: dnnl.hpp:5155
scratchpad memory desc
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a convolution backward propagation primitive from a C API primi...
Definition: dnnl.hpp:3842
Vanilla RNN descriptor backward propagation primitive.
Definition: dnnl.hpp:7521
CPU engine.
Definition: dnnl_types.h:1599
inner_product_backward_data()=default
Default constructor. Produces an empty object.
primitive_desc()=default
Default constructor. Produces an empty object.
desc(prop_kind prop_kind, const memory::desc &data_desc, int axis, int group_size)
Constructs a descriptor for a shuffle forward propagation primitive.
Definition: dnnl.hpp:9308
Eltwise: ReLU (dst for backward)
Definition: dnnl_types.h:763
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:9355
dnnl_status_t DNNL_API dnnl_convolution_backward_weights_desc_init(dnnl_convolution_desc_t *conv_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *diff_weights_desc, const dnnl_memory_desc_t *diff_bias_desc, const dnnl_memory_desc_t *diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a convolution weights gradient primitive.
dnnl_status_t DNNL_API dnnl_gemm_u8s8s32(char transa, char transb, char offsetc, dnnl_dim_t M, dnnl_dim_t N, dnnl_dim_t K, float alpha, const uint8_t *A, dnnl_dim_t lda, uint8_t ao, const int8_t *B, dnnl_dim_t ldb, int8_t bo, float beta, int32_t *C, dnnl_dim_t ldc, const int32_t *co)
Performs integer matrix-matrix multiply on 8-bit unsigned matrix A, 8-bit signed matrix B...
#define DNNL_ARG_DIFF_WEIGHTS_ITER
A special mnemonic for diff of RNN weights applied to the recurrent input.
Definition: dnnl_types.h:1870
destination memory desc
Definition: dnnl_types.h:1990
Direct deconvolution.
Definition: dnnl_types.h:720
Elementwise: exponential linear unit (elu)
primitive_desc()=default
Default constructor. Produces an empty object.
primitive_desc(const desc &desc, const engine &engine, const shuffle_forward::primitive_desc &hint_fwd_pd, const primitive_attr &attr=primitive_attr(), bool allow_empty=false)
Constructs a primitive descriptor for a shuffle backward propagation primitive.
Definition: dnnl.hpp:9414
primitive_desc()=default
Default constructor. Produces an empty object.
A descriptor for an RNN operation.
Definition: dnnl_types.h:1439
The user manages the scratchpad allocation by querying and providing the scratchpad memory to primiti...
Definition: dnnl_types.h:1671
The operation failed due to an out-of-memory condition.
memory::desc weights_iter_desc() const
Returns weights iteration memory descriptor.
Definition: dnnl.hpp:8384
layer normalization descriptor
Definition: dnnl_types.h:1975
gru_backward(const primitive_desc &pd)
Constructs a GRU backward propagation primitive.
Definition: dnnl.hpp:8870
memory::desc diff_weights_peephole_desc() const
Returns diff weights peephole memory descriptor.
Definition: dnnl.hpp:7268
Elementwise: erf-based gelu.
primitive_desc(const desc &desc, const engine &engine, const batch_normalization_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a batch normalization backward propagation primitive.
Definition: dnnl.hpp:6253
memory consumption – extra
Definition: dnnl_types.h:1949
Average pooling exclude padding, alias for dnnl::algorithm::pooling_avg_include_padding.
memory::desc weights_layer_desc() const
Returns weights layer memory descriptor.
Definition: dnnl.hpp:7190
status gemm_s8s8s32(char transa, char transb, char offsetc, dnnl_dim_t M, dnnl_dim_t N, dnnl_dim_t K, float alpha, const int8_t *A, dnnl_dim_t lda, int8_t ao, const int8_t *B, dnnl_dim_t ldb, int8_t bo, float beta, int32_t *C, dnnl_dim_t ldc, const int32_t *co)
Performs integer matrix-matrix multiply on 8-bit signed matrix A, 8-bit signed matrix B...
Definition: dnnl.hpp:10087
dnnl_primitive_kind_t
Kinds of primitives.
Definition: dnnl_types.h:667
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const deconvolution_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a deconvolution weights update primitive.
Definition: dnnl.hpp:4818
A resampling primitive.
void get_params_dw_k3s1p1(int index, memory::data_type &weights_data_type, memory::data_type &bias_data_type, memory::data_type &dst_data_type, int &mask, std::vector< float > &scales) const
Returns the parameters of an depthwise post-op with stride 1.
Definition: dnnl.hpp:2234
Average pooling include padding.
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a logsoftmax forward propagation primitive. ...
Definition: dnnl.hpp:5858
eltwise_forward()=default
Default constructor. Produces an empty object.
permuted 3D tensor
Definition: dnnl_types.h:193
Eltwise: linear.
Definition: dnnl_types.h:736
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a batch normalization backward propagation primitive from a C A...
Definition: dnnl.hpp:6286
desc(prop_kind prop_kind, const memory::desc &data_desc, int softmax_axis)
Constructs a descriptor for a softmax forward propagation primitive.
Definition: dnnl.hpp:5604
Primitive descriptor for a convolution backward propagation primitive.
Definition: dnnl.hpp:3792
softmax_backward(const primitive_desc &pd)
Constructs a softmax backward propagation primitive.
Definition: dnnl.hpp:5781
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:4963
Bidirectional execution of RNN primitive with concatenation of the results.
Primitive descriptor for a pooling backward propagation primitive.
Definition: dnnl.hpp:5268
memory::desc dst_iter_desc() const
Returns destination iteration memory descriptor.
Definition: dnnl.hpp:8018
Elementwise: logistic (dst for backward)
memory::desc diff_weights_desc() const
Returns a diff weights memory descriptor.
Definition: dnnl.hpp:6709
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:6981
memory(const desc &md, const engine &engine)
Constructs a memory object.
Definition: dnnl.hpp:1897
void set_scratchpad_mode(scratchpad_mode mode)
Sets scratchpad mode.
Definition: dnnl.hpp:2389
vanilla_rnn_backward()=default
Default constructor. Produces an empty object.
A resampling primitive.
Definition: dnnl_types.h:707
shuffle_forward(const primitive_desc &pd)
Constructs a shuffle forward propagation primitive.
Definition: dnnl.hpp:9364
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a batch normalization forward propagation primitive.
Definition: dnnl.hpp:6103
logsoftmax_backward(const primitive_desc &pd)
Constructs a logsoftmax backward propagation primitive.
Definition: dnnl.hpp:6002
An opaque structure to describe a primitive.
GRU cell with linear before reset.
Definition: dnnl_types.h:799
deconvolution_backward_weights(const primitive_desc &pd)
Constructs a deconvolution weights gradient primitive.
Definition: dnnl.hpp:4858
DNNL namespace.
Definition: dnnl.hpp:77
Descriptor for a convolution forward propagation primitive.
Definition: dnnl.hpp:3419
Any ISA (no restrictions)
Definition: dnnl_types.h:2079
memory::desc diff_weights_desc() const
Returns a diff weights memory descriptor.
Definition: dnnl.hpp:6308
Undefined data type, used for empty memory descriptors.
Definition: dnnl_types.h:64
primitive_desc()=default
Default constructor. Produces an empty object.
status set_max_cpu_isa(cpu_isa isa)
Sets the maximal ISA DNNL can dispatch to on the CPU.
Definition: dnnl.hpp:10055
dnnl_status_t DNNL_API dnnl_lstm_backward_desc_init_v2(dnnl_rnn_desc_t *rnn_desc, dnnl_prop_kind_t prop_kind, dnnl_rnn_direction_t direction, const dnnl_memory_desc_t *src_layer_desc, const dnnl_memory_desc_t *src_iter_desc, const dnnl_memory_desc_t *src_iter_c_desc, const dnnl_memory_desc_t *weights_layer_desc, const dnnl_memory_desc_t *weights_iter_desc, const dnnl_memory_desc_t *weights_peephole_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_layer_desc, const dnnl_memory_desc_t *dst_iter_desc, const dnnl_memory_desc_t *dst_iter_c_desc, const dnnl_memory_desc_t *diff_src_layer_desc, const dnnl_memory_desc_t *diff_src_iter_desc, const dnnl_memory_desc_t *diff_src_iter_c_desc, const dnnl_memory_desc_t *diff_weights_layer_desc, const dnnl_memory_desc_t *diff_weights_iter_desc, const dnnl_memory_desc_t *diff_weights_peephole_desc, const dnnl_memory_desc_t *diff_bias_desc, const dnnl_memory_desc_t *diff_dst_layer_desc, const dnnl_memory_desc_t *diff_dst_iter_desc, const dnnl_memory_desc_t *diff_dst_iter_c_desc, unsigned flags)
Initializes a descriptor for an LSTM (with or without peephole) backward propagation primitive...
static engine query(const primitive_desc &pd)
Returns the engine of a primitive descriptor.
Definition: dnnl.hpp:942
memory::desc src_iter_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:8371
dnnl_status_t DNNL_API dnnl_memory_desc_init_by_strides(dnnl_memory_desc_t *memory_desc, int ndims, const dnnl_dims_t dims, dnnl_data_type_t data_type, const dnnl_dims_t strides)
Initializes a memory descriptor using dimensions and strides.
primitive_desc()=default
Default constructor. Produces an empty object.
desc(const dnnl_memory_desc_t &data)
Constructs a memory descriptor from a C API data structure.
Definition: dnnl.hpp:1690
desc(prop_kind prop_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)
Constructs an LSTM descriptor for backward propagation using prop_kind, direction, and memory descriptors.
Definition: dnnl.hpp:8272
memory::desc src_iter_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:7695
memory::desc bias_desc() const
Returns the bias memory descriptor.
Definition: dnnl.hpp:3682
memory::desc diff_weights_layer_desc() const
Returns diff weights layer memory descriptor.
Definition: dnnl.hpp:7256
primitive_desc(const memory::desc &dst, const std::vector< float > &scales, const std::vector< memory::desc > &srcs, const engine &engine, const primitive_attr &attr=primitive_attr())
Constructs a primitive descriptor for a sum primitive.
Definition: dnnl.hpp:3258
memory::desc weights_iter_desc() const
Returns weights iteration memory descriptor.
Definition: dnnl.hpp:9212
dnnl_status_t DNNL_API dnnl_dilated_convolution_forward_desc_init(dnnl_convolution_desc_t *conv_desc, dnnl_prop_kind_t prop_kind, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a dilated convolution forward propagation primitive. ...
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:5449
memory::desc src_iter_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:9204
dnnl_status_t DNNL_API dnnl_lrn_backward_desc_init(dnnl_lrn_desc_t *lrn_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *diff_data_desc, const dnnl_memory_desc_t *data_desc, dnnl_dim_t local_size, float alpha, float beta, float k)
Initializes a descriptor for LRN backward propagation primitive.
Primitive descriptor for a convolution weights gradient primitive.
Definition: dnnl.hpp:4060
primitive_desc(const desc &desc, const engine &engine, const inner_product_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an inner product backward propagation primitive.
Definition: dnnl.hpp:6937
desc(algorithm algorithm, 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)
Constructs a descriptor for a dilated convolution weights gradient primitive with bias...
Definition: dnnl.hpp:3991
binary()=default
Default constructor. Produces an empty object.
dnnl_status_t DNNL_API dnnl_layer_normalization_backward_desc_init(dnnl_layer_normalization_desc_t *lnrm_desc, dnnl_prop_kind_t prop_kind, const dnnl_memory_desc_t *diff_data_desc, const dnnl_memory_desc_t *data_desc, const dnnl_memory_desc_t *stat_desc, float epsilon, unsigned flags)
Initializes a descriptor for a layer normalization backward propagation primitive.
#define DNNL_ARG_WEIGHTS_LAYER
A special mnemonic for RNN weights applied to the layer input.
Definition: dnnl_types.h:1784
scratchpad memory desc
Definition: dnnl_types.h:1993
Elementwise: natural logarithm.
dnnl_status_t DNNL_API dnnl_primitive_desc_iterator_next(dnnl_primitive_desc_iterator_t iterator)
Advances the primitive descriptor iterator to point to the next available implementation.
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:8824
const void * const_dnnl_op_desc_t
A pointer to any of the operation descriptors (constant variant).
Definition: dnnl_types.h:1075
Intel(R) SSE4.1.
Definition: dnnl_types.h:2082
Eltwise: clip.
Definition: dnnl_types.h:757
inner_product_backward_data(const primitive_desc &pd)
Constructs an inner product backward propagation primitive.
Definition: dnnl.hpp:6990
Shuffle backward propagation primitive.
Definition: dnnl.hpp:9368
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a LBR GRU forward propagation primitive.
Definition: dnnl.hpp:8977
sum(const primitive_desc &pd)
Constructs a sum primitive.
Definition: dnnl.hpp:3325
An opaque structure for primitive descriptor attributes.
reorder destination engine
cl_context get_ocl_context() const
Returns the OpenCL context associated with the engine.
Definition: dnnl.hpp:919
memory::desc dst_iter_desc() const
Returns destination iteration memory descriptor.
Definition: dnnl.hpp:9020
Deconvolution weights gradient primitive.
Definition: dnnl.hpp:4591
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a matmul primitive from a C API primitive descriptor that must ...
Definition: dnnl.hpp:9651
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:7123
memory::desc diff_src_layer_desc() const
Returns diff source layer memory descriptor.
Definition: dnnl.hpp:8415
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:9352
gru_forward()=default
Default constructor. Produces an empty object.
logsoftmax descriptor
Definition: dnnl_types.h:1980
Backward propagation (with respect to all parameters).
kind
Kinds of primitives supported by the library.
Definition: dnnl.hpp:278
permuted 4D tensor
Definition: dnnl_types.h:190
void get_output_scales(int &mask, std::vector< float > &scales) const
Returns output scaling factors correspondence mask and values.
Definition: dnnl.hpp:2404
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const softmax_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a softmax backward propagation primitive.
Definition: dnnl.hpp:5748
Use scale and shift parameters.
memory::desc diff_src_iter_desc() const
Returns diff source iteration memory descriptor.
Definition: dnnl.hpp:7244
desc(prop_kind prop_kind, algorithm algorithm, 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)
Constructs a descriptor for a deconvolution forward propagation primitive with bias.
Definition: dnnl.hpp:4188
memory::desc src_iter_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:7987
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:4404
Primitive iterator passed over last primitive descriptor.
Definition: dnnl_types.h:49
memory::desc diff_bias_desc() const
Returns diff bias memory descriptor.
Definition: dnnl.hpp:7277
primitive_desc(const desc &desc, const engine &engine, const lrn_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an LRN backward propagation primitive.
Definition: dnnl.hpp:5036
dnnl_status_t DNNL_API dnnl_convolution_backward_data_desc_init(dnnl_convolution_desc_t *conv_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *diff_src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a convolution backward propagation primitive.
#define DNNL_ARG_DST_LAYER
A special mnemonic for RNN output vector. An alias for DNNL_ARG_DST_0.
Definition: dnnl_types.h:1760
desc(prop_kind prop_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)
Constructs a descriptor for LBR GRU forward propagation primitive.
Definition: dnnl.hpp:8924
Local response normalization (LRN) forward propagation primitive.
Definition: dnnl.hpp:4873
memory::desc src_desc(int idx) const
Returns a source memory descriptor.
Definition: dnnl.hpp:2738
An opaque structure to describe a memory.
Base class for primitive descriptors for RNN primitives.
Definition: dnnl.hpp:7151
void reset(T t, bool weak=false)
Resets the handle wrapper objects to wrap a new C API handle.
Definition: dnnl.hpp:179
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a batch normalization forward propagation primitive.
Definition: dnnl.hpp:6119
Descriptor for an inner product backward propagation primitive.
Definition: dnnl.hpp:6887
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a shuffle backward propagation primitive from a C API primitive...
Definition: dnnl.hpp:9427
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for an inner product forward propagation primitive.
Definition: dnnl.hpp:6846
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:6706
Elementwise: hyperbolic tangent non-linearity (tanh) (dst for backward)
permuted 5D tensor
Definition: dnnl_types.h:191
dnnl_memory_desc_t data
The underlying C API data structure.
Definition: dnnl.hpp:1626
LBR GRU backward propagation primitive.
Definition: dnnl.hpp:9038
Descriptor for a layer normalization forward propagation primitive.
Definition: dnnl.hpp:6360
dnnl_engine_kind_t
Kinds of engines.
Definition: dnnl_types.h:1595
desc(prop_kind prop_kind, const memory::desc &diff_data_desc, const memory::desc &data_desc, const memory::desc &stat_desc, float epsilon, normalization_flags flags)
Constructs a descriptor for layer normalization backward propagation primitive.
Definition: dnnl.hpp:6583
Eltwise: square root (dst for backward)
Definition: dnnl_types.h:769
non-standard 16-bit (bfloat16 w/ 7 bit mantissa) floating point.
Definition: dnnl_types.h:68
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:5559
memory::desc weights_layer_desc() const
Returns weights layer memory descriptor.
Definition: dnnl.hpp:7483
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:3670
primitive_desc()=default
Default constructor. Produces an empty object.
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a softmax forward propagation primitive from a C API primitive ...
Definition: dnnl.hpp:5656
memory::desc dst_iter_desc() const
Returns destination iteration memory descriptor.
Definition: dnnl.hpp:8619
batch_normalization_backward()=default
Default constructor. Produces an empty object.
Intel(R) Advanced Vector Extensions 512 with Intel(R) DL Boost Support for Intel(R) Xeon(R) Processor...
lbr_gru_forward()=default
Default constructor. Produces an empty object.
Primitive descriptor for a concat primitive.
Definition: dnnl.hpp:3133
memory::dims dims() const
Returns dimensions of the memory descriptor.
Definition: dnnl.hpp:1822
#define DNNL_ARG_SRC_LAYER
A special mnemonic for RNN input vector.
Definition: dnnl_types.h:1734
Elementwise: square root (dst for backward)
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a resampling forward propagation primitive. ...
Definition: dnnl.hpp:9818
void execute(stream &stream, const std::unordered_map< int, memory > &args) const
Executes computations specified by the primitive in a specified stream.
desc(const memory::desc &diff_data_desc, const memory::desc &data_desc, int softmax_axis)
Constructs a descriptor for a softmax backward propagation primitive.
Definition: dnnl.hpp:5700
Undefined primitive.
Definition: dnnl_types.h:669
Intel(R) Advanced Vector Extensions 512 subset for Intel(R) Xeon Phi(TM) Processors x200 Series...
void set_post_ops(const post_ops ops)
Sets post-ops.
Definition: dnnl.hpp:2588
number of outputs expected
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a pooling forward propagation primitive.
Definition: dnnl.hpp:5183
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:7504
primitive::kind kind(int index) const
Returns the primitive kind of post-op at entry with a certain index.
Definition: dnnl.hpp:2099
Unidirectional execution of RNN primitive from left to right.
Definition: dnnl_types.h:1425
execution engine
The library manages the scratchpad allocation according to the policy specified by the DNNL_ENABLE_CO...
Definition: dnnl_types.h:1666
memory::desc diff_src_layer_desc() const
Returns diff source layer memory descriptor.
Definition: dnnl.hpp:7236
Descriptor for an inner product weights gradient primitive.
Definition: dnnl.hpp:6996
dnnl_status_t DNNL_API dnnl_memory_destroy(dnnl_memory_t memory)
Destroys a memory object.
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:5203
dnnl_status_t DNNL_API dnnl_memory_get_data_handle(const_dnnl_memory_t memory, void **handle)
Returns memory object&#39;s data handle.
3D tensor blocked by 2nd dimension with block size 4
Definition: dnnl_types.h:214
desc(const memory::desc &diff_data_desc, const memory::desc &data_desc, int logsoftmax_axis)
Constructs a descriptor for a logsoftmax backward propagation primitive.
Definition: dnnl.hpp:5917
memory::desc weights_peephole_desc() const
Returns weights peephole memory descriptor.
Definition: dnnl.hpp:7202
batch normalization descriptor
memory::desc src_layer_desc() const
Returns source layer memory descriptor.
Definition: dnnl.hpp:8593
3D CNN activations tensor blocked by channels with block size 8, an alias to dnnl_aBc8b ...
Definition: dnnl_types.h:487
Nearest Neighbor resampling method.
memory::desc diff_weights_iter_desc() const
Returns diff weights iteration memory descriptor.
Definition: dnnl.hpp:8435
Intel(R) Advanced Vector Extensions 512 subset for Intel(R) Xeon Phi(TM) Processors 7235...
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:5882
dnnl_dims_t dims
Dimensions in the following order:
Definition: dnnl_types.h:1020
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const lstm_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an LSTM backward propagation primitive.
Definition: dnnl.hpp:8348
primitive_desc()=default
Default constructor. Produces an empty object.
4D CNN activations tensor blocked by channels with block size 16, an alias to dnnl_aBcd16b ...
Definition: dnnl_types.h:472
memory::desc bias_desc() const
Returns bias memory descriptor.
Definition: dnnl.hpp:9012
binary descriptor
Definition: dnnl_types.h:1979
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for an elementwise forward propagation primitive.
Definition: dnnl.hpp:5413
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:6866
Elementwise: square root.
primitive_desc()=default
Default constructor. Produces an empty object.
The operation was successful.
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:2818
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:9835
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:5990
Any ISA (no restrictions)
Intel(R) SSE4.1.
dnnl_status_t DNNL_API dnnl_primitive_attr_destroy(dnnl_primitive_attr_t attr)
Destroys primitive attributes.
#define DNNL_ARG_WEIGHTS_ITER
A special mnemonic for RNN weights applied to the recurrent input.
Definition: dnnl_types.h:1790
desc(algorithm algorithm, 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)
Constructs a descriptor for a deconvolution weights gradient primitive without bias.
Definition: dnnl.hpp:4667
Descriptor for a batch normalization backward propagation primitive.
Definition: dnnl.hpp:6188
memory::desc diff_weights_peephole_desc() const
Returns diff weights peephole memory descriptor.
Definition: dnnl.hpp:8440
primitive_desc(const_dnnl_op_desc_t desc, const primitive_attr *attr, const engine &engine, const_dnnl_primitive_desc_t hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor.
Definition: dnnl.hpp:3362
memory::desc diff_dst_iter_desc() const
Returns diff destination iteration memory descriptor.
Definition: dnnl.hpp:7754
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for an LRN forward propagation primitive.
Definition: dnnl.hpp:4943
memory::desc diff_weights_layer_desc() const
Returns diff weights layer memory descriptor.
Definition: dnnl.hpp:8430
A descriptor of a pooling operation.
Definition: dnnl_types.h:1244
status set_jit_profiling_jitdumpdir(const std::string &dir)
Sets JIT dump output path.
Definition: dnnl.hpp:10028
desc permute_axes(const std::vector< int > &permutation, bool allow_empty=false) const
Constructs a memory descriptor by permuting axes in an existing one.
Definition: dnnl.hpp:1806
plain 2D tensor
Definition: dnnl_types.h:178
kind get_kind() const
Returns the kind of the engine.
Definition: dnnl.hpp:909
A memory descriptor.
Definition: dnnl.hpp:1623
C API.
primitive_desc_base(dnnl_primitive_desc_t pd, dnnl::primitive::kind prim_kind, dnnl::prop_kind prop_kind)
Constructs a primitive descriptor base object from a clone of a C API primitive descriptor after veri...
Definition: dnnl.hpp:2916
permuted 5D tensor
Definition: dnnl_types.h:197
rnn_direction
A direction of RNN primitive execution.
Definition: dnnl.hpp:680
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:3676
destination gradient (diff) memory desc
memory::desc dst_layer_desc() const
Returns destination layer memory descriptor.
Definition: dnnl.hpp:8816
vanilla_rnn_forward()=default
Default constructor. Produces an empty object.
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const eltwise_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an elementwise backward propagation primitive.
Definition: dnnl.hpp:5535
Undefined memory format kind, used for empty memory descriptors.
Definition: dnnl_types.h:82
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const vanilla_rnn_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a vanilla RNN backward propagation primitive.
Definition: dnnl.hpp:7672
GRU cell with linear before reset.
memory::desc diff_dst_iter_desc() const
Returns diff destination iteration memory descriptor.
Definition: dnnl.hpp:8859
dnnl_status_t DNNL_API dnnl_vanilla_rnn_backward_desc_init(dnnl_rnn_desc_t *rnn_desc, dnnl_prop_kind_t prop_kind, const dnnl_alg_kind_t activation, const dnnl_rnn_direction_t direction, const dnnl_memory_desc_t *src_layer_desc, const dnnl_memory_desc_t *src_iter_desc, const dnnl_memory_desc_t *weights_layer_desc, const dnnl_memory_desc_t *weights_iter_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_layer_desc, const dnnl_memory_desc_t *dst_iter_desc, const dnnl_memory_desc_t *diff_src_layer_desc, const dnnl_memory_desc_t *diff_src_iter_desc, const dnnl_memory_desc_t *diff_weights_layer_desc, const dnnl_memory_desc_t *diff_weights_iter_desc, const dnnl_memory_desc_t *diff_bias_desc, const dnnl_memory_desc_t *diff_dst_layer_desc, const dnnl_memory_desc_t *diff_dst_iter_desc, unsigned flags, float alpha, float beta)
Initializes a descriptor for vanilla RNN backward propagation primitive.
desc(prop_kind prop_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)
Constructs a descriptor for LBR GRU backward propagation primitive.
Definition: dnnl.hpp:9110
32-bit signed integer.
Definition: dnnl_types.h:72
Bidirectional execution of RNN primitive with summation of the results.
Definition: dnnl_types.h:1433
primitive_desc(const std::vector< float > &scales, const std::vector< memory::desc > &srcs, const engine &engine, const primitive_attr &attr=primitive_attr())
Constructs a primitive descriptor for a sum primitive.
Definition: dnnl.hpp:3288
reorder source engine
dnnl_status_t DNNL_API dnnl_post_ops_get_params_eltwise(const_dnnl_post_ops_t post_ops, int index, float *scale, dnnl_alg_kind_t *alg_kind, float *alpha, float *beta)
Returns the parameters of an elementwise post-up.
An inner product primitive.
primitive_desc()=default
Default constructor. Produces an empty object.
A softmax primitive.
Undefined RNN flags.
memory::desc dst_layer_desc() const
Returns destination layer memory descriptor.
Definition: dnnl.hpp:8013
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:4836
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:5879
Direct convolution.
Definition: dnnl_types.h:714
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:2794
memory::desc diff_weights_layer_desc() const
Returns diff weights layer memory descriptor.
Definition: dnnl.hpp:9243
Just a sentinel, not real memory format tag.
Definition: dnnl_types.h:353
Primitive descriptor for an LRN forward propagation primitive.
Definition: dnnl.hpp:4915
desc(const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_desc)
Constructs a descriptor for an inner product descriptor weights update primitive with bias...
Definition: dnnl.hpp:7018
Descriptor for an LSTM forward propagation primitive.
Definition: dnnl.hpp:7771
5D tensor blocked by 1st dimension with block size 8
Definition: dnnl_types.h:265
memory::desc dst_iter_desc() const
Returns destination iteration memory descriptor.
Definition: dnnl.hpp:8821
An opaque structure to describe a primitive descriptor iterator.
eltwise_forward(const primitive_desc &pd)
Constructs an eltwise forward propagation primitive.
Definition: dnnl.hpp:5458
pooling descriptor
Definition: dnnl_types.h:1972
Convolution algorithm(either direct or Winograd) is chosen just in time.
Definition: dnnl_types.h:718
memory::desc diff_src_layer_desc() const
Returns diff source layer memory descriptor.
Definition: dnnl.hpp:9233
Elementwise: bounded_relu.
Logsoftmax backward propagation primitive.
Definition: dnnl.hpp:5895
An execution engine.
Definition: dnnl.hpp:837
matmul(const primitive_desc &pd)
Constructs a matmul primitive.
Definition: dnnl.hpp:9676
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for an inner product forward propagation primitive.
Definition: dnnl.hpp:6830
dnnl_status_t DNNL_API dnnl_memory_set_data_handle(dnnl_memory_t memory, void *handle)
Sets a memory object&#39;s data handle.
dnnl_status_t DNNL_API dnnl_stream_create(dnnl_stream_t *stream, dnnl_engine_t engine, unsigned flags)
Creates an execution stream for engine and with flags.
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:5987
GRU forward propagation primitive.
Definition: dnnl.hpp:8475
dnnl_status_t DNNL_API dnnl_memory_desc_permute_axes(dnnl_memory_desc_t *out_memory_desc, const dnnl_memory_desc_t *in_memory_desc, const int *permutation)
Initializes a memory descriptor by permuting axes in an existing one.
Primitive descriptor for a layer normalization forward propagation primitive.
Definition: dnnl.hpp:6454
desc(prop_kind prop_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)
Constructs a descriptor for a vanilla RNN backward propagation primitive.
Definition: dnnl.hpp:7599
dnnl_status_t DNNL_API dnnl_primitive_desc_query(const_dnnl_primitive_desc_t primitive_desc, dnnl_query_t what, int index, void *result)
Queries a primitive descriptor for various pieces of information.
convolution_backward_data(const primitive_desc &pd)
Constructs a convolution backward propagation primitive.
Definition: dnnl.hpp:3862
dnnl_status_t DNNL_API dnnl_memory_unmap_data(const_dnnl_memory_t memory, void *mapped_ptr)
Unmaps a memory object and writes back any changes to the previously mapped buffer.
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:3072
const char * impl_info_str() const
Returns implementation name.
Definition: dnnl.hpp:2685
memory::desc weights_layer_desc() const
Returns weights layer memory descriptor.
Definition: dnnl.hpp:9207
void unmap_data(void *mapped_ptr) const
Unmaps the previously mapped data for the memory.
Definition: dnnl.hpp:1995
destination memory desc
memory::desc bias_desc() const
Returns bias memory descriptor.
Definition: dnnl.hpp:8611
Descriptor for an LRN backward propagation primitive.
Definition: dnnl.hpp:4981
Primitive descriptor for an inner product weights gradient primitive.
Definition: dnnl.hpp:7060
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:8622
layer_normalization_forward()=default
Default constructor. Produces an empty object.
dnnl_status_t DNNL_API dnnl_lstm_forward_desc_init_v2(dnnl_rnn_desc_t *rnn_desc, dnnl_prop_kind_t prop_kind, dnnl_rnn_direction_t direction, const dnnl_memory_desc_t *src_layer_desc, const dnnl_memory_desc_t *src_iter_desc, const dnnl_memory_desc_t *src_iter_c_desc, const dnnl_memory_desc_t *weights_layer_desc, const dnnl_memory_desc_t *weights_iter_desc, const dnnl_memory_desc_t *weights_peephole_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_layer_desc, const dnnl_memory_desc_t *dst_iter_desc, const dnnl_memory_desc_t *dst_iter_c_desc, unsigned flags)
Initializes a descriptor for an LSTM (with or without peephole) forward propagation primitive...
An element-wise primitive.
dnnl_status_t DNNL_API dnnl_gru_backward_desc_init(dnnl_rnn_desc_t *rnn_desc, dnnl_prop_kind_t prop_kind, dnnl_rnn_direction_t direction, const dnnl_memory_desc_t *src_layer_desc, const dnnl_memory_desc_t *src_iter_desc, const dnnl_memory_desc_t *weights_layer_desc, const dnnl_memory_desc_t *weights_iter_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_layer_desc, const dnnl_memory_desc_t *dst_iter_desc, const dnnl_memory_desc_t *diff_src_layer_desc, const dnnl_memory_desc_t *diff_src_iter_desc, const dnnl_memory_desc_t *diff_weights_layer_desc, const dnnl_memory_desc_t *diff_weights_iter_desc, const dnnl_memory_desc_t *diff_bias_desc, const dnnl_memory_desc_t *diff_dst_layer_desc, const dnnl_memory_desc_t *diff_dst_iter_desc, unsigned flags)
Initializes a descriptor for GRU backward propagation primitive.
dnnl_status_t DNNL_API dnnl_deconvolution_backward_weights_desc_init(dnnl_deconvolution_desc_t *deconv_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *diff_weights_desc, const dnnl_memory_desc_t *diff_bias_desc, const dnnl_memory_desc_t *diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a deconvolution weights gradient primitive.
memory desc of an execute argument
memory::desc weights_layer_desc() const
Returns weights layer memory descriptor.
Definition: dnnl.hpp:9002
Unidirectional execution of RNN primitive from right to left.
Definition: dnnl_types.h:1427
dnnl_status_t DNNL_API dnnl_primitive_desc_iterator_create(dnnl_primitive_desc_iterator_t *iterator, const_dnnl_op_desc_t op_desc, const_dnnl_primitive_attr_t attr, dnnl_engine_t engine, const_dnnl_primitive_desc_t hint_forward_primitive_desc)
Creates a primitive descriptor iterator.
A deconvolution primitive.
Definition: dnnl_types.h:681
Descriptor for an LRN forward propagation primitive.
Definition: dnnl.hpp:4875
A class that provides the destructor for a DNNL C API handle.
Definition: dnnl.hpp:123
lstm_backward()=default
Default constructor. Produces an empty object.
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:7115
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a convolution forward propagation primitive from a C API primit...
Definition: dnnl.hpp:3664
LSTM backward propagation primitive.
Definition: dnnl.hpp:8041
memory::desc src_iter_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:7178
dnnl_status_t DNNL_API dnnl_post_ops_append_eltwise(dnnl_post_ops_t post_ops, float scale, dnnl_alg_kind_t alg_kind, float alpha, float beta)
Appends an elementwise post-op.
5D tensor blocked by 2nd dimension with block size 8
Definition: dnnl_types.h:284
desc(prop_kind prop_kind, algorithm algorithm, 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)
Constructs a descriptor for a dilated convolution forward propagation primitive with bias...
Definition: dnnl.hpp:3552
8-bit unsigned integer.
Definition: dnnl_types.h:76
A descriptor of a matrix multiplication operation.
Definition: dnnl_types.h:1543
memory::desc diff_weights_desc() const
Returns a diff weights memory descriptor.
Definition: dnnl.hpp:4116
memory::desc mean_desc() const
Returns memory descriptor for mean.
Definition: dnnl.hpp:6514
Alias for dnnl::rnn_direction::unidirectional_left2right.
memory::desc src_desc(int idx=0) const
Returns a source memory descriptor.
Definition: dnnl.hpp:3314
deconvolution_backward_data()=default
Default constructor. Produces an empty object.
permuted 6D tensor
Definition: dnnl_types.h:202
dnnl_status_t DNNL_API dnnl_primitive_attr_get_scales(dnnl_primitive_attr_t attr, int arg, dnnl_dim_t *count, int *mask, const float **scales)
Returns primitive attributes scaling factors correspondence mask and values for a given memory argume...
memory::desc dst_layer_desc() const
Returns destination layer memory descriptor.
Definition: dnnl.hpp:9220
dnnl_status_t DNNL_API dnnl_set_jit_profiling_flags(unsigned flags)
Sets library profiling flags.
dnnl_status_t DNNL_API dnnl_primitive_attr_set_output_scales(dnnl_primitive_attr_t attr, dnnl_dim_t count, int mask, const float *scales)
Sets output scaling factors correspondence mask and values.
number of inputs expected
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:3847
memory::desc diff_bias_desc() const
Returns diff bias memory descriptor.
Definition: dnnl.hpp:7744
void execute(stream stream, memory &src, memory &dst) const
Executes the reorder primitive.
Definition: dnnl.hpp:3104
layer_normalization_forward(const primitive_desc &pd)
Constructs a layer normalization forward propagation primitive.
Definition: dnnl.hpp:6545
#define DNNL_ARG_DIFF_DST_ITER
A special mnemonic for gradient (diff) of RNN input recurrent hidden state vector.
Definition: dnnl_types.h:1846
dnnl_query_t
Primitive descriptor query specification.
Definition: dnnl_types.h:1939
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:6697
Intel(R) Advanced Vector Extensions.
Definition: dnnl_types.h:2085
Intel(R) Advanced Vector Extensions 512 subset for Intel(R) Xeon Phi(TM) Processors 7235...
Definition: dnnl_types.h:2096
Backward data propagation.
Definition: dnnl_types.h:658
Inner product forward propagation primitive.
Definition: dnnl.hpp:6745
Average pooling exclude padding.
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:5324
desc(prop_kind prop_kind, const memory::desc &data_desc, float epsilon, normalization_flags flags)
Constructs a descriptor for layer normalization forward propagation primitive.
Definition: dnnl.hpp:6441
A descriptor of a binary operation.
Definition: dnnl_types.h:1517
dnnl_status_t DNNL_API dnnl_gru_forward_desc_init(dnnl_rnn_desc_t *rnn_desc, dnnl_prop_kind_t prop_kind, dnnl_rnn_direction_t direction, const dnnl_memory_desc_t *src_layer_desc, const dnnl_memory_desc_t *src_iter_desc, const dnnl_memory_desc_t *weights_layer_desc, const dnnl_memory_desc_t *weights_iter_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_layer_desc, const dnnl_memory_desc_t *dst_iter_desc, unsigned flags)
Initializes a descriptor for GRU forward propagation primitive.
memory::desc src_iter_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:7480
source gradient memory desc
Definition: dnnl_types.h:1987
engine get_engine() const
Returns the engine of the primitive descriptor.
Definition: dnnl.hpp:2681
A binary primitive.
Definition: dnnl_types.h:701
Structure containing version information as per Semantic Versioning
Definition: dnnl_types.h:2047
Elementwise unary operation backward propagation primitive.
Definition: dnnl.hpp:5462
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const resampling_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a resampling backward propagation primitive.
Definition: dnnl.hpp:9943
deconvolution_backward_data(const primitive_desc &pd)
Constructs a deconvolution backward propagation primitive.
Definition: dnnl.hpp:4587
void set_rnn_data_qparams(float scale, float shift)
Sets quantization scale and shift parameters for RNN data tensors.
Definition: dnnl.hpp:2626
memory::desc src_layer_desc() const
Returns source layer memory descriptor.
Definition: dnnl.hpp:8366
primitive_desc(int concat_dimension, const std::vector< memory::desc > &srcs, const engine &engine, const primitive_attr &attr=primitive_attr())
Constructs a primitive descriptor for an out-of-place concatenation primitive.
Definition: dnnl.hpp:3185
dnnl_status_t DNNL_API dnnl_primitive_attr_set_zero_points(dnnl_primitive_attr_t attr, int arg, dnnl_dim_t count, int mask, const int32_t *zero_points)
Sets primitive attributes zero points for primitive operations for a given memory argument...
#define DNNL_ARG_DIFF_SRC_ITER
A special mnemonic for gradient (diff) of RNN input recurrent hidden state vector.
Definition: dnnl_types.h:1825
primitive_desc()=default
Default constructor. Produces an empty object.
LSTM cell.
Definition: dnnl_types.h:789
memory::desc diff_bias_desc() const
Returns the diff bias memory descriptor.
Definition: dnnl.hpp:7126
Packed weights format used in RNN.
Definition: dnnl_types.h:93
desc()=default
Default constructor. Produces an empty object.
int DNNL_API dnnl_post_ops_len(const_dnnl_post_ops_t post_ops)
Returns the length of post-ops.
#define DNNL_ARG_DST_ITER
A special mnemonic for RNN input recurrent hidden state vector.
Definition: dnnl_types.h:1766
desc(algorithm algorithm, 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)
Constructs a descriptor for a dilated deconvolution weights gradient primitive with bias...
Definition: dnnl.hpp:4713
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for concat primitive from a C API primitive descriptor which must h...
Definition: dnnl.hpp:3204
desc(prop_kind prop_kind, algorithm algorithm, const std::vector< float > &factors, const memory::desc &src_desc, const memory::desc &dst_desc)
Constructs a descriptor for a resampling forward propagation primitive.
Definition: dnnl.hpp:9774
Descriptor for an elementwise forward propagation primitive.
Definition: dnnl.hpp:5365
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a logsoftmax backward propagation primitive from a C API primit...
Definition: dnnl.hpp:5978
desc(prop_kind prop_kind, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &dst_desc)
Constructs a descriptor for an inner product forward propagation primitive without bias...
Definition: dnnl.hpp:6803
4D tensor blocked by 2nd dimension with block size 16
Definition: dnnl_types.h:230
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:9228
#define DNNL_ARG_SRC_ITER_C
A special mnemonic for RNN input recurrent cell state vector.
Definition: dnnl_types.h:1749
Inner product weights gradient primitive.
Definition: dnnl.hpp:6994
desc(const memory::dims &dims, data_type data_type, format_tag format_tag, bool allow_empty=false)
Constructs a memory descriptor.
Definition: dnnl.hpp:1646
primitive_desc()=default
Default constructor. Produces an empty object.
memory::desc diff_bias_desc() const
Returns the diff bias memory descriptor.
Definition: dnnl.hpp:4847
A reorder primitive.
Definition: dnnl_types.h:671
memory(const desc &md, const engine &engine, void *handle)
Constructs a memory object.
Definition: dnnl.hpp:1883
A pooling primitive.
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:9668
memory::desc bias_desc() const
Returns bias memory descriptor.
Definition: dnnl.hpp:9217
dnnl_status_t DNNL_API dnnl_softmax_forward_desc_init(dnnl_softmax_desc_t *softmax_desc, dnnl_prop_kind_t prop_kind, const dnnl_memory_desc_t *data_desc, int softmax_axis)
Initializes a descriptor for softmax forward propagation primitive.
pooling_forward()=default
Default constructor. Produces an empty object.
A descriptor of a convolution operation.
Definition: dnnl_types.h:1087
dnnl_status_t DNNL_API dnnl_dilated_convolution_backward_weights_desc_init(dnnl_convolution_desc_t *conv_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *diff_weights_desc, const dnnl_memory_desc_t *diff_bias_desc, const dnnl_memory_desc_t *diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a dilated convolution weights gradient primitive.
desc(prop_kind prop_kind, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &bias_desc, const memory::desc &dst_desc)
Constructs a descriptor for an inner product forward propagation primitive with bias.
Definition: dnnl.hpp:6772
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a deconvolution forward propagation primitive.
Definition: dnnl.hpp:4368
memory::desc diff_weights_iter_desc() const
Returns diff weights iteration memory descriptor.
Definition: dnnl.hpp:7262
Descriptor for a resampling backward propagation primitive.
Definition: dnnl.hpp:9853
normalization_flags
Flags for normalization primitives.
Definition: dnnl.hpp:589
matmul()=default
Default constructor. Produces an empty object.
Default order execution.
convolution_forward()=default
Default constructor. Produces an empty object.
status set_verbose(int level)
Configures verbose output to stdout.
Definition: dnnl.hpp:10008
softmax descriptor
Definition: dnnl_types.h:1971
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for an LRN forward propagation primitive from a C API primitive des...
Definition: dnnl.hpp:4954
memory::desc src_iter_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:8800
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a GRU forward propagation primitive from a C API primitive desc...
Definition: dnnl.hpp:8587
dnnl_status_t DNNL_API dnnl_sum_primitive_desc_create(dnnl_primitive_desc_t *sum_primitive_desc, const dnnl_memory_desc_t *dst_desc, int n, const float *scales, const dnnl_memory_desc_t *src_descs, const_dnnl_primitive_attr_t attr, dnnl_engine_t engine)
Creates a primitive descriptor for an (out-of-place) sum primitive.
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const gru_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a GRU backward propagation primitive.
Definition: dnnl.hpp:8777
Elementwise: tanh-based gelu.
softmax_forward(const primitive_desc &pd)
Constructs a softmax forward propagation primitive.
Definition: dnnl.hpp:5674
Intel(R) Advanced Vector Extensions 512 for Intel(R) Xeon(R) Processor Scalable Family and Intel(R) C...
Definition: dnnl_types.h:2100
format_kind
Memory format kind.
Definition: dnnl.hpp:1157
binary(const primitive_desc &pd)
Constructs an elementwise binary operation primitive.
Definition: dnnl.hpp:9551
primitive_desc(const desc &desc, const engine &engine, const primitive_attr &attr=primitive_attr(), bool allow_empty=false)
Constructs a primitive descriptor for a shuffle forward propagation primitive.
Definition: dnnl.hpp:9334
no query
Definition: dnnl_types.h:1940
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:6863
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for an elementwise binary operator primitive.
Definition: dnnl.hpp:9505
dnnl_scratchpad_mode_t
Scratchpad mode.
Definition: dnnl_types.h:1649
Fuse with ReLU.
Definition: dnnl_types.h:853
data_type
Data type specification.
Definition: dnnl.hpp:1139
primitive_desc()=default
Default constructor. Produces an empty object.
memory::desc weights_desc(int idx) const
Returns a weights memory descriptor.
Definition: dnnl.hpp:2756
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:8026
Primitive descriptor for a logsoftmax backward propagation primitive.
Definition: dnnl.hpp:5928
Forward data propagation (training mode).
batch normalization descriptor
Definition: dnnl_types.h:1974
memory::desc weights_layer_desc() const
Returns weights layer memory descriptor.
Definition: dnnl.hpp:8379
The operation failed because requested functionality is not implemented.
primitive_desc()=default
Default constructor. Produces an empty object.
Out-of-place summation (sum) primitive.
Definition: dnnl.hpp:3233
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a deconvolution forward propagation primitive from a C API prim...
Definition: dnnl.hpp:4395
memory::desc weights_peephole_desc() const
Returns weights peephole memory descriptor.
Definition: dnnl.hpp:8005
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:9838
memory::desc weights_layer_desc() const
Returns weights layer memory descriptor.
Definition: dnnl.hpp:8803
memory::desc dst_iter_desc() const
Returns destination iteration memory descriptor.
Definition: dnnl.hpp:9225
runtime estimation (seconds)
Definition: dnnl_types.h:1948
Backward propagation (with respect to all parameters).
Definition: dnnl_types.h:656
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:9964
An unspecified engine.
Definition: dnnl_types.h:1597
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a shuffle forward propagation primitive from a C API primitive ...
Definition: dnnl.hpp:9346
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for sum primitive from a C API primitive descriptor which must have...
Definition: dnnl.hpp:3310
Backward weights propagation.
eltwise_backward()=default
Default constructor. Produces an empty object.
static size_t get_count(kind kind)
Returns the number of engines of a certain kind.
Definition: dnnl.hpp:861
handle()=default
Constructs an empty handle object.
dnnl_status_t DNNL_API dnnl_logsoftmax_backward_desc_init(dnnl_logsoftmax_desc_t *logsoftmax_desc, const dnnl_memory_desc_t *diff_data_desc, const dnnl_memory_desc_t *data_desc, int logsoftmax_axis)
Initializes a descriptor for logsoftmax backward propagation primitive.
memory::desc src_iter_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:8598
gru_forward(const primitive_desc &pd)
Constructs a GRU forward propagation primitive.
Definition: dnnl.hpp:8633
5D tensor blocked by 1st dimension with block size 16
Definition: dnnl_types.h:263
Eltwise: ReLU.
Definition: dnnl_types.h:724
memory::desc diff_weights_desc(int idx) const
Returns a diff weights memory descriptor.
Definition: dnnl.hpp:2783
Descriptor for an LBR GRU forward propagation primitive.
Definition: dnnl.hpp:8876
dnnl_status_t DNNL_API dnnl_concat_primitive_desc_create(dnnl_primitive_desc_t *concat_primitive_desc, const dnnl_memory_desc_t *dst_desc, int n, int concat_dimension, const dnnl_memory_desc_t *src_descs, const_dnnl_primitive_attr_t attr, dnnl_engine_t engine)
Creates a primitive descriptor for an out-of-place concatenation primitive.
GPU engine.
Definition: dnnl_types.h:1601
Local response normalization (LRN) across multiple channels.
dnnl_status_t DNNL_API dnnl_lrn_forward_desc_init(dnnl_lrn_desc_t *lrn_desc, dnnl_prop_kind_t prop_kind, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *data_desc, dnnl_dim_t local_size, float alpha, float beta, float k)
Initializes a descriptor for LRN forward propagation primitive.
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:6975
dnnl_status_t DNNL_API dnnl_shuffle_backward_desc_init(dnnl_shuffle_desc_t *shuffle_desc, const dnnl_memory_desc_t *diff_data_desc, int axis, dnnl_dim_t group_size)
Initializes a descriptor for shuffle backward propagation primitive.
softmax_backward()=default
Default constructor. Produces an empty object.
Batch normalization forward propagation primitive.
Definition: dnnl.hpp:6028
Convolution forward propagation primitive.
Definition: dnnl.hpp:3417
primitive_desc()=default
Default constructor. Produces an empty object.
Primitive descriptor for a deconvolution weights gradient primitive.
Definition: dnnl.hpp:4781
memory::desc mean_desc() const
Returns memory descriptor for mean.
Definition: dnnl.hpp:6313
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:5327
primitive_desc(const desc &desc, const engine &engine, const lstm_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an LSTM backward propagation primitive.
Definition: dnnl.hpp:8329
primitive_desc(const memory::desc &dst, int concat_dimension, const std::vector< memory::desc > &srcs, const engine &engine, const primitive_attr &attr=primitive_attr())
Constructs a primitive descriptor for an out-of-place concatenation primitive.
Definition: dnnl.hpp:3158
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:6305
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for an elementwise forward propagation primitive.
Definition: dnnl.hpp:5429
inner_product_forward(const primitive_desc &pd)
Constructs an inner product forward propagation primitive.
Definition: dnnl.hpp:6881
vanilla_rnn_forward(const primitive_desc &pd)
Constructs a vanilla RNN forward propagation primitive.
Definition: dnnl.hpp:7515
Descriptor for an elementwise backward propagation primitive.
Definition: dnnl.hpp:5464
eltwise_backward(const primitive_desc &pd)
Constructs an eltwise backward propagation primitive.
Definition: dnnl.hpp:5568
void reset_with_clone(const_dnnl_primitive_desc_t pd)
Resets the value of the handle to a clone of a C API primitive descriptor.
Definition: dnnl.hpp:2881
(scratch) memory, additional to all inputs and outputs memory (bytes)
Definition: dnnl_types.h:1954
memory::desc diff_src_iter_desc() const
Returns diff source iteration memory descriptor.
Definition: dnnl.hpp:9238
cl_command_queue get_ocl_command_queue() const
Returns the underlying OpenCL queue object.
Definition: dnnl.hpp:1028
memory::desc scratchpad_desc() const
Returns the scratchpad memory descriptor.
Definition: dnnl.hpp:2839
Elementwise unary operation forward propagation primitive.
Definition: dnnl.hpp:5363
memory::desc weights_iter_desc() const
Returns weights iteration memory descriptor.
Definition: dnnl.hpp:8606
desc(prop_kind prop_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 &weights_peephole_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)
Constructs a descriptor for an LSTM (with or without peephole) forward propagation primitive...
Definition: dnnl.hpp:7835
Local response normalization (LRN) backward propagation primitive.
Definition: dnnl.hpp:4979
memory::desc dst_layer_desc() const
Returns destination layer memory descriptor.
Definition: dnnl.hpp:8397
memory::desc diff_bias_desc() const
Returns diff bias memory descriptor.
Definition: dnnl.hpp:8849
primitive_desc()=default
Default constructor. Produces an empty object.
primitive_desc()=default
Default constructor. Produces an empty object.
primitive_desc(const desc &desc, const engine &engine, const layer_normalization_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a layer normalization backward propagation primitive.
Definition: dnnl.hpp:6654
Eltwise: pow.
Definition: dnnl_types.h:759
memory::desc src_iter_c_desc() const
Returns source recurrent cell state memory descriptor.
Definition: dnnl.hpp:7184
5D tensor blocked by 2nd dimension with block size 4
Definition: dnnl_types.h:274
lstm_forward()=default
Default constructor. Produces an empty object.
memory::desc diff_src_iter_desc() const
Returns diff source iteration memory descriptor.
Definition: dnnl.hpp:8420
permuted 4D tensor
Definition: dnnl_types.h:199
Elementwise: logistic.
An LRN primitive.
lrn descriptor
An opaque structure to describe an engine.
void get_zero_points(int arg, int &mask, std::vector< int32_t > &zero_points) const
Returns zero points correspondence mask and values.
Definition: dnnl.hpp:2525
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:5446
desc(prop_kind prop_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)
Constructs a descriptor for a vanilla RNN forward propagation primitive.
Definition: dnnl.hpp:7403
void append_dw_k3s2p1(memory::data_type weights_data_type, memory::data_type bias_data_type, memory::data_type dst_data_type, int mask, const std::vector< float > &scales)
Appends a depthwise post-op convolution with stride 2.
Definition: dnnl.hpp:2293
desc(prop_kind prop_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)
Constructs a descriptor for a GRU backward propagation primitive.
Definition: dnnl.hpp:8708
desc(algorithm algorithm, const memory::desc &data_desc, const memory::desc &diff_data_desc, memory::dim local_size, float alpha, float beta, float k=1.f)
Constructs a descriptor for an LRN backward propagation primitive.
Definition: dnnl.hpp:5007
desc()=default
Default constructor. Produces an empty object.
Vanilla RNN forward propagation primitive.
Definition: dnnl.hpp:7345
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:4113
resampling_backward(const primitive_desc &pd)
Constructs a resampling backward propagation primitive.
Definition: dnnl.hpp:9973
primitive_desc_base(dnnl_primitive_desc_t pd, dnnl::primitive::kind prim_kind)
Constructs a primitive descriptor base object from a clone of a C API primitive descriptor after veri...
Definition: dnnl.hpp:2901
lrn_forward()=default
Default constructor. Produces an empty object.
primitive_desc()=default
Default constructor. Produces an empty object.
desc(prop_kind prop_kind, const memory::desc &diff_data_desc, const memory::desc &data_desc, float epsilon, normalization_flags flags)
Constructs a descriptor for layer normalization backward propagation primitive.
Definition: dnnl.hpp:6623
#define DNNL_ARG_SRC_ITER
A special mnemonic for RNN input recurrent hidden state vector.
Definition: dnnl_types.h:1743
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:4966
inner_product_backward_weights(const primitive_desc &pd)
Constructs an inner product weights gradient primitive.
Definition: dnnl.hpp:7137
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a resampling backward propagation primitive from a C API primit...
Definition: dnnl.hpp:9956
binary descriptor
Forward data propagation (inference mode).
Definition: dnnl_types.h:650
Undefined RNN flags.
Definition: dnnl_types.h:1419
memory::desc query_md(query what, int idx=0) const
Returns a memory descriptor.
Definition: dnnl.hpp:2718
A sum primitive.
Definition: dnnl_types.h:677
memory::desc variance_desc() const
Returns memory descriptor for variance.
Definition: dnnl.hpp:6717
desc(algorithm algorithm, 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)
Constructs a descriptor for a dilated deconvolution backward propagation primitive.
Definition: dnnl.hpp:4496
DNNL exception class.
Definition: dnnl.hpp:87
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:9432
#define DNNL_ARG_BIAS
Bias tensor argument.
Definition: dnnl_types.h:1799
memory::desc weights_iter_desc() const
Returns weights iteration memory descriptor.
Definition: dnnl.hpp:7703
source memory desc
void get_params_dw_k3s2p1(int index, memory::data_type &weights_data_type, memory::data_type &bias_data_type, memory::data_type &dst_data_type, int &mask, std::vector< float > &scales) const
Returns the parameters of an depthwise post-op with stride 2.
Definition: dnnl.hpp:2319
size_t DNNL_API dnnl_memory_desc_get_size(const dnnl_memory_desc_t *memory_desc)
Returns the size of a memory descriptor.
workspace memory desc
Intel(R) Advanced Vector Extensions 512 subset for Intel(R) Xeon Phi(TM) Processors x200 Series...
Definition: dnnl_types.h:2092
primitive_desc()=default
Default constructor. Produces an empty object.
void set_data_handle(void *handle) const
Sets memory buffer.
Definition: dnnl.hpp:1952
Forward data propagation (inference mode).
A descriptor of a element-wise operation.
Definition: dnnl_types.h:1162
dnnl_status_t DNNL_API dnnl_post_ops_get_params_sum(const_dnnl_post_ops_t post_ops, int index, float *scale)
Returns the parameters of an accumulation (sum) post-op.
A descriptor of a Softmax operation.
Definition: dnnl_types.h:1214
Descriptor for a convolution weights gradient primitive.
Definition: dnnl.hpp:3868
An opaque structure for a chain of post operations.
primitive_desc(const memory &src, const memory &dst, const primitive_attr &attr=primitive_attr())
Constructs a primitive descriptor for reorder primitive.
Definition: dnnl.hpp:3038
A descriptor of an inner product operation.
Definition: dnnl_types.h:1383
Descriptor for a deconvolution weights gradient primitive.
Definition: dnnl.hpp:4593
The operation failed because of incorrect function arguments.
Definition: dnnl_types.h:45
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a resampling forward propagation primitive. ...
Definition: dnnl.hpp:9802
Forward data propagation, alias for dnnl::prop_kind::forward_training.
desc(prop_kind prop_kind, const memory::desc &data_desc, const memory::desc &stat_desc, float epsilon, normalization_flags flags)
Constructs a descriptor for layer normalization forward propagation primitive.
Definition: dnnl.hpp:6397
int len() const
Returns the number of post-ops entries.
Definition: dnnl.hpp:2094
runtime estimation (seconds), unimplemented
resampling_forward(const primitive_desc &pd)
Constructs a resampling forward propagation primitive.
Definition: dnnl.hpp:9847
Undefined algorithm.
desc(prop_kind prop_kind, algorithm algorithm, const std::vector< float > &factors, const memory::desc &src_desc)
Constructs a descriptor for a resampling forward propagation primitive using source memory descriptor...
Definition: dnnl.hpp:9741
Pooling forward propagation primitive.
Definition: dnnl.hpp:5102
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a layer normalization forward propagation primitive.
Definition: dnnl.hpp:6468
softmax descriptor
dnnl_rnn_direction_t
A direction of RNN primitive execution.
Definition: dnnl_types.h:1423
primitive_desc()=default
Default constructor. Produces an empty object.
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:3673
memory::desc src_layer_desc() const
Returns source layer memory descriptor.
Definition: dnnl.hpp:7690
desc(algorithm algorithm, const memory::desc &diff_data_desc, const memory::desc &data_desc, float alpha=0, float beta=0)
Constructs a descriptor for an elementwise backward propagation primitive.
Definition: dnnl.hpp:5485
inner product descriptor
Definition: dnnl_types.h:1976
5D tensor blocked by 2nd dimension with block size 16
Definition: dnnl_types.h:267
6D tensor blocked by 2nd dimension with block size 4
Definition: dnnl_types.h:304
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for an inner product forward propagation primitive from a C API pri...
Definition: dnnl.hpp:6857
batch_normalization_forward(const primitive_desc &pd)
Constructs a batch normalization forward propagation primitive.
Definition: dnnl.hpp:6182
Out-of-order execution.
status gemm_u8s8s32(char transa, char transb, char offsetc, dnnl_dim_t M, dnnl_dim_t N, dnnl_dim_t K, float alpha, const uint8_t *A, dnnl_dim_t lda, uint8_t ao, const int8_t *B, dnnl_dim_t ldb, int8_t bo, float beta, int32_t *C, dnnl_dim_t ldc, const int32_t *co)
Performs integer matrix-matrix multiply on 8-bit unsigned matrix A, 8-bit signed matrix B...
Definition: dnnl.hpp:10078
dnnl_status_t DNNL_API dnnl_memory_get_memory_desc(const_dnnl_memory_t memory, const dnnl_memory_desc_t **memory_desc)
Returns the memory descriptor for a memory object.
dnnl_status_t
Status values returned by the library functions.
Definition: dnnl_types.h:39
memory::desc diff_src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:5321
stream()=default
Constructs an empty stream.
Pooling backward propagation primitive.
Definition: dnnl.hpp:5219
memory::desc dst_iter_c_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:8021
dnnl_status_t DNNL_API dnnl_primitive_create(dnnl_primitive_t *primitive, const_dnnl_primitive_desc_t primitive_desc)
Creates a primitive.
Binary mul.
Definition: dnnl_types.h:803
LRN within a single channel.
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:5206
dnnl_status_t DNNL_API dnnl_post_ops_destroy(dnnl_post_ops_t post_ops)
Destroys post-ops.
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const convolution_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a convolution weights gradient primitive.
Definition: dnnl.hpp:4095
memory::desc bias_desc() const
Returns bias memory descriptor.
Definition: dnnl.hpp:8394
const dnnl_memory_desc_t DNNL_API * dnnl_primitive_desc_query_md(const_dnnl_primitive_desc_t primitive_desc, dnnl_query_t what, int index)
Queries primitive descriptor for a memory descriptor.
memory::desc diff_weights_layer_desc() const
Returns diff weights layer memory descriptor.
Definition: dnnl.hpp:8839
Primitive descriptor for a batch normalization forward propagation primitive.
Definition: dnnl.hpp:6089
memory::desc src_layer_desc() const
Returns source layer memory descriptor.
Definition: dnnl.hpp:7982
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a layer normalization backward propagation primitive from a C A...
Definition: dnnl.hpp:6687
memory::desc weights_iter_desc() const
Returns weights iteration memory descriptor.
Definition: dnnl.hpp:8808
A softmax primitive.
Definition: dnnl_types.h:685
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:5553
memory::desc diff_dst_layer_desc() const
Returns diff destination layer memory descriptor.
Definition: dnnl.hpp:7283
memory::desc weights_peephole_desc() const
Returns weights peephole memory descriptor.
Definition: dnnl.hpp:8389
int64_t dnnl_dim_t
A type to describe tensor dimension.
Definition: dnnl_types.h:897
dnnl_status_t DNNL_API dnnl_primitive_desc_clone(dnnl_primitive_desc_t *primitive_desc, const_dnnl_primitive_desc_t existing_primitive_desc)
Clones a primitive descriptor.
Forward data propagation (alias for dnnl_forward_training).
Definition: dnnl_types.h:654
memory::desc dst_layer_desc() const
Returns destination layer memory descriptor.
Definition: dnnl.hpp:9015
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:9023
stream & wait()
Waits for all primitives executing in the stream to finish.
Definition: dnnl.hpp:1038
primitive kind
Definition: dnnl_types.h:1943
dnnl_status_t DNNL_API dnnl_engine_get_ocl_context(dnnl_engine_t engine, cl_context *context)
Returns the OpenCL context associated with an engine.
matrix multiplication (matmul) descriptor
Definition: dnnl_types.h:1981
shuffle_backward()=default
Default constructor. Produces an empty object.
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:9542
Default stream configuration.
Definition: dnnl_types.h:2014
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:6299
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a batch normalization forward propagation primitive from a C AP...
Definition: dnnl.hpp:6130
Shuffle forward propagation primitive.
Definition: dnnl.hpp:9288
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a softmax forward propagation primitive.
Definition: dnnl.hpp:5629
logsoftmax descriptor
error(dnnl_status_t status, const char *message)
Constructs an instance of an exception class.
Definition: dnnl.hpp:95
LRN within a single channel.
Definition: dnnl_types.h:785
dnnl_status_t DNNL_API dnnl_lstm_backward_desc_init(dnnl_rnn_desc_t *rnn_desc, dnnl_prop_kind_t prop_kind, dnnl_rnn_direction_t direction, const dnnl_memory_desc_t *src_layer_desc, const dnnl_memory_desc_t *src_iter_desc, const dnnl_memory_desc_t *src_iter_c_desc, const dnnl_memory_desc_t *weights_layer_desc, const dnnl_memory_desc_t *weights_iter_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_layer_desc, const dnnl_memory_desc_t *dst_iter_desc, const dnnl_memory_desc_t *dst_iter_c_desc, const dnnl_memory_desc_t *diff_src_layer_desc, const dnnl_memory_desc_t *diff_src_iter_desc, const dnnl_memory_desc_t *diff_src_iter_c_desc, const dnnl_memory_desc_t *diff_weights_layer_desc, const dnnl_memory_desc_t *diff_weights_iter_desc, const dnnl_memory_desc_t *diff_bias_desc, const dnnl_memory_desc_t *diff_dst_layer_desc, const dnnl_memory_desc_t *diff_dst_iter_desc, const dnnl_memory_desc_t *diff_dst_iter_c_desc, unsigned flags)
Initializes a descriptor for an LSTM backward propagation primitive.
dnnl_data_type_t
Data type specification.
Definition: dnnl_types.h:62
post_ops()
Constructs an empty sequence of post-ops.
Definition: dnnl.hpp:2086
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:6502
plain 4D tensor
Definition: dnnl_types.h:180
const_dnnl_primitive_desc_t get_primitive_desc() const
Returns the C API primitive descriptor of the underlying C API primitive.
Definition: dnnl.hpp:369
bool next_impl()
Advances the primitive iterator to the next implementation.
Definition: dnnl.hpp:3380
pooling_backward(const primitive_desc &pd)
Constructs a pooling backward propagation primitive.
Definition: dnnl.hpp:5336
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a vanilla RNN backward propagation primitive from a C API primi...
Definition: dnnl.hpp:7685
memory::desc diff_dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:5772
batch_normalization_forward()=default
Default constructor. Produces an empty object.
plain 6D tensor
Definition: dnnl_types.h:182
Tensor concatenation (concat) primitive.
Definition: dnnl.hpp:3131
desc(algorithm algorithm, const memory::desc &diff_src_desc, const memory::desc &diff_dst_desc)
Constructs a descriptor for a resampling backward propagation primitive using source and destination ...
Definition: dnnl.hpp:9870
Primitive attributes.
Definition: dnnl.hpp:2358
memory::desc src_layer_desc() const
Returns source layer memory descriptor.
Definition: dnnl.hpp:9199
dnnl_status_t DNNL_API dnnl_engine_create(dnnl_engine_t *engine, dnnl_engine_kind_t kind, size_t index)
Creates an engine.
Eltwise: exp (dst for backward)
Definition: dnnl_types.h:773
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:3850
Winograd convolution.
Definition: dnnl_types.h:716
Intel(R) Advanced Vector Extensions 512 for Intel(R) Xeon(R) Processor Scalable Family and Intel(R) C...
primitive_attr(dnnl_primitive_attr_t attr)
Creates primitive attributes from a C API dnnl_primitive_attr_t handle.
Definition: dnnl.hpp:2374
#define DNNL_ARG_DIFF_SRC_ITER_C
A special mnemonic for gradient (diff) of RNN input recurrent cell state vector.
Definition: dnnl_types.h:1831
Vanilla RNN backward propagation primitive.
Definition: dnnl.hpp:7519
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a layer normalization forward propagation primitive from a C AP...
Definition: dnnl.hpp:6495
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:4844
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:5076
desc(prop_kind prop_kind, algorithm algorithm, 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)
Constructs a descriptor for a convolution forward propagation primitive with bias.
Definition: dnnl.hpp:3454
memory::desc dst_layer_desc() const
Returns destination layer memory descriptor.
Definition: dnnl.hpp:7216
Layer normalization backward propagation primitive.
Definition: dnnl.hpp:6549
desc(prop_kind prop_kind, algorithm algorithm, const memory::desc &src_desc, const memory::desc &dst_desc)
Constructs a descriptor for a resampling forward propagation primitive using source and destination m...
Definition: dnnl.hpp:9718
desc(prop_kind prop_kind, const memory::desc &diff_data_desc, const memory::desc &data_desc, float epsilon, normalization_flags flags)
Constructs a batch normalization descriptor for backward propagation.
Definition: dnnl.hpp:6222
dnnl_format_tag_t
Memory format tag specification.
Definition: dnnl_types.h:164
void append_eltwise(float scale, algorithm algorithm, float alpha, float beta)
Appends an elementwise post-op.
Definition: dnnl.hpp:2157
Max pooling.
Definition: dnnl_types.h:775
dnnl_status_t DNNL_API dnnl_memory_get_engine(const_dnnl_memory_t memory, dnnl_engine_t *engine)
Returns the engine of a memory object.
void get_params_eltwise(int index, float &scale, algorithm &algorithm, float &alpha, float &beta) const
Returns parameters of an elementwise post-up.
Definition: dnnl.hpp:2171
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a convolution forward propagation primitive.
Definition: dnnl.hpp:3637
memory::desc bias_desc() const
Returns bias memory descriptor.
Definition: dnnl.hpp:7493
Eltwise: natural logarithm.
Definition: dnnl_types.h:755
memory::desc diff_src_layer_desc() const
Returns diff source layer memory descriptor.
Definition: dnnl.hpp:7724
memory::desc diff_bias_desc() const
Returns the diff bias memory descriptor.
Definition: dnnl.hpp:4127
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for an LSTM forward propagation primitive from a C API primitive de...
Definition: dnnl.hpp:7976
primitive_desc_base(dnnl_primitive_desc_t pd, dnnl::primitive::kind prim_kind, dnnl::prop_kind prop_kind1, dnnl::prop_kind prop_kind2)
Constructs a primitive descriptor base object from a clone of a C API primitive descriptor after veri...
Definition: dnnl.hpp:2933
const char * what() const noexcept override
Returns the explanatory string.
Definition: dnnl.hpp:99
primitive_desc()=default
Default constructor. Produces an empty object.
operation descriptor
dnnl_status_t DNNL_API dnnl_memory_map_data(const_dnnl_memory_t memory, void **mapped_ptr)
Maps a memory object and returns a pointer to a host-side buffer with a copy of its contents...
Unidirectional execution of RNN primitive from left to right.
dnnl_status_t DNNL_API dnnl_inner_product_backward_data_desc_init(dnnl_inner_product_desc_t *ip_desc, const dnnl_memory_desc_t *diff_src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *diff_dst_desc)
Initializes descriptor for inner product backward propagation.
primitive_desc()=default
Default constructor. Produces an empty object.
const dnnl_version_t DNNL_API * dnnl_version()
Returns library version information.
kind
Kinds of engines.
Definition: dnnl.hpp:842
4D CNN activations tensor blocked by channels with block size 4, an alias to dnnl_aBcd4b ...
Definition: dnnl_types.h:475
Base class for all computational primitives.
Definition: dnnl.hpp:273
T get(bool allow_empty=false) const
Returns the underlying C API handle.
Definition: dnnl.hpp:188
Primitive descriptor for a batch normalization backward propagation primitive.
Definition: dnnl.hpp:6236
const version_t * version()
Returns library version information.
Definition: dnnl.hpp:10013
4D tensor blocked by 2nd dimension with block size 8
Definition: dnnl_types.h:248
Out-of-order execution.
Definition: dnnl_types.h:2012
Descriptor for a GRU backward propagation primitive.
Definition: dnnl.hpp:8639
Fuse normalization with ReLU.
Binary min.
Definition: dnnl_types.h:807
pooling_backward()=default
Default constructor. Produces an empty object.
primitive_desc(const desc &desc, const engine &engine, const softmax_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a softmax backward propagation primitive.
Definition: dnnl.hpp:5728
Batch normalization backward propagation primitive.
Definition: dnnl.hpp:6186
status
Status values returned by the library functions.
Definition: dnnl.hpp:9990
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:6508
memory::desc bias_desc() const
Returns the bias memory descriptor.
Definition: dnnl.hpp:4410
Primitive descriptor for a logsoftmax forward propagation primitive.
Definition: dnnl.hpp:5828
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:3853
Default stream configuration.
permuted 3D tensor
Definition: dnnl_types.h:187
primitive_desc()=default
Default constructor. Produces an empty object.
5D CNN activations tensor blocked by channels with block size 4, an alias to dnnl_aBcde4b ...
Definition: dnnl_types.h:466
layer_normalization_backward()=default
Default constructor. Produces an empty object.
Average pooling (alias for dnnl_pooling_avg_exclude_padding)
Definition: dnnl_types.h:781
Descriptor for a batch normalization forward propagation primitive.
Definition: dnnl.hpp:6030
Primitive descriptor for an LRN backward propagation primitive.
Definition: dnnl.hpp:5020
Descriptor for an elementwise binary operator primitive.
Definition: dnnl.hpp:9460
memory::desc weights_iter_desc() const
Returns weights iteration memory descriptor.
Definition: dnnl.hpp:7196
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for an LSTM forward propagation primitive.
Definition: dnnl.hpp:7950
#define DNNL_ARG_DIFF_BIAS
Gradient (diff) of the bias tensor argument.
Definition: dnnl_types.h:1879
memory::desc diff_src_layer_desc() const
Returns diff source layer memory descriptor.
Definition: dnnl.hpp:8829
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:6700
3D tensor blocked by 2nd dimension with block size 8
Definition: dnnl_types.h:221
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const inner_product_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an inner product backward propagation primitive.
Definition: dnnl.hpp:6957
Binary add.
Definition: dnnl_types.h:801
memory::desc dst_iter_c_desc() const
Returns destination recurrent cell state memory descriptor.
Definition: dnnl.hpp:7230
deconvolution descriptor
Definition: dnnl_types.h:1968
A pooling primitive.
Definition: dnnl_types.h:687
#define DNNL_ARG_WEIGHTS_PEEPHOLE
A special mnemonic for RNN weights applied to the peephole weights.
Definition: dnnl_types.h:1796
desc(prop_kind prop_kind, algorithm algorithm, 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)
Constructs a descriptor for a dilated convolution forward propagation primitive without bias...
Definition: dnnl.hpp:3602
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a GRU backward propagation primitive from a C API primitive des...
Definition: dnnl.hpp:8790
rnn descriptor
Definition: dnnl_types.h:1977
void set_scales(int arg, int mask, const std::vector< float > &scales)
Sets scaling factors for primitive operations for a given memory argument.
Definition: dnnl.hpp:2508
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:6978
memory consumption (bytes)
LSTM forward propagation primitive.
Definition: dnnl.hpp:7769
memory::data_type data_type() const
Returns the data type of the memory descriptor.
Definition: dnnl.hpp:1828
dnnl_status_t DNNL_API dnnl_pooling_forward_desc_init(dnnl_pooling_desc_t *pool_desc, dnnl_prop_kind_t prop_kind, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *dst_desc, const dnnl_dims_t strides, const dnnl_dims_t kernel, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for pooling forward propagation primitive.
Eltwise: logistic.
Definition: dnnl_types.h:742
status sgemm(char transa, char transb, dnnl_dim_t M, dnnl_dim_t N, dnnl_dim_t K, float alpha, const float *A, dnnl_dim_t lda, const float *B, dnnl_dim_t ldb, float beta, float *C, dnnl_dim_t ldc)
Performs single-precision matrix-matrix multiply.
Definition: dnnl.hpp:10070
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:6703
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:3075
desc(prop_kind prop_kind, algorithm algorithm, 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)
Constructs a descriptor for a dilated deconvolution forward propagation primitive without bias...
Definition: dnnl.hpp:4333
In-order execution.
resampling_backward()=default
Default constructor. Produces an empty object.
A descriptor of a shuffle operation.
Definition: dnnl_types.h:1140
dnnl_status_t DNNL_API dnnl_reorder_primitive_desc_create(dnnl_primitive_desc_t *reorder_primitive_desc, const dnnl_memory_desc_t *src_desc, dnnl_engine_t src_engine, const dnnl_memory_desc_t *dst_desc, dnnl_engine_t dst_engine, const_dnnl_primitive_attr_t attr)
Creates a primitive descriptor for a reorder primitive.
resampling_forward()=default
Default constructor. Produces an empty object.
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:9961
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a LBR GRU forward propagation primitive.
Definition: dnnl.hpp:8961
Elementwise: exponent.
desc(prop_kind prop_kind, const memory::desc &data_desc, float epsilon, normalization_flags flags)
Constructs a batch normalization descriptor for forward propagation.
Definition: dnnl.hpp:6076
Intel(R) Advanced Vector Extensions 512 with Intel(R) DL Boost and Bfloat16 Support for Intel(R) Xeon...
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:3317
Eltwise: hyperbolic tangent non-linearity (tanh) (dst for backward)
Definition: dnnl_types.h:765
dnnl_status_t DNNL_API dnnl_lbr_gru_backward_desc_init(dnnl_rnn_desc_t *rnn_desc, dnnl_prop_kind_t prop_kind, dnnl_rnn_direction_t direction, const dnnl_memory_desc_t *src_layer_desc, const dnnl_memory_desc_t *src_iter_desc, const dnnl_memory_desc_t *weights_layer_desc, const dnnl_memory_desc_t *weights_iter_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_layer_desc, const dnnl_memory_desc_t *dst_iter_desc, const dnnl_memory_desc_t *diff_src_layer_desc, const dnnl_memory_desc_t *diff_src_iter_desc, const dnnl_memory_desc_t *diff_weights_layer_desc, const dnnl_memory_desc_t *diff_weights_iter_desc, const dnnl_memory_desc_t *diff_bias_desc, const dnnl_memory_desc_t *diff_dst_layer_desc, const dnnl_memory_desc_t *diff_dst_iter_desc, unsigned flags)
Initializes a descriptor for LBR GRU backward propagation primitive.
dnnl_status_t DNNL_API dnnl_shuffle_forward_desc_init(dnnl_shuffle_desc_t *shuffle_desc, dnnl_prop_kind_t prop_kind, const dnnl_memory_desc_t *data_desc, int axis, dnnl_dim_t group_size)
Initializes a descriptor for shuffle forward propagation primitive.
dnnl_status_t DNNL_API dnnl_memory_desc_reshape(dnnl_memory_desc_t *out_memory_desc, const dnnl_memory_desc_t *in_memory_desc, int ndims, const dnnl_dims_t dims)
Initializes a memory descriptor by reshaping an existing one.
convolution descriptor
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:4572
lbr_gru_forward(const primitive_desc &pd)
Constructs an LBR GRU forward propagation primitive.
Definition: dnnl.hpp:9034
Winograd deconvolution.
Definition: dnnl_types.h:722
dnnl_status_t DNNL_API dnnl_set_max_cpu_isa(dnnl_cpu_isa_t isa)
Sets the maximal ISA DNNL can dispatch to on the CPU.
memory::desc bias_desc() const
Returns the bias memory descriptor.
Definition: dnnl.hpp:9663
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:6511
dnnl_status_t DNNL_API dnnl_memory_desc_init_by_tag(dnnl_memory_desc_t *memory_desc, int ndims, const dnnl_dims_t dims, dnnl_data_type_t data_type, dnnl_format_tag_t tag)
Initializes a memory descriptor using dimensions and memory format tag.
memory::desc bias_desc() const
Returns bias memory descriptor.
Definition: dnnl.hpp:8813
primitive_desc()=default
Default constructor. Produces an empty object.
Primitive descriptor for an LBR GRU backward propagation primitive.
Definition: dnnl.hpp:9144
layer_normalization_backward(const primitive_desc &pd)
Constructs a layer normalization backward propagation primitive.
Definition: dnnl.hpp:6731
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for an inner product weights update primitive from a C API primitiv...
Definition: dnnl.hpp:7110
dnnl_status_t DNNL_API dnnl_eltwise_forward_desc_init(dnnl_eltwise_desc_t *eltwise_desc, dnnl_prop_kind_t prop_kind, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *data_desc, float alpha, float beta)
Initializes a descriptor for eltwise forward propagation primitive.
dnnl_dim_t dim
Integer type for representing dimension sizes and indices.
Definition: dnnl.hpp:1121
memory::desc weights_layer_desc() const
Returns weights layer memory descriptor.
Definition: dnnl.hpp:7698
reorder()=default
Default constructor. Produces an empty object.
Convolution backward propagation primitive.
Definition: dnnl.hpp:3695
number of outputs expected
Definition: dnnl_types.h:1946
primitive_desc(const desc &desc, const engine &engine, const lbr_gru_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an LBR GRU backward propagation primitive.
Definition: dnnl.hpp:9161
Primitive descriptor for a deconvolution forward propagation primitive.
Definition: dnnl.hpp:4354
memory::desc diff_src_iter_c_desc() const
Returns diff source recurrent cell state memory descriptor.
Definition: dnnl.hpp:7250
reorder(const primitive_desc &pd)
Constructs a reorder primitive.
Definition: dnnl.hpp:3083
desc(prop_kind prop_kind, algorithm algorithm, 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)
Constructs a descriptor for a dilated deconvolution forward propagation primitive with bias...
Definition: dnnl.hpp:4284
memory::desc bias_desc() const
Returns the bias memory descriptor.
Definition: dnnl.hpp:6872
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const inner_product_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an inner product weights update primitive.
Definition: dnnl.hpp:7097
Descriptor for a matmul primitive.
Definition: dnnl.hpp:9569
#define DNNL_MAX_NDIMS
Maximum number of dimensions a tensor can have.
Definition: dnnl_types.h:865
engine get_dst_engine() const
Returns the engine on which the destination memory is allocated.
Definition: dnnl.hpp:3067
lbr_gru_backward(const primitive_desc &pd)
Constructs an LBR GRU backward propagation primitive.
Definition: dnnl.hpp:9274
gru_backward()=default
Default constructor. Produces an empty object.
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a matmul primitive.
Definition: dnnl.hpp:9642
memory::desc bias_desc() const
Returns bias memory descriptor.
Definition: dnnl.hpp:7708
Primitive descriptor for a vanilla RNN forward propagation primitive.
Definition: dnnl.hpp:7428
Elementwise: x*sigmoid(a*x)
plain 1D tensor
Definition: dnnl_types.h:177
The user manages the scratchpad allocation by querying and providing the scratchpad memory to primiti...
memory::desc dst_iter_desc() const
Returns destination iteration memory descriptor.
Definition: dnnl.hpp:7716
Softmax forward propagation primitive.
Definition: dnnl.hpp:5582
primitive_desc()=default
Default constructor. Produces an empty object.
Bidirectional execution of RNN primitive with concatenation of the results.
Definition: dnnl_types.h:1430
permuted 2D tensor
Definition: dnnl_types.h:192
permuted 5D tensor
Definition: dnnl_types.h:201
A layer normalization primitive.
dnnl_status_t DNNL_API dnnl_primitive_get_primitive_desc(const_dnnl_primitive_t primitive, const_dnnl_primitive_desc_t *primitive_desc)
Retrieves a constant reference to the primitive descriptor of a given primitive.
Descriptor for a deconvolution backward propagation primitive.
Definition: dnnl.hpp:4425
memory::desc diff_dst_layer_desc() const
Returns diff destination layer memory descriptor.
Definition: dnnl.hpp:9258
engine(kind kind, size_t index)
Constructs an engine.
Definition: dnnl.hpp:870
desc(algorithm algorithm, 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)
Constructs a descriptor for a convolution weights gradient primitive with bias.
Definition: dnnl.hpp:3900
permuted 6D tensor
Definition: dnnl_types.h:189
memory::desc dst_iter_desc() const
Returns destination iteration memory descriptor.
Definition: dnnl.hpp:7224
int DNNL_API dnnl_memory_desc_equal(const dnnl_memory_desc_t *lhs, const dnnl_memory_desc_t *rhs)
Compares two memory descriptors.
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:7719
memory::desc src1_desc() const
Returns the memory descriptor for source #1.
Definition: dnnl.hpp:9539
desc()=default
Default constructor. Produces an empty object.
memory::desc diff_src_iter_c_desc() const
Returns diff source recurrent cell state memory descriptor.
Definition: dnnl.hpp:8425
void get_scales(int arg, int &mask, std::vector< float > &scales) const
Returns scaling factors correspondence mask and values for a given memory argument.
Definition: dnnl.hpp:2478
memory::desc src_desc(int idx=0) const
Returns a source memory descriptor.
Definition: dnnl.hpp:3208
dnnl::primitive::kind get_kind() const
Returns the kind of the primitive descriptor.
Definition: dnnl.hpp:2869
5D CNN activations tensor blocked by channels with block size 8, an alias to dnnl_aBcde8b ...
Definition: dnnl_types.h:469
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a softmax backward propagation primitive from a C API primitive...
Definition: dnnl.hpp:5761
propagation kind
Definition: dnnl_types.h:1962
Descriptor for a GRU forward propagation primitive.
Definition: dnnl.hpp:8477
inner_product_forward()=default
Default constructor. Produces an empty object.
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a vanilla RNN forward propagation primitive.
Definition: dnnl.hpp:7442
cpu_isa
CPU instruction set flags.
Definition: dnnl.hpp:10033
desc(prop_kind prop_kind, algorithm algorithm, 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)
Constructs a descriptor for a deconvolution forward propagation primitive without bias...
Definition: dnnl.hpp:4234
An inner product primitive.
Definition: dnnl_types.h:695
desc(const memory::dims &dims, data_type data_type, const memory::dims &strides, bool allow_empty=false)
Constructs a memory descriptor by strides.
Definition: dnnl.hpp:1673
Use global statistics.
Definition: dnnl_types.h:827
shuffle descriptor
Primitive descriptor for an elementwise binary operator primitive.
Definition: dnnl.hpp:9492
eltwise descriptor
dnnl_status_t DNNL_API dnnl_post_ops_append_dw_k3s1p1(dnnl_post_ops_t post_ops, dnnl_data_type_t weights_data_type, dnnl_data_type_t bias_data_type, dnnl_data_type_t dst_data_type, dnnl_dim_t count, int mask, const float *scales)
Appends a depthwise post-op convolution with stride 1.
Primitive descriptor for a GRU backward propagation primitive.
Definition: dnnl.hpp:8742
memory::desc diff_dst_iter_desc() const
Returns diff destination iteration memory descriptor.
Definition: dnnl.hpp:9263
engine get_engine() const
Returns the associated engine.
Definition: dnnl.hpp:1909
GRU cell.
Definition: dnnl_types.h:791
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:6869
memory::desc variance_desc() const
Returns memory descriptor for variance.
Definition: dnnl.hpp:6517
The operation was successful.
Definition: dnnl_types.h:41
memory::desc weights_layer_desc() const
Returns weights layer memory descriptor.
Definition: dnnl.hpp:8601
Undefined propagation kind.
desc(algorithm algorithm, const std::vector< float > &factors, const memory::desc &diff_src_desc, const memory::desc &diff_dst_desc)
Constructs a descriptor for resampling backward propagation primitive.
Definition: dnnl.hpp:9893
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a deconvolution backward propagation primitive from a C API pri...
Definition: dnnl.hpp:4567
deconvolution_forward()=default
Default constructor. Produces an empty object.
static void validate_dims(const std::vector< T > &v, int min_size=0)
Helper function that validates that an std::vector of dimensions can be safely converted to the C API...
Definition: dnnl.hpp:1133
primitive_desc()=default
Default constructor. Produces an empty object.
dnnl_status_t DNNL_API dnnl_post_ops_append_dw_k3s2p1(dnnl_post_ops_t post_ops, dnnl_data_type_t weights_data_type, dnnl_data_type_t bias_data_type, dnnl_data_type_t dst_data_type, dnnl_dim_t count, int mask, const float *scales)
Appends a depthwise post-op convolution with stride 2.
memory::desc diff_dst_iter_desc() const
Returns diff destination iteration memory descriptor.
Definition: dnnl.hpp:7291
kind get_kind() const
Returns the kind of the primitive.
Definition: dnnl.hpp:376
Elementwise: hyperbolic tangent non-linearity (tanh)
A descriptor of a Layer Normalization operation.
Definition: dnnl_types.h:1346
Undefined primitive.
8-bit signed integer.
Definition: dnnl_types.h:74
Primitive descriptor for an elementwise forward propagation primitive.
Definition: dnnl.hpp:5399
convolution descriptor
Definition: dnnl_types.h:1967
concat()=default
Default constructor. Produces an empty object.
RNN cell.
Definition: dnnl_types.h:787
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:2806
Alias for dnnl_unidirectional_left2right.
Definition: dnnl_types.h:1435
A (out-of-place) concat primitive.
Definition: dnnl_types.h:675
handle(T t, bool weak=false)
Constructs a handle wrapper object from a C API handle.
Definition: dnnl.hpp:172
convolution_backward_data()=default
Default constructor. Produces an empty object.
dnnl_status_t DNNL_API dnnl_convolution_forward_desc_init(dnnl_convolution_desc_t *conv_desc, dnnl_prop_kind_t prop_kind, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_desc, const dnnl_dims_t strides, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a convolution forward propagation primitive.
desc()=default
Default constructor. Produces an empty object.
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for an elementwise binary operator primitive.
Definition: dnnl.hpp:9520
dnnl_status_t DNNL_API dnnl_set_jit_profiling_jitdumpdir(const char *dir)
Sets JIT dump output path.
desc(algorithm algorithm, 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)
Constructs a descriptor for a convolution weights gradient primitive without bias.
Definition: dnnl.hpp:3944
dnnl_status_t DNNL_API dnnl_primitive_destroy(dnnl_primitive_t primitive)
Destroys a primitive.
Intel(R) Advanced Vector Extensions 512 with Intel(R) DL Boost Support for Intel(R) Xeon(R) Processor...
Definition: dnnl_types.h:2105
Undefined memory format tag.
Definition: dnnl_types.h:166
A shuffle primitive.
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a resampling forward propagation primitive from a C API primiti...
Definition: dnnl.hpp:9829
#define DNNL_ARG_DIFF_SRC_LAYER
A special mnemonic for gradient (diff) of RNN input vector.
Definition: dnnl_types.h:1819
The operation failed because of incorrect function arguments.
dnnl_status_t DNNL_API dnnl_dilated_convolution_backward_data_desc_init(dnnl_convolution_desc_t *conv_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *diff_src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a dilated convolution backward propagation primitive.
dnnl_status_t DNNL_API dnnl_deconvolution_forward_desc_init(dnnl_deconvolution_desc_t *deconv_desc, dnnl_prop_kind_t prop_kind, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_desc, const dnnl_dims_t strides, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a deconvolution forward propagation primitive.
dnnl_status_t DNNL_API dnnl_post_ops_append_sum(dnnl_post_ops_t post_ops, float scale)
Appends an accumulation (sum) to post-ops.
permuted 5D tensor
Definition: dnnl_types.h:188
resampling descriptor
Eltwise: square root.
Definition: dnnl_types.h:734
dnnl_status_t DNNL_API dnnl_primitive_attr_get_output_scales(const_dnnl_primitive_attr_t attr, dnnl_dim_t *count, int *mask, const float **scales)
Returns primitive attributes output scaling factors correspondence mask and values.
stream(const engine &engine, flags flags=flags::default_flags)
Constructs a stream for the specified engine and with behavior controlled by the specified flags...
Definition: dnnl.hpp:1006
primitive_desc()=default
Default constructor. Produces an empty object.
lstm_backward(const primitive_desc &pd)
Constructs an LSTM backward propagation primitive.
Definition: dnnl.hpp:8471
inner product descriptor
primitive_desc()=default
Default constructor. Produces an empty object.
desc(prop_kind prop_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)
Constructs a descriptor for a GRU forward propagation primitive.
Definition: dnnl.hpp:8525
desc(algorithm algorithm, 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)
Constructs a descriptor for dilated convolution backward propagation primitive.
Definition: dnnl.hpp:3771
Primitive descriptor for resampling backward propagation primitive.
Definition: dnnl.hpp:9906
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a deconvolution forward propagation primitive.
Definition: dnnl.hpp:4384
void set_output_scales(int mask, const std::vector< float > &scales)
Sets output scaling factors correspondence mask and values.
Definition: dnnl.hpp:2460
dnnl_status_t DNNL_API dnnl_binary_desc_init(dnnl_binary_desc_t *binary_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *src0_desc, const dnnl_memory_desc_t *src1_desc, const dnnl_memory_desc_t *dst_desc)
Initializes a descriptor for a binary primitive.
memory::desc dst_desc(int idx) const
Returns a destination memory descriptor.
Definition: dnnl.hpp:2747
Primitive descriptor for an LSTM forward propagation primitive.
Definition: dnnl.hpp:7937
static void wrap_c_api(dnnl_status_t status, const char *message)
A convenience function for wrapping calls to C API functions.
Definition: dnnl.hpp:106
Intel(R) Advanced Vector Extensions.
lrn_forward(const primitive_desc &pd)
Constructs an LRN forward propagation primitive.
Definition: dnnl.hpp:4975
desc(const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &dst_desc)
Constructs a descriptor for a matmul primitive.
Definition: dnnl.hpp:9584
convolution_forward(const primitive_desc &pd)
Constructs a convolution forward propagation primitive.
Definition: dnnl.hpp:3691
rnn descriptor
permuted 3D tensor
Definition: dnnl_types.h:195
dnnl_status_t DNNL_API dnnl_set_jit_dump(int enable)
Configures dumping of JIT-generated code.
Primitive or engine failed on execution.
A logsoftmax primitive.
GRU backward propagation primitive.
Definition: dnnl.hpp:8637
Inner product backward propagation primitive.
Definition: dnnl.hpp:6885
dnnl_status_t DNNL_API dnnl_deconvolution_backward_data_desc_init(dnnl_deconvolution_desc_t *deconv_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *diff_src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a deconvolution backward propagation primitive.
Backward bias propagation.
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a matmul primitive.
Definition: dnnl.hpp:9628
LBR GRU forward propagation primitive.
Definition: dnnl.hpp:8874
rnn_primitive_desc_base()=default
Default constructor. Produces an empty object.
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:6722
source memory desc
Definition: dnnl_types.h:1986
A base class for descriptors of all primitives that have an operation descriptor and that support ite...
Definition: dnnl.hpp:3335
#define DNNL_ARG_DIFF_DST_LAYER
A special mnemonic for gradient (diff) of RNN output vector.
Definition: dnnl_types.h:1840
Eltwise: swish.
Definition: dnnl_types.h:753
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:4578
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:9435
engine get_src_engine() const
Returns the engine on which the source memory is allocated.
Definition: dnnl.hpp:3061
desc()=default
Default constructor. Produces an empty object.
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:2800
desc(const memory::desc &diff_data_desc, int axis, int group_size)
Constructs a descriptor for a shuffle backward propagation primitive.
Definition: dnnl.hpp:9387
#define DNNL_ARG_TO
A special mnemonic for reorder destination argument.
Definition: dnnl_types.h:1758
pooling_forward(const primitive_desc &pd)
Constructs a pooling forward propagation primitive.
Definition: dnnl.hpp:5215
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a layer normalization forward propagation primitive.
Definition: dnnl.hpp:6484
status set_jit_profiling_flags(unsigned flags)
Sets library profiling flags.
Definition: dnnl.hpp:10023
dnnl_status_t DNNL_API dnnl_stream_wait(dnnl_stream_t stream)
Waits for all primitives in the execution stream to finish computations.
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a LBR GRU backward propagation primitive from a C API primitive...
Definition: dnnl.hpp:9194
dnnl_primitive_kind_t DNNL_API dnnl_post_ops_get_kind(const_dnnl_post_ops_t post_ops, int index)
Returns the kind of a post-op entry.
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:5200
desc(algorithm algorithm, 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)
Constructs a descriptor for a deconvolution backward propagation primitive.
Definition: dnnl.hpp:4453
dnnl_status_t DNNL_API dnnl_batch_normalization_backward_desc_init(dnnl_batch_normalization_desc_t *bnrm_desc, dnnl_prop_kind_t prop_kind, const dnnl_memory_desc_t *diff_data_desc, const dnnl_memory_desc_t *data_desc, float epsilon, unsigned flags)
Initializes a descriptor for a batch normalization backward propagation primitive.
dnnl_status_t DNNL_API dnnl_primitive_attr_set_scales(dnnl_primitive_attr_t attr, int arg, dnnl_dim_t count, int mask, const float *scales)
Sets primitive attributes scaling factors for primitive operations for a given memory argument...
memory::desc diff_bias_desc() const
Returns diff bias memory descriptor.
Definition: dnnl.hpp:8445
Memory descriptor.
Definition: dnnl_types.h:1003
dnnl_status_t DNNL_API dnnl_engine_get_ocl_device(dnnl_engine_t engine, cl_device_id *device)
Returns the OpenCL device associated with an engine.
Elementwise binary operator primitive.
Definition: dnnl.hpp:9458
dnnl_data_type_t data_type
Data type of the tensor elements.
Definition: dnnl_types.h:1023
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for an LSTM backward propagation primitive from a C API primitive d...
Definition: dnnl.hpp:8361
primitive_desc()=default
Default constructor. Produces an empty object.
desc(algorithm algorithm, const memory::desc &src0, const memory::desc &src1, const memory::desc &dst)
Constructs a descriptor for an elementwise binary operator primitive.
Definition: dnnl.hpp:9481
memory::desc mean_desc() const
Returns memory descriptor for mean.
Definition: dnnl.hpp:6714
A matrix multiplication primitive.
Definition: dnnl_types.h:705
Queried element is not required for given primitive.
Definition: dnnl_types.h:53
The library manages the scratchpad allocation according to the policy specified by the DNNL_ENABLE_CO...
void get_params_sum(int index, float &scale) const
Returns the parameters of an accumulation (sum) post-op.
Definition: dnnl.hpp:2137
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:5665
dnnl_status_t DNNL_API dnnl_layer_normalization_forward_desc_init(dnnl_layer_normalization_desc_t *lnrm_desc, dnnl_prop_kind_t prop_kind, const dnnl_memory_desc_t *data_desc, const dnnl_memory_desc_t *stat_desc, float epsilon, unsigned flags)
Initializes a descriptor for layer normalization forward propagation primitive.
Descriptor for a softmax backward propagation primitive.
Definition: dnnl.hpp:5680
primitive_attr get_primitive_attr() const
Returns the primitive attributes.
Definition: dnnl.hpp:2857
Eltwise: erf-based gelu.
Definition: dnnl_types.h:761
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:3211
dnnl_status_t DNNL_API dnnl_engine_destroy(dnnl_engine_t engine)
Destroys an engine.
The operation failed due to an out-of-memory condition.
Definition: dnnl_types.h:43
Deconvolution backward propagation primitive.
Definition: dnnl.hpp:4423
handle< T, traits > & operator=(const handle< T, traits > &)=default
Assignment operator.
Primitive descriptor for a reorder primitive.
Definition: dnnl.hpp:2997
Backward weights propagation.
Definition: dnnl_types.h:660
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a softmax forward propagation primitive.
Definition: dnnl.hpp:5645
layer normalization descriptor
void append_sum(float scale=1.)
Appends an accumulation (sum) post-op.
Definition: dnnl.hpp:2128
Queried element is not required for given primitive.
primitive_desc()=default
Default constructor. Produces an empty object.
Primitive descriptor for a convolution forward propagation primitive.
Definition: dnnl.hpp:3623
Default order execution.
Definition: dnnl_types.h:2008
memory::desc diff_dst_iter_c_desc() const
Returns diff destination recurrent cell state memory descriptor.
Definition: dnnl.hpp:8460
#define DNNL_ARG_DIFF_DST_ITER_C
A special mnemonic for gradient (diff) of RNN input recurrent cell state vector.
Definition: dnnl_types.h:1852
memory::desc diff_weights_layer_desc() const
Returns diff weights layer memory descriptor.
Definition: dnnl.hpp:7734
workspace memory desc
Definition: dnnl_types.h:1992
primitive_desc(const desc &desc, const engine &engine, const inner_product_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an inner product weights update primitive.
Definition: dnnl.hpp:7077
weights gradient (diff) memory desc
inner_product_backward_weights()=default
Default constructor. Produces an empty object.
dnnl_status_t DNNL_API dnnl_softmax_backward_desc_init(dnnl_softmax_desc_t *softmax_desc, const dnnl_memory_desc_t *diff_data_desc, const dnnl_memory_desc_t *data_desc, int softmax_axis)
Initializes a descriptor for softmax backward propagation primitive.
primitive_desc(const engine &src_engine, const memory::desc &src_md, const engine &dst_engine, const memory::desc &dst_md, const primitive_attr &attr=primitive_attr())
Constructs a primitive descriptor for reorder primitive.
Definition: dnnl.hpp:3018
Memory object.
Definition: dnnl.hpp:1119
convolution_backward_weights(const primitive_desc &pd)
Constructs a convolution weights gradient primitive.
Definition: dnnl.hpp:4138
dnnl_status_t DNNL_API dnnl_primitive_execute(const_dnnl_primitive_t primitive, dnnl_stream_t stream, int nargs, const dnnl_exec_arg_t *args)
Executes a primitive.
memory::desc src_layer_desc() const
Returns source layer memory descriptor.
Definition: dnnl.hpp:7475
Descriptor for a pooling backward propagation primitive.
Definition: dnnl.hpp:5221
primitive_desc()=default
Default constructor. Produces an empty object.
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:6143
memory::desc diff_weights_iter_desc() const
Returns diff weights iteration memory descriptor.
Definition: dnnl.hpp:9248
dnnl_status_t DNNL_API dnnl_sgemm(char transa, char transb, dnnl_dim_t M, dnnl_dim_t N, dnnl_dim_t K, float alpha, const float *A, dnnl_dim_t lda, const float *B, dnnl_dim_t ldb, float beta, float *C, dnnl_dim_t ldc)
Performs single-precision matrix-matrix multiply.
memory::desc weights_layer_desc() const
Returns weights layer memory descriptor.
Definition: dnnl.hpp:7995
Elementwise: exponent (dst for backward)
eltwise descriptor
Definition: dnnl_types.h:1970
number of inputs expected
Definition: dnnl_types.h:1945
shuffle descriptor
Definition: dnnl_types.h:1969
Average pooling include padding.
Definition: dnnl_types.h:777
memory::desc bias_desc() const
Returns bias memory descriptor.
Definition: dnnl.hpp:8010
Linear (Bilinear, Trilinear) resampling method.
Weights format used in 8bit Winograd convolution.
Definition: dnnl_types.h:91
logsoftmax_backward()=default
Default constructor. Produces an empty object.
primitive_desc()=default
Default constructor. Produces an empty object.
memory::desc variance_desc() const
Returns memory descriptor for variance.
Definition: dnnl.hpp:6316
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:5079
memory::desc src_layer_desc() const
Returns source layer memory descriptor.
Definition: dnnl.hpp:7170
dnnl_status_t DNNL_API dnnl_primitive_attr_set_rnn_weights_qparams(dnnl_primitive_attr_t attr, dnnl_dim_t count, int mask, const float *scales)
Sets quantization scaling factors for RNN weights tensors.
desc(const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &bias_desc, const memory::desc &dst_desc)
Constructs a descriptor for a matmul primitive.
Definition: dnnl.hpp:9606
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const convolution_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a convolution backward propagation primitive.
Definition: dnnl.hpp:3829
32-bit/single-precision floating point.
Definition: dnnl_types.h:70
memory::desc dst_layer_desc() const
Returns destination layer memory descriptor.
Definition: dnnl.hpp:8614
desc(prop_kind prop_kind, algorithm algorithm, const memory::desc &data_desc, float alpha=0, float beta=0)
Constructs a descriptor for an elementwise forward propagation primitive.
Definition: dnnl.hpp:5386
dnnl_query_t convert_to_c(query query)
Converts query enum value from C++ API to C API type.
Definition: dnnl.hpp:808
dnnl_status_t DNNL_API dnnl_memory_get_ocl_mem_object(const_dnnl_memory_t memory, cl_mem *mem_object)
Returns an OpenCL memory object associated with a memory object.
permuted 5D tensor
Definition: dnnl_types.h:200
engine scratchpad_engine() const
Returns the engine on which the scratchpad memory is located.
Definition: dnnl.hpp:2845
Intel(R) Advanced Vector Extensions 512 with Intel(R) DL Boost and Bfloat16 Support for Intel(R) Xeon...
Definition: dnnl_types.h:2110
Elementwise: linear.
Primitive descriptor for a softmax backward propagation primitive.
Definition: dnnl.hpp:5711
Reorder primitive.
Definition: dnnl.hpp:2995
4D CNN activations tensor blocked by channels with block size 8, an alias to dnnl_aBcd8b ...
Definition: dnnl_types.h:478
bool operator==(const desc &other) const
An equality operator.
Definition: dnnl.hpp:1847
Descriptor for an inner product forward propagation primitive.
Definition: dnnl.hpp:6747
memory::desc src_iter_c_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:7990
memory::desc diff_weights_desc() const
Returns a diff weights memory descriptor.
Definition: dnnl.hpp:7118
Descriptor for a shuffle forward propagation primitive.
Definition: dnnl.hpp:9290
lrn descriptor
Definition: dnnl_types.h:1973
dnnl_status_t DNNL_API dnnl_memory_create(dnnl_memory_t *memory, const dnnl_memory_desc_t *memory_desc, dnnl_engine_t engine, void *handle)
Creates a memory object.
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:6694
dnnl_status_t DNNL_API dnnl_eltwise_backward_desc_init(dnnl_eltwise_desc_t *eltwise_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *diff_data_desc, const dnnl_memory_desc_t *data_desc, float alpha, float beta)
Initializes a descriptor for eltwise backward propagation primitive.
memory::desc diff_src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:5073
Primitive descriptor for LSTM backward propagation.
Definition: dnnl.hpp:8313
4D tensor blocked by 1st and 2nd dimension with block size 8
Definition: dnnl_types.h:253
A shuffle primitive.
Definition: dnnl_types.h:673
memory::desc mean_desc() const
Returns memory descriptor for mean.
Definition: dnnl.hpp:6150
engine(const handle< dnnl_primitive_desc_t > &pd)
Constructs an engine based on a primitive from the primitive descriptor pd by querying its engine...
Definition: dnnl.hpp:898
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a logsoftmax forward propagation primitive. ...
Definition: dnnl.hpp:5842
memory::desc diff_dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:5993
for creating scratchpad memory
Definition: dnnl_types.h:1957
dnnl_status_t DNNL_API dnnl_primitive_attr_set_scratchpad_mode(dnnl_primitive_attr_t attr, dnnl_scratchpad_mode_t mode)
Sets primitive attributes scratchpad mode.
primitive_desc(const desc &desc, const engine &engine, const vanilla_rnn_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a vanilla RNN backward propagation primitive.
Definition: dnnl.hpp:7652
dnnl_status_t DNNL_API dnnl_dilated_deconvolution_backward_weights_desc_init(dnnl_deconvolution_desc_t *deconv_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *diff_weights_desc, const dnnl_memory_desc_t *diff_bias_desc, const dnnl_memory_desc_t *diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a dilated deconvolution weights gradient primitive.
memory::desc diff_weights_iter_desc() const
Returns diff weights iteration memory descriptor.
Definition: dnnl.hpp:8844
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:6321
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:5556
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a binary primitive from a C API primitive descriptor that must ...
Definition: dnnl.hpp:9529
dnnl_status_t DNNL_API dnnl_stream_create_ocl(dnnl_stream_t *stream, dnnl_engine_t engine, cl_command_queue queue)
Creates an execution stream for a given engine associated with an OpenCL command queue.
bool operator!=(const handle &other) const
Inequality operator.
Definition: dnnl.hpp:223
memory::desc diff_weights_desc() const
Returns a diff weights memory descriptor.
Definition: dnnl.hpp:2824
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a LBR GRU forward propagation primitive from a C API primitive ...
Definition: dnnl.hpp:8988
permuted 4D tensor
Definition: dnnl_types.h:196
bool operator==(const handle< T, traits > &other) const
Equality operator.
Definition: dnnl.hpp:213
desc(const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_dst_desc)
Constructs a descriptor for an inner product descriptor weights update primitive without bias...
Definition: dnnl.hpp:7047
Intel(R) Advanced Vector Extensions 2.
4D tensor blocked by 2nd dimension with block size 4
Definition: dnnl_types.h:236
Binary max.
Definition: dnnl_types.h:805
Unspecified format kind.
Definition: dnnl_types.h:85
void set_zero_points(int arg, int mask, const std::vector< int32_t > &zero_points)
Sets zero points for primitive operations for a given memory argument.
Definition: dnnl.hpp:2560
Resampling forward propagation.
Definition: dnnl.hpp:9692
dnnl_status_t DNNL_API dnnl_pooling_backward_desc_init(dnnl_pooling_desc_t *pool_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *diff_src_desc, const dnnl_memory_desc_t *diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t kernel, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for pooling backward propagation primitive.
Average pooling exclude padding.
Definition: dnnl_types.h:779
memory::desc diff_src_desc(int idx) const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:2765
memory::desc diff_dst_desc() const
Returns a diff destination memory descriptor.
Definition: dnnl.hpp:4121
desc(algorithm algorithm, 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)
Constructs a descriptor for a dilated convolution weights gradient primitive without bias...
Definition: dnnl.hpp:4039
3D CNN activations tensor blocked by channels with block size 16, an alias to dnnl_aBc16b ...
Definition: dnnl_types.h:481
dnnl_alg_kind_t
Kinds of algorithms.
Definition: dnnl_types.h:711
primitive_desc()=default
Default constructor. Produces an empty object.
Primitive descriptor for a RNN backward propagation primitive.
Definition: dnnl.hpp:7635
permuted 3D tensor
Definition: dnnl_types.h:198
desc get_desc() const
Returns the associated memory descriptor.
Definition: dnnl.hpp:1901
dnnl_rnn_flags_t
Flags for RNN cell.
Definition: dnnl_types.h:1417
dnnl_status_t DNNL_API dnnl_memory_set_ocl_mem_object(dnnl_memory_t memory, cl_mem mem_object)
Sets OpenCL memory object associated with a memory object.
bool operator!=(const desc &other) const
An inequality operator.
Definition: dnnl.hpp:1855
Base class for all primitive descriptors.
Definition: dnnl.hpp:2673
Primitive descriptor for a layer normalization backward propagation primitive.
Definition: dnnl.hpp:6637
Descriptor for a vanilla RNN forward propagation primitive.
Definition: dnnl.hpp:7347
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:4407
memory::desc src0_desc() const
Returns the memory descriptor for source #0.
Definition: dnnl.hpp:9536
desc reshape(const memory::dims &dims, bool allow_empty=false) const
Constructs a memory descriptor by reshaping an existing one.
Definition: dnnl.hpp:1759
dnnl_status_t DNNL_API dnnl_primitive_desc_destroy(dnnl_primitive_desc_t primitive_desc)
Destroys a primitive descriptor.
dnnl_status_t DNNL_API dnnl_post_ops_create(dnnl_post_ops_t *post_ops)
Creates empty post-ops sequence.
dnnl_binary_desc_t data
Underlying C operation descriptor.
Definition: dnnl.hpp:9462
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const batch_normalization_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a batch normalization backward propagation primitive.
Definition: dnnl.hpp:6273
An LRN primitive.
Definition: dnnl_types.h:689
desc(prop_kind prop_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 &weights_peephole_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_weights_peephole_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)
Constructs an LSTM (with or without peephole) descriptor for backward propagation using prop_kind...
Definition: dnnl.hpp:8146
reorder(const memory &src, const memory &dst, const primitive_attr &attr=primitive_attr())
Constructs a reorder primitive that would reorder data between memory objects having the same memory ...
Definition: dnnl.hpp:3092
A descriptor of a Local Response Normalization (LRN) operation.
Definition: dnnl_types.h:1282
Primitive descriptor for a shuffle backward propagation primitive.
Definition: dnnl.hpp:9396
int ndims
Number of dimensions.
Definition: dnnl_types.h:1005
dnnl_stream_flags_t
Stream flags.
Definition: dnnl_types.h:2005
Undefined propagation type.
Definition: dnnl_types.h:643
dnnl_status_t DNNL_API dnnl_engine_get_kind(dnnl_engine_t engine, dnnl_engine_kind_t *kind)
Returns the kind of an engine.
DNNL C API handle wrapper class.
Definition: dnnl.hpp:139
Primitive or engine failed on execution.
Definition: dnnl_types.h:51
void set_rnn_weights_qparams(int mask, const std::vector< float > &scales)
Sets quantization scaling factors for RNN weights tensors.
Definition: dnnl.hpp:2659
op descriptor
Definition: dnnl_types.h:1966
dnnl_status_t DNNL_API dnnl_primitive_attr_clone(dnnl_primitive_attr_t *attr, const_dnnl_primitive_attr_t existing_attr)
Clones primitive attributes.
primitive_desc_base()=default
Default constructor. Produces an empty object.
desc submemory_desc(const memory::dims &dims, const memory::dims &offsets, bool allow_empty=false) const
Constructs a memory descriptor for a region inside an area described by this memory descriptor...
Definition: dnnl.hpp:1703
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a convolution forward propagation primitive.
Definition: dnnl.hpp:3653
lrn_backward()=default
Default constructor. Produces an empty object.
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a vanilla RNN forward propagation primitive from a C API primit...
Definition: dnnl.hpp:7469
Primitive descriptor for an inner product forward propagation primitive.
Definition: dnnl.hpp:6816
memory::desc src_desc(int idx=0) const
Returns a source memory descriptor.
Definition: dnnl.hpp:9533
memory::desc bias_desc() const
Returns bias memory descriptor.
Definition: dnnl.hpp:7210
Descriptor for a deconvolution forward propagation primitive.
Definition: dnnl.hpp:4154
Eltwise: exponent.
Definition: dnnl_types.h:744
desc(algorithm algorithm, 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)
Constructs a descriptor for a dilated deconvolution weights gradient primitive without bias...
Definition: dnnl.hpp:4760
weights memory descriptor desc
lbr_gru_backward()=default
Default constructor. Produces an empty object.
dnnl_status_t DNNL_API dnnl_primitive_desc_iterator_destroy(dnnl_primitive_desc_iterator_t iterator)
Destroys a primitive descriptor iterator.
primitive_desc()=default
Default constructor. Produces an empty object.
memory::desc src_iter_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:8999
Local response normalization (LRN) across multiple channels.
Definition: dnnl_types.h:783
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const pooling_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a pooling backward propagation primitive.
Definition: dnnl.hpp:5303
resampling descriptor
Definition: dnnl_types.h:1982
dnnl_status_t DNNL_API dnnl_logsoftmax_forward_desc_init(dnnl_logsoftmax_desc_t *logsoftmax_desc, dnnl_prop_kind_t prop_kind, const dnnl_memory_desc_t *data_desc, int logsoftmax_axis)
Initializes a descriptor for logsoftmax forward propagation primitive.
primitive_desc(const desc &desc, const engine &engine, const deconvolution_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a deconvolution backward propagation primitive.
Definition: dnnl.hpp:4534
Forward data propagation, alias for dnnl::prop_kind::forward_inference.
softmax_forward()=default
Default constructor. Produces an empty object.
Descriptor for a logsoftmax backward propagation primitive.
Definition: dnnl.hpp:5897
memory::desc diff_dst_layer_desc() const
Returns diff destination layer memory descriptor.
Definition: dnnl.hpp:7749
memory::desc src_layer_desc() const
Returns source layer memory descriptor.
Definition: dnnl.hpp:8795
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a pooling backward propagation primitive from a C API primitive...
Definition: dnnl.hpp:5316
desc(prop_kind prop_kind, algorithm algorithm, 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)
Constructs a descriptor for pooling forward propagation primitive.
Definition: dnnl.hpp:5136
Primitive descriptor GRU forward propagation primitive.
Definition: dnnl.hpp:8548
dnnl_status_t DNNL_API dnnl_inner_product_backward_weights_desc_init(dnnl_inner_product_desc_t *ip_desc, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *diff_weights_desc, const dnnl_memory_desc_t *diff_bias_desc, const dnnl_memory_desc_t *diff_dst_desc)
Initializes descriptor for inner product weights gradient primitive.
memory::desc weights_iter_desc() const
Returns weights iteration memory descriptor.
Definition: dnnl.hpp:8000
plain 3D tensor
Definition: dnnl_types.h:179
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:2812
Use scale and shift parameters.
Definition: dnnl_types.h:840
A descriptor of a Batch Normalization operation.
Definition: dnnl_types.h:1313
dnnl_status_t DNNL_API dnnl_lbr_gru_forward_desc_init(dnnl_rnn_desc_t *rnn_desc, dnnl_prop_kind_t prop_kind, dnnl_rnn_direction_t direction, const dnnl_memory_desc_t *src_layer_desc, const dnnl_memory_desc_t *src_iter_desc, const dnnl_memory_desc_t *weights_layer_desc, const dnnl_memory_desc_t *weights_iter_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_layer_desc, const dnnl_memory_desc_t *dst_iter_desc, unsigned flags)
Initializes a descriptor for LBR GRU forward propagation primitive.
memory::desc dst_layer_desc() const
Returns destination layer memory descriptor.
Definition: dnnl.hpp:7711
primitive_desc()=default
Default constructor. Produces an empty object.
Intel(R) Advanced Vector Extensions 2.
Definition: dnnl_types.h:2088
3D CNN activations tensor blocked by channels with block size 4, an alias to dnnl_aBc4b ...
Definition: dnnl_types.h:484
Eltwise: exponential linear unit (elu) (dst for backward)
Definition: dnnl_types.h:767
Logsoftmax forward propagation primitive.
Definition: dnnl.hpp:5795
Convolution algorithm (either direct or Winograd) to be chosen just in time.
Eltwise: exponential linear unit (elu)
Definition: dnnl_types.h:728
dnnl_status_t DNNL_API dnnl_matmul_desc_init(dnnl_matmul_desc_t *matmul_desc, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_desc)
Initializes a matrix multiplication descriptor.
pooling descriptor
dnnl_primitive_desc_t DNNL_API dnnl_primitive_desc_iterator_fetch(const_dnnl_primitive_desc_iterator_t iterator)
Fetches the current primitive descriptor from a primitive descriptor iterator.
size_t DNNL_API dnnl_engine_get_count(dnnl_engine_kind_t kind)
Returns the number of engines of a particular kind.
6D tensor blocked by 2nd dimension with block size 16
Definition: dnnl_types.h:297
Forward data propagation (alias for dnnl_forward_inference).
Definition: dnnl_types.h:652
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:5662
Primitive descriptor for a matmul primitive.
Definition: dnnl.hpp:9616
5D CNN activations tensor blocked by channels with block size 16, an alias to dnnl_aBcde16b ...
Definition: dnnl_types.h:463
An opaque structure to describe a primitive descriptor.
Descriptor for a LBR GRU backward propagation primitive.
Definition: dnnl.hpp:9040
rnn_primitive_desc_base(dnnl_primitive_desc_t pd, dnnl::prop_kind prop_kind, dnnl::algorithm cell_kind)
Constructs an RNN primitive descriptor base from a C API primitive descriptor while checking that it ...
Definition: dnnl.hpp:7164
memory::desc diff_src_desc() const
Returns a diff source memory descriptor.
Definition: dnnl.hpp:6302
Eltwise: abs.
Definition: dnnl_types.h:732
bool is_zero() const
Checks whether the memory descriptor is zero (empty).
Definition: dnnl.hpp:1841
Descriptor for resampling forward propagation.
Definition: dnnl.hpp:9694
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:2830
dnnl_primitive_kind_t convert_to_c(primitive::kind kind)
Converts primitive kind enum value from C++ API to C API type.
Definition: dnnl.hpp:365
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:6146
Forward data propagation (training mode).
Definition: dnnl_types.h:646
A deconvolution primitive.
permuted 5D tensor
Definition: dnnl_types.h:186
Elementwise: ReLU (dst for backward)
lstm_forward(const primitive_desc &pd)
Constructs an LSTM forward propagation primitive.
Definition: dnnl.hpp:8037
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a vanilla RNN forward propagation primitive.
Definition: dnnl.hpp:7458
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for an LRN backward propagation primitive from a C API primitive de...
Definition: dnnl.hpp:5068
Eltwise: tanh-based gelu (alias for dnnl_eltwise_gelu_tanh)
Definition: dnnl_types.h:751
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a logsoftmax forward propagation primitive from a C API primiti...
Definition: dnnl.hpp:5869
Descriptor for an LSTM backward propagation primitive.
Definition: dnnl.hpp:8043
source gradient (diff) memory desc
A rnn primitive.
Definition: dnnl_types.h:697
An opaque structure to describe an execution stream.
Primitive descriptor for an inner product backward propagation primitive.
Definition: dnnl.hpp:6920
Descriptor for a layer normalization backward propagation primitive.
Definition: dnnl.hpp:6551
A logsoftmax primitive.
Definition: dnnl_types.h:703
memory::desc diff_src_iter_desc() const
Returns diff source iteration memory descriptor.
Definition: dnnl.hpp:8834
primitive_desc()=default
Default constructor. Produces an empty object.
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const logsoftmax_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a logsoftmax backward propagation primitive.
Definition: dnnl.hpp:5965
A convolution primitive.
rnn_flags
RNN cell flags.
Definition: dnnl.hpp:626
Elementwise: square.
dnnl_status_t DNNL_API dnnl_resampling_backward_desc_init(dnnl_resampling_desc_t *resampling_desc, dnnl_alg_kind_t alg_kind, const float *factors, const dnnl_memory_desc_t *diff_src_desc, const dnnl_memory_desc_t *diff_dst_desc)
Initializes a descriptor for resampling backward propagation primitive.
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:6137
Descriptor for a shuffle primitive backward propagation primitive.
Definition: dnnl.hpp:9371
primitive_desc(const desc &desc, const engine &engine, const pooling_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a pooling backward propagation primitive.
Definition: dnnl.hpp:5284
memory::desc diff_src_iter_desc() const
Returns diff source iteration memory descriptor.
Definition: dnnl.hpp:7729
logsoftmax_forward(const primitive_desc &pd)
Constructs a logsoftmax forward propagation primitive.
Definition: dnnl.hpp:5891
The operation failed because requested functionality is not implemented.
Definition: dnnl_types.h:47
Eltwise: gelu.
Definition: dnnl_types.h:749
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for an eltwise forward propagation primitive from a C API primitive...
Definition: dnnl.hpp:5440
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:4401
memory::desc diff_dst_layer_desc() const
Returns diff destination layer memory descriptor.
Definition: dnnl.hpp:8854
Eltwise: hyperbolic tangent non-linearity (tanh)
Definition: dnnl_types.h:726
primitive_desc()=default
Default constructor. Produces an empty object.
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const layer_normalization_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a layer normalization backward propagation primitive.
Definition: dnnl.hpp:6674
Primitive descriptor for a deconvolution backward propagation primitive.
Definition: dnnl.hpp:4517
desc(prop_kind prop_kind, const memory::desc &data_desc, int logsoftmax_axis)
Constructs a descriptor for a logsoftmax forward propagation primitive.
Definition: dnnl.hpp:5817
Softmax backward propagation primitive.
Definition: dnnl.hpp:5678
Bidirectional execution of RNN primitive with summation of the results.
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:4575
Primitive descriptor for an LBR GRU forward propagation primitive.
Definition: dnnl.hpp:8947
dnnl_status_t DNNL_API dnnl_memory_desc_init_submemory(dnnl_memory_desc_t *memory_desc, const dnnl_memory_desc_t *parent_memory_desc, const dnnl_dims_t dims, const dnnl_dims_t offsets)
Initializes a memory descriptor for a region inside an area described by an existing memory descripto...
A descriptor of resampling operation.
Definition: dnnl_types.h:1565
void set_ocl_mem_object(cl_mem mem_object)
Sets the OpenCL memory object mem_object associated with the memory.
Definition: dnnl.hpp:2016
desc(algorithm algorithm, 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)
Constructs a descriptor for a deconvolution weights gradient primitive with bias. ...
Definition: dnnl.hpp:4624
dnnl_status_t DNNL_API dnnl_set_verbose(int level)
Configures verbose output to stdout.
memory::desc dst_iter_desc() const
Returns destination iteration memory descriptor.
Definition: dnnl.hpp:8402
primitive_desc()=default
Default constructor. Produces an empty object.
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for an LRN forward propagation primitive.
Definition: dnnl.hpp:4928
dnnl_status_t DNNL_API dnnl_primitive_attr_get_post_ops(const_dnnl_primitive_attr_t attr, const_dnnl_post_ops_t *post_ops)
Returns primitive attributes post-ops.
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a convolution weights gradient primitive from a C API primitive...
Definition: dnnl.hpp:4108
scratchpad_mode get_scratchpad_mode() const
Returns the scratchpad mode.
Definition: dnnl.hpp:2378
query
Primitive descriptor query specification.
Definition: dnnl.hpp:713
memory::desc diff_dst_layer_desc() const
Returns diff destination layer memory descriptor.
Definition: dnnl.hpp:8450
Primitive descriptor for a sum primitive.
Definition: dnnl.hpp:3235
T * map_data() const
Maps the data of the memory.
Definition: dnnl.hpp:1977
dnnl_prop_kind_t
Kinds of propagation.
Definition: dnnl_types.h:640
#define DNNL_ARG_DIFF_WEIGHTS_LAYER
A special mnemonic for diff of RNN weights applied to the layer input.
Definition: dnnl_types.h:1864
dnnl_status_t DNNL_API dnnl_batch_normalization_forward_desc_init(dnnl_batch_normalization_desc_t *bnrm_desc, dnnl_prop_kind_t prop_kind, const dnnl_memory_desc_t *data_desc, float epsilon, unsigned flags)
Initializes a descriptor for a batch normalization forward propagation primitive. ...
scratchpad_mode
Scratchpad mode.
Definition: dnnl.hpp:402
Descriptor for a pooling forward propagation primitive.
Definition: dnnl.hpp:5104
desc(prop_kind prop_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)
Constructs a descriptor for an LSTM forward propagation primitive.
Definition: dnnl.hpp:7911
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:6296
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const lbr_gru_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an LBR GRU backward propagation primitive.
Definition: dnnl.hpp:9181
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a GRU forward propagation primitive.
Definition: dnnl.hpp:8576
primitive_desc()=default
Default constructor. Produces an empty object.
Convolution weights gradient primitive.
Definition: dnnl.hpp:3866
Elementwise: gelu alias for dnnl::algorithm::eltwise_gelu_tanh.
primitive_desc(const desc &desc, const engine &engine, const convolution_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a convolution weights gradient primitive.
Definition: dnnl.hpp:4076
Nearest Neighbor Resampling Method.
Definition: dnnl_types.h:809
std::vector< dim > dims
Vector of dimensions.
Definition: dnnl.hpp:1124
concat(const primitive_desc &pd)
Constructs a concatenation primitive.
Definition: dnnl.hpp:3219
permuted 4D tensor
Definition: dnnl_types.h:194
memory::dim query_s64(query what) const
Returns a memory::dim value (same as int64_t).
Definition: dnnl.hpp:2697
desc()
Constructs a zero (empty) memory descriptor.
Definition: dnnl.hpp:1630
dnnl_status_t DNNL_API dnnl_stream_destroy(dnnl_stream_t stream)
Destroys an execution stream.
desc(prop_kind prop_kind, algorithm algorithm, 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)
Constructs a descriptor for a convolution forward propagation primitive without bias.
Definition: dnnl.hpp:3501
primitive_desc(const desc &desc, const engine &engine, const deconvolution_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a deconvolution weights update primitive.
Definition: dnnl.hpp:4798
dnnl_status_t DNNL_API dnnl_stream_get_ocl_command_queue(dnnl_stream_t stream, cl_command_queue *queue)
Returns the OpenCL command queue associated with an execution stream.
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for an eltwise backward propagation primitive from a C API primitiv...
Definition: dnnl.hpp:5548
dnnl_status_t DNNL_API dnnl_vanilla_rnn_forward_desc_init(dnnl_rnn_desc_t *rnn_desc, dnnl_prop_kind_t prop_kind, const dnnl_alg_kind_t activation, const dnnl_rnn_direction_t direction, const dnnl_memory_desc_t *src_layer_desc, const dnnl_memory_desc_t *src_iter_desc, const dnnl_memory_desc_t *weights_layer_desc, const dnnl_memory_desc_t *weights_iter_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_layer_desc, const dnnl_memory_desc_t *dst_iter_desc, unsigned flags, float alpha, float beta)
Initializes a descriptor for vanilla RNN forward propagation primitive.
16-bit/half-precision floating point.
Definition: dnnl_types.h:66
primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const deconvolution_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for a deconvolution backward propagation primitive.
Definition: dnnl.hpp:4554
Primitive descriptor for a softmax forward propagation primitive.
Definition: dnnl.hpp:5615
Primitive descriptor for eltwise backward propagation.
Definition: dnnl.hpp:5498
source engine
Definition: dnnl_types.h:1959
Descriptor for a softmax forward propagation primitive.
Definition: dnnl.hpp:5584
dnnl_status_t DNNL_API dnnl_inner_product_forward_desc_init(dnnl_inner_product_desc_t *ip_desc, dnnl_prop_kind_t prop_kind, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_desc)
Initializes descriptor for inner product forward propagation.
logsoftmax_forward()=default
Default constructor. Produces an empty object.
const post_ops get_post_ops() const
Returns post-ops previously set via set_post_ops().
Definition: dnnl.hpp:2571
primitive_desc(const desc &desc, const engine &engine, bool allow_empty=false)
Constructs a primitive descriptor for a GRU forward propagation primitive.
Definition: dnnl.hpp:8561
memory::desc dst_iter_c_desc() const
Returns source iteration memory descriptor.
Definition: dnnl.hpp:8405
dnnl_status_t DNNL_API dnnl_resampling_forward_desc_init(dnnl_resampling_desc_t *resampling_desc, dnnl_prop_kind_t prop_kind, dnnl_alg_kind_t alg_kind, const float *factors, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *dst_desc)
Initializes a descriptor for a resampling forward propagation primitive.
dnnl_normalization_flags_t
Flags for batch normalization primitive.
Definition: dnnl_types.h:815
weights grad. memory desc
Definition: dnnl_types.h:1989
engine()=default
Constructs an empty engine.
shuffle_forward()=default
Default constructor. Produces an empty object.
#define DNNL_ARG_DST_ITER_C
A special mnemonic for LSTM output recurrent cell state vector.
Definition: dnnl_types.h:1772
algorithm
Kinds of algorithms.
Definition: dnnl.hpp:471
Resampling backward propagation primitive.
Definition: dnnl.hpp:9851
status set_jit_dump(int enable)
Configures dumping of JIT-generated code.
Definition: dnnl.hpp:10018
memory::desc variance_desc() const
Returns memory descriptor for variance.
Definition: dnnl.hpp:6154
deconvolution_backward_weights()=default
Default constructor. Produces an empty object.
Primitive iterator passed over last primitive descriptor.
memory::desc workspace_desc() const
Returns the workspace memory descriptor.
Definition: dnnl.hpp:8410
Primitive descriptor for a resampling forward propagation primitive.
Definition: dnnl.hpp:9788
format_tag
Memory format tag specification.
Definition: dnnl.hpp:1213
A convolution primitive.
Definition: dnnl_types.h:679
memory desc of an execute argument
Definition: dnnl_types.h:1994
#define DNNL_ARG_FROM
A special mnemonic for reorder source argument.
Definition: dnnl_types.h:1737
Backward bias propagation.
Definition: dnnl_types.h:662
matmul descriptor
memory::desc dst_iter_desc() const
Returns destination iteration memory descriptor.
Definition: dnnl.hpp:7501
memory::desc src_layer_desc() const
Returns source layer memory descriptor.
Definition: dnnl.hpp:8994
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a deconvolution weights gradient primitive from a C API primiti...
Definition: dnnl.hpp:4831
Eltwise: logistic (dst for backward)
Definition: dnnl_types.h:771
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for an inner product backward propagation primitive from a C API pr...
Definition: dnnl.hpp:6970
primitive_desc(dnnl_primitive_desc_t pd)
Constructs a primitive descriptor for a pooling forward propagation primitive from a C API primitive ...
Definition: dnnl.hpp:5194
deconvolution descriptor
weights memory descriptor desc
Definition: dnnl_types.h:1988
memory::desc weights_iter_desc() const
Returns weights iteration memory descriptor.
Definition: dnnl.hpp:7488
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:5766
dnnl_status_t DNNL_API dnnl_primitive_attr_get_zero_points(const_dnnl_primitive_attr_t attr, int arg, dnnl_dim_t *count, int *mask, const int32_t **zero_points)
Returns count, correspondence zero point mask, and a pointer to a constant int32_t array of zero_poin...
dnnl_status_t DNNL_API dnnl_engine_create_ocl(dnnl_engine_t *engine, dnnl_engine_kind_t kind, cl_device_id device, cl_context context)
Creates an engine associated with an OpenCL device and an OpenCL context.
primitive_desc()=default
Default constructor. Produces an empty object.
desc(algorithm algorithm, 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)
Constructs a descriptor for pooling backward propagation primitive.
Definition: dnnl.hpp:5249
void append_dw_k3s1p1(memory::data_type weights_data_type, memory::data_type bias_data_type, memory::data_type dst_data_type, int mask, const std::vector< float > &scales)
Appends a depthwise post-op convolution with stride 1.
Definition: dnnl.hpp:2208
implementation name
Linear Resampling Method.
Definition: dnnl_types.h:811
Descriptor for a logsoftmax forward propagation primitive.
Definition: dnnl.hpp:5797
Eltwise: soft_relu.
Definition: dnnl_types.h:740
vanilla_rnn_backward(const primitive_desc &pd)
Constructs a vanilla RNN backward propagation primitive.
Definition: dnnl.hpp:7765
Unidirectional execution of RNN primitive from right to left.
plain 5D tensor
Definition: dnnl_types.h:181
memory::desc src_desc() const
Returns a source memory descriptor.
Definition: dnnl.hpp:6293
dnnl_status_t DNNL_API dnnl_dilated_deconvolution_backward_data_desc_init(dnnl_deconvolution_desc_t *deconv_desc, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *diff_src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a dilated deconvolution backward propagation primitive.
primitive_desc(const desc &desc, const engine &engine, const eltwise_forward::primitive_desc &hint_fwd_pd, bool allow_empty=false)
Constructs a primitive descriptor for an elementwise backward propagation primitive.
Definition: dnnl.hpp:5515
primitive_attr()
Constructs default (empty) primitive attributes.
Definition: dnnl.hpp:2362
destination engine
Definition: dnnl_types.h:1960
size_t get_size() const
Returns size of the memory descriptor in bytes.
Definition: dnnl.hpp:1836
batch_normalization_backward(const primitive_desc &pd)
Constructs a batch normalization backward propagation primitive.
Definition: dnnl.hpp:6330
Eltwise: square.
Definition: dnnl_types.h:730
memory::desc weights_desc() const
Returns a weights memory descriptor.
Definition: dnnl.hpp:9658
#define DNNL_ARG_DIFF_WEIGHTS_PEEPHOLE
A special mnemonic for diff of RNN weights applied to the peephole weights.
Definition: dnnl_types.h:1876
dnnl_status_t DNNL_API dnnl_primitive_attr_set_post_ops(dnnl_primitive_attr_t attr, const_dnnl_post_ops_t post_ops)
Sets primitive attributes post-ops.
An unspecified engine.
Descriptor for a convolution backward propagation primitive.
Definition: dnnl.hpp:3698
memory::desc diff_dst_iter_c_desc() const
Returns diff destination recurrent cell state memory descriptor.
Definition: dnnl.hpp:7297
A batch normalization primitive.
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:6140
An execution stream.
Definition: dnnl.hpp:981
memory::desc diff_bias_desc() const
Returns diff bias memory descriptor.
Definition: dnnl.hpp:9253
Elementwise: exponential linear unit (elu) (dst for backward)
convolution_backward_weights()=default
Default constructor. Produces an empty object.
memory::desc dst_desc() const
Returns a destination memory descriptor.
Definition: dnnl.hpp:6505
memory::desc diff_weights_iter_desc() const
Returns diff weights iteration memory descriptor.
Definition: dnnl.hpp:7739
dnnl_status_t DNNL_API dnnl_primitive_attr_get_scratchpad_mode(const_dnnl_primitive_attr_t attr, dnnl_scratchpad_mode_t *mode)
Returns the primitive attributes scratchpad mode.
Post-ops.
Definition: dnnl.hpp:2082
dnnl_status_t DNNL_API dnnl_dilated_deconvolution_forward_desc_init(dnnl_deconvolution_desc_t *deconv_desc, dnnl_prop_kind_t prop_kind, dnnl_alg_kind_t alg_kind, const dnnl_memory_desc_t *src_desc, const dnnl_memory_desc_t *weights_desc, const dnnl_memory_desc_t *bias_desc, const dnnl_memory_desc_t *dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r)
Initializes a descriptor for a dilated deconvolution forward propagation primitive.
primitive()=default
Default constructor. Constructs an empty object.
desc(prop_kind prop_kind, algorithm algorithm, const memory::desc &data_desc, memory::dim local_size, float alpha, float beta, float k=1.f)
Constructs a descriptor for a LRN forward propagation primitive.
Definition: dnnl.hpp:4902
Backward data propagation.
Matrix multiplication (matmul) primitive.
Definition: dnnl.hpp:9567