File size: 147,794 Bytes
2f705f7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 | /*
* Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
*
* NOTICE TO LICENSEE:
*
* This source code and/or documentation ("Licensed Deliverables") are
* subject to NVIDIA intellectual property rights under U.S. and
* international Copyright laws.
*
* These Licensed Deliverables contained herein is PROPRIETARY and
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
* conditions of a form of NVIDIA software license agreement by and
* between NVIDIA and Licensee ("License Agreement") or electronically
* accepted by Licensee. Notwithstanding any terms or conditions to
* the contrary in the License Agreement, reproduction or disclosure
* of the Licensed Deliverables to any third party without the express
* written consent of NVIDIA is prohibited.
*
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THESE LICENSED DELIVERABLES.
*
* U.S. Government End Users. These Licensed Deliverables are a
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
* 1995), consisting of "commercial computer software" and "commercial
* computer software documentation" as such terms are used in 48
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
* U.S. Government End Users acquire the Licensed Deliverables with
* only those rights set forth herein.
*
* Any use of the Licensed Deliverables in individual and commercial
* software must include, in the user documentation and internal
* comments to the code, the above Disclaimer and U.S. Government End
* Users Notice.
*/
/**
* @file cudnn_ops.h
* @brief cuDNN Operations library - tensor descriptors, basic operations, batch normalization, pooling, etc.
*/
/*
* cudnn_ops : cuDNN's basic definitions and basic operations.
*/
#if !defined(CUDNN_OPS_H_)
#define CUDNN_OPS_H_
#include <stdint.h>
#include "cudnn_version.h"
#include "cudnn_graph.h"
/* These version numbers are autogenerated, do not edit manually. */
#define CUDNN_OPS_MAJOR 9
#define CUDNN_OPS_MINOR 22
#define CUDNN_OPS_PATCH 0
#if (CUDNN_OPS_MAJOR != CUDNN_MAJOR) || (CUDNN_OPS_MINOR != CUDNN_MINOR) || (CUDNN_OPS_PATCH != CUDNN_PATCHLEVEL)
#error Version mismatch in cuDNN OPS INFER!!!
#endif
#if defined(__cplusplus)
extern "C" {
#endif
/* Data structures to represent Image/Filter and the Neural Network Layer */
/** @brief Opaque descriptor for a tensor. @since cuDNN 9.0.0 */
typedef struct cudnnTensorStruct *cudnnTensorDescriptor_t;
/** @brief Opaque descriptor for a pooling operation. @since cuDNN 9.0.0 @deprecated Since cuDNN 9.0.0. Use graph API instead. */
typedef struct cudnnPoolingStruct *cudnnPoolingDescriptor_t CUDNN_DEPRECATED;
/** @brief Opaque descriptor for a filter (convolution kernel). @since cuDNN 9.0.0 @deprecated Since cuDNN 9.0.0. Use graph API instead. */
typedef struct cudnnFilterStruct *cudnnFilterDescriptor_t CUDNN_DEPRECATED;
/** @brief Opaque descriptor for Local Response Normalization (LRN). @since cuDNN 9.0.0 */
typedef struct cudnnLRNStruct *cudnnLRNDescriptor_t;
/** @brief Opaque descriptor for an activation function. @since cuDNN 9.0.0 @deprecated Since cuDNN 9.0.0. Use graph API instead. */
typedef struct cudnnActivationStruct *cudnnActivationDescriptor_t CUDNN_DEPRECATED;
/** @brief Opaque descriptor for a spatial transformer network. @since cuDNN 9.0.0 */
typedef struct cudnnSpatialTransformerStruct *cudnnSpatialTransformerDescriptor_t;
/** @brief Opaque descriptor for an element-wise tensor operation. @since cuDNN 9.0.0 @deprecated Since cuDNN 9.0.0. Use graph API instead. */
typedef struct cudnnOpTensorStruct *cudnnOpTensorDescriptor_t CUDNN_DEPRECATED;
/** @brief Opaque descriptor for a tensor reduction operation. @since cuDNN 9.0.0 @deprecated Since cuDNN 9.0.0. Use graph API instead. */
typedef struct cudnnReduceTensorStruct *cudnnReduceTensorDescriptor_t CUDNN_DEPRECATED;
/** @brief Opaque descriptor for a CTC loss function. @since cuDNN 9.0.0 */
typedef struct cudnnCTCLossStruct *cudnnCTCLossDescriptor_t;
/** @brief Opaque descriptor for tensor transform operations. @since cuDNN 9.0.0 @deprecated Since cuDNN 9.0.0. Use graph API instead. */
typedef struct cudnnTensorTransformStruct *cudnnTensorTransformDescriptor_t CUDNN_DEPRECATED;
/**
* @brief Indicates whether results are guaranteed to be reproducible across runs.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_NON_DETERMINISTIC = 0, /**< Results may vary across runs. @since cuDNN 9.0.0 */
CUDNN_DETERMINISTIC = 1, /**< Results are guaranteed to be reproducible. @since cuDNN 9.0.0 */
} cudnnDeterminism_t;
/**
* @brief Creates a tensor descriptor.
*
* Allocates and initializes a new tensor descriptor object.
*
* @param[out] tensorDesc Pointer to the newly created tensor descriptor.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was created successfully.
* @retval CUDNN_STATUS_ALLOC_FAILED Memory allocation failed.
*
* @since cuDNN 9.0.0
* @see cudnnDestroyTensorDescriptor, cudnnSetTensor4dDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnCreateTensorDescriptor(cudnnTensorDescriptor_t *tensorDesc);
/**
* @brief Sets a 4D tensor descriptor.
*
* Initializes a previously created tensor descriptor with the specified format,
* data type, and dimensions. Strides are computed automatically based on the format.
*
* @param[in,out] tensorDesc Tensor descriptor to initialize.
* @param[in] format Memory layout format (e.g., NCHW or NHWC).
* @param[in] dataType Data type of the tensor elements.
* @param[in] n Number of images (batch size).
* @param[in] c Number of feature maps (channels).
* @param[in] h Height of each feature map.
* @param[in] w Width of each feature map.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSetTensor4dDescriptorEx, cudnnGetTensor4dDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnSetTensor4dDescriptor(cudnnTensorDescriptor_t tensorDesc,
cudnnTensorFormat_t format,
cudnnDataType_t dataType, /* image data type */
int n, /* number of inputs (batch size) */
int c, /* number of input feature maps */
int h, /* height of input section */
int w); /* width of input section */
/**
* @brief Sets a 4D tensor descriptor with explicit strides.
*
* Initializes a previously created tensor descriptor with the specified data type,
* dimensions, and explicit stride values for each dimension.
*
* @param[in,out] tensorDesc Tensor descriptor to initialize.
* @param[in] dataType Data type of the tensor elements.
* @param[in] n Number of images (batch size).
* @param[in] c Number of feature maps (channels).
* @param[in] h Height of each feature map.
* @param[in] w Width of each feature map.
* @param[in] nStride Stride between images.
* @param[in] cStride Stride between feature maps.
* @param[in] hStride Stride between rows.
* @param[in] wStride Stride between columns.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSetTensor4dDescriptor, cudnnGetTensor4dDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnSetTensor4dDescriptorEx(cudnnTensorDescriptor_t tensorDesc,
cudnnDataType_t dataType, /* image data type */
int n, /* number of inputs (batch size) */
int c, /* number of input feature maps */
int h, /* height of input section */
int w, /* width of input section */
int nStride,
int cStride,
int hStride,
int wStride);
/**
* @brief Retrieves the settings of a previously initialized 4D tensor descriptor.
*
* @param[in] tensorDesc Tensor descriptor to query.
* @param[out] dataType Data type of the tensor.
* @param[out] n Number of images (batch size).
* @param[out] c Number of feature maps (channels).
* @param[out] h Height of each feature map.
* @param[out] w Width of each feature map.
* @param[out] nStride Stride between images.
* @param[out] cStride Stride between feature maps.
* @param[out] hStride Stride between rows.
* @param[out] wStride Stride between columns.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @see cudnnSetTensor4dDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnGetTensor4dDescriptor(const cudnnTensorDescriptor_t tensorDesc,
cudnnDataType_t *dataType, /* image data type */
int *n, /* number of inputs (batch size) */
int *c, /* number of input feature maps */
int *h, /* height of input section */
int *w, /* width of input section */
int *nStride,
int *cStride,
int *hStride,
int *wStride);
/**
* @brief Sets an N-dimensional tensor descriptor.
*
* Initializes a tensor descriptor with arbitrary dimensionality, data type, dimensions, and strides.
*
* @param[in,out] tensorDesc Tensor descriptor to initialize.
* @param[in] dataType Data type of the tensor elements.
* @param[in] nbDims Number of dimensions.
* @param[in] dimA Array of dimension sizes (length nbDims).
* @param[in] strideA Array of strides (length nbDims).
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnGetTensorNdDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnSetTensorNdDescriptor(cudnnTensorDescriptor_t tensorDesc,
cudnnDataType_t dataType,
int nbDims,
const int dimA[],
const int strideA[]);
/**
* @brief Sets an N-dimensional tensor descriptor with automatic stride computation.
*
* Initializes a tensor descriptor with the specified format; strides are computed
* automatically from the format and dimensions.
*
* @param[in,out] tensorDesc Tensor descriptor to initialize.
* @param[in] format Memory layout format.
* @param[in] dataType Data type of the tensor elements.
* @param[in] nbDims Number of dimensions.
* @param[in] dimA Array of dimension sizes (length nbDims).
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSetTensorNdDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnSetTensorNdDescriptorEx(cudnnTensorDescriptor_t tensorDesc,
cudnnTensorFormat_t format,
cudnnDataType_t dataType,
int nbDims,
const int dimA[]);
/**
* @brief Retrieves the settings of a previously initialized N-dimensional tensor descriptor.
*
* @param[in] tensorDesc Tensor descriptor to query.
* @param[in] nbDimsRequested Number of dimensions to retrieve.
* @param[out] dataType Data type of the tensor.
* @param[out] nbDims Actual number of dimensions in the descriptor.
* @param[out] dimA Array to receive dimension sizes (length nbDimsRequested).
* @param[out] strideA Array to receive strides (length nbDimsRequested).
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @see cudnnSetTensorNdDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnGetTensorNdDescriptor(const cudnnTensorDescriptor_t tensorDesc,
int nbDimsRequested,
cudnnDataType_t *dataType,
int *nbDims,
int dimA[],
int strideA[]);
/**
* @brief Returns the memory size in bytes required by a tensor.
*
* @param[in] tensorDesc Tensor descriptor to query.
* @param[out] size Memory size in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
*/
cudnnStatus_t CUDNNWINAPI
cudnnGetTensorSizeInBytes(const cudnnTensorDescriptor_t tensorDesc, size_t *size);
/* PixelOffset( n, c, h, w ) = n *input_stride + c * feature_stride + h * h_stride + w * w_stride
1)Example of all images in row major order one batch of features after the other (with an optional padding on row)
input_stride : c x h x h_stride
feature_stride : h x h_stride
h_stride : >= w ( h_stride = w if no padding)
w_stride : 1
2)Example of all images in row major with features maps interleaved
input_stride : c x h x h_stride
feature_stride : 1
h_stride : w x c
w_stride : c
3)Example of all images in column major order one batch of features after the other (with optional padding on column)
input_stride : c x w x w_stride
feature_stride : w x w_stride
h_stride : 1
w_stride : >= h
*/
/**
* @brief Destroys a tensor descriptor.
*
* Releases the resources associated with a tensor descriptor object.
*
* @param[in] tensorDesc Tensor descriptor to destroy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was destroyed successfully.
*
* @since cuDNN 9.0.0
* @see cudnnCreateTensorDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnDestroyTensorDescriptor(cudnnTensorDescriptor_t tensorDesc);
/**
* @brief Specifies the direction for tensor transform folding operations.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_TRANSFORM_FOLD = 0U, /**< Fold the tensor. @since cuDNN 9.0.0 */
CUDNN_TRANSFORM_UNFOLD = 1U, /**< Unfold the tensor. @since cuDNN 9.0.0 */
} cudnnFoldingDirection_t;
/**
* @brief Initializes the destination tensor descriptor for a tensor transform.
*
* Computes the destination tensor dimensions and size based on the transform and source descriptors.
*
* @param[in] transformDesc Transform descriptor specifying the operation.
* @param[in] srcDesc Source tensor descriptor.
* @param[in,out] destDesc Destination tensor descriptor to be initialized.
* @param[out] destSizeInBytes Memory size in bytes of the destination tensor.
*
* @retval CUDNN_STATUS_SUCCESS The destination descriptor was initialized successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnTransformTensorEx
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnInitTransformDest(const cudnnTensorTransformDescriptor_t transformDesc,
const cudnnTensorDescriptor_t srcDesc,
cudnnTensorDescriptor_t destDesc,
size_t *destSizeInBytes);
/**
* @brief Creates a tensor transform descriptor.
*
* Allocates and initializes a new tensor transform descriptor object.
*
* @param[out] transformDesc Pointer to the newly created transform descriptor.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was created successfully.
* @retval CUDNN_STATUS_ALLOC_FAILED Memory allocation failed.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnDestroyTensorTransformDescriptor, cudnnSetTensorTransformDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnCreateTensorTransformDescriptor(cudnnTensorTransformDescriptor_t *transformDesc);
/**
* @brief Configures a tensor transform descriptor.
*
* Sets the parameters of a previously created tensor transform descriptor including
* padding, folding, and destination format.
*
* @param[in,out] transformDesc Transform descriptor to configure.
* @param[in] nbDims Number of dimensions.
* @param[in] destFormat Destination tensor format.
* @param[in] padBeforeA Array of padding values before each dimension.
* @param[in] padAfterA Array of padding values after each dimension.
* @param[in] foldA Array of fold parameters per dimension.
* @param[in] direction Folding direction (fold or unfold).
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was configured successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnGetTensorTransformDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnSetTensorTransformDescriptor(cudnnTensorTransformDescriptor_t transformDesc,
const uint32_t nbDims,
const cudnnTensorFormat_t destFormat,
const int32_t padBeforeA[],
const int32_t padAfterA[],
const uint32_t foldA[],
const cudnnFoldingDirection_t direction);
/**
* @brief Retrieves the settings of a previously initialized tensor transform descriptor.
*
* @param[in] transformDesc Transform descriptor to query.
* @param[in] nbDimsRequested Number of dimensions to retrieve.
* @param[out] destFormat Destination tensor format.
* @param[out] padBeforeA Array to receive pre-padding values.
* @param[out] padAfterA Array to receive post-padding values.
* @param[out] foldA Array to receive fold parameters.
* @param[out] direction Folding direction.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetTensorTransformDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetTensorTransformDescriptor(cudnnTensorTransformDescriptor_t transformDesc,
uint32_t nbDimsRequested,
cudnnTensorFormat_t *destFormat,
int32_t padBeforeA[],
int32_t padAfterA[],
uint32_t foldA[],
cudnnFoldingDirection_t *direction);
/**
* @brief Destroys a tensor transform descriptor.
*
* Releases the resources associated with a tensor transform descriptor.
*
* @param[in] transformDesc Transform descriptor to destroy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was destroyed successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnCreateTensorTransformDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnDestroyTensorTransformDescriptor(cudnnTensorTransformDescriptor_t transformDesc);
/**
* @brief Copies and converts tensor data between layouts with alpha/beta blending.
*
* Performs y = alpha * x + beta * y, converting between tensor formats as needed.
*
* @param[in] handle cuDNN library handle.
* @param[in] alpha Scaling factor for the source tensor.
* @param[in] xDesc Source tensor descriptor.
* @param[in] x Pointer to source tensor data.
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] yDesc Destination tensor descriptor.
* @param[in,out] y Pointer to destination tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnTransformTensorEx
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnTransformTensor(cudnnHandle_t handle,
const void *alpha,
const cudnnTensorDescriptor_t xDesc,
const void *x,
const void *beta,
const cudnnTensorDescriptor_t yDesc,
void *y);
/**
* @brief Extended tensor transform with folding/padding support.
*
* Performs dest = alpha * transform(src) + beta * dest, using the specified
* transform descriptor for padding and folding configuration.
*
* @param[in] handle cuDNN library handle.
* @param[in] transDesc Transform descriptor specifying the operation.
* @param[in] alpha Scaling factor for the source tensor.
* @param[in] srcDesc Source tensor descriptor.
* @param[in] srcData Pointer to source tensor data.
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] destDesc Destination tensor descriptor.
* @param[in,out] destData Pointer to destination tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnTransformTensor, cudnnSetTensorTransformDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnTransformTensorEx(cudnnHandle_t handle,
const cudnnTensorTransformDescriptor_t transDesc,
const void *alpha,
const cudnnTensorDescriptor_t srcDesc,
const void *srcData,
const void *beta,
const cudnnTensorDescriptor_t destDesc,
void *destData);
/**
* @brief Adds a scaled bias tensor to a destination tensor with broadcasting.
*
* Performs C = alpha * A + beta * C, where A is broadcast to match C dimensions.
*
* @param[in] handle cuDNN library handle.
* @param[in] alpha Scaling factor for the bias tensor A.
* @param[in] aDesc Bias tensor descriptor.
* @param[in] A Pointer to bias tensor data.
* @param[in] beta Scaling factor for the destination tensor C.
* @param[in] cDesc Destination tensor descriptor.
* @param[in,out] C Pointer to destination tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnAddTensor(cudnnHandle_t handle,
const void *alpha,
const cudnnTensorDescriptor_t aDesc,
const void *A,
const void *beta,
const cudnnTensorDescriptor_t cDesc,
void *C);
/**
* @brief Enumerates the element-wise tensor operations supported by cudnnOpTensor.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_OP_TENSOR_ADD = 0, /**< Element-wise addition. @since cuDNN 9.0.0 */
CUDNN_OP_TENSOR_MUL = 1, /**< Element-wise multiplication. @since cuDNN 9.0.0 */
CUDNN_OP_TENSOR_MIN = 2, /**< Element-wise minimum. @since cuDNN 9.0.0 */
CUDNN_OP_TENSOR_MAX = 3, /**< Element-wise maximum. @since cuDNN 9.0.0 */
CUDNN_OP_TENSOR_SQRT = 4, /**< Element-wise square root (unary, B tensor ignored). @since cuDNN 9.0.0 */
CUDNN_OP_TENSOR_NOT = 5, /**< Element-wise logical NOT (unary, B tensor ignored). @since cuDNN 9.0.0 */
} cudnnOpTensorOp_t;
/**
* @brief Creates an op tensor descriptor.
*
* @param[out] opTensorDesc Pointer to the newly created op tensor descriptor.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was created successfully.
* @retval CUDNN_STATUS_ALLOC_FAILED Memory allocation failed.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnDestroyOpTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnCreateOpTensorDescriptor(cudnnOpTensorDescriptor_t *opTensorDesc);
/**
* @brief Configures an op tensor descriptor.
*
* @param[in,out] opTensorDesc Op tensor descriptor to configure.
* @param[in] opTensorOp Tensor operation to perform.
* @param[in] opTensorCompType Computation data type.
* @param[in] opTensorNanOpt NaN propagation policy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnGetOpTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnSetOpTensorDescriptor(cudnnOpTensorDescriptor_t opTensorDesc,
cudnnOpTensorOp_t opTensorOp,
cudnnDataType_t opTensorCompType,
cudnnNanPropagation_t opTensorNanOpt);
/**
* @brief Retrieves the settings of an op tensor descriptor.
*
* @param[in] opTensorDesc Op tensor descriptor to query.
* @param[out] opTensorOp Tensor operation type.
* @param[out] opTensorCompType Computation data type.
* @param[out] opTensorNanOpt NaN propagation policy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetOpTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetOpTensorDescriptor(const cudnnOpTensorDescriptor_t opTensorDesc,
cudnnOpTensorOp_t *opTensorOp,
cudnnDataType_t *opTensorCompType,
cudnnNanPropagation_t *opTensorNanOpt);
/**
* @brief Destroys an op tensor descriptor.
*
* @param[in] opTensorDesc Op tensor descriptor to destroy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was destroyed successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnCreateOpTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnDestroyOpTensorDescriptor(cudnnOpTensorDescriptor_t opTensorDesc);
/**
* @brief Performs element-wise tensor operations.
*
* Computes C = op(alpha1 * A, alpha2 * B) + beta * C. The B tensor is ignored
* for CUDNN_OP_TENSOR_SQRT and CUDNN_OP_TENSOR_NOT (unary operations).
*
* @param[in] handle cuDNN library handle.
* @param[in] opTensorDesc Op tensor descriptor specifying the operation.
* @param[in] alpha1 Scaling factor for tensor A.
* @param[in] aDesc Descriptor for tensor A.
* @param[in] A Pointer to tensor A data.
* @param[in] alpha2 Scaling factor for tensor B.
* @param[in] bDesc Descriptor for tensor B.
* @param[in] B Pointer to tensor B data.
* @param[in] beta Scaling factor for tensor C.
* @param[in] cDesc Descriptor for tensor C.
* @param[in,out] C Pointer to tensor C data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetOpTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnOpTensor(cudnnHandle_t handle,
const cudnnOpTensorDescriptor_t opTensorDesc,
const void *alpha1,
const cudnnTensorDescriptor_t aDesc,
const void *A,
const void *alpha2,
const cudnnTensorDescriptor_t bDesc,
const void *B,
const void *beta,
const cudnnTensorDescriptor_t cDesc,
void *C);
/**
* @brief Specifies whether indices are computed during a reduction operation.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_REDUCE_TENSOR_NO_INDICES = 0, /**< Do not compute indices. @since cuDNN 9.0.0 */
CUDNN_REDUCE_TENSOR_FLATTENED_INDICES = 1, /**< Compute flattened indices of min/max values. @since cuDNN 9.0.0 */
} cudnnReduceTensorIndices_t CUDNN_DEPRECATED;
/**
* @brief Data type used for reduction indices (all unsigned).
*
* Currently only 32-bit unsigned is fully supported; other sizes are reserved.
*
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_32BIT_INDICES = 0, /**< 32-bit unsigned indices. @since cuDNN 9.0.0 */
CUDNN_64BIT_INDICES = 1, /**< 64-bit unsigned indices. @since cuDNN 9.0.0 */
CUDNN_16BIT_INDICES = 2, /**< 16-bit unsigned indices. @since cuDNN 9.0.0 */
CUDNN_8BIT_INDICES = 3, /**< 8-bit unsigned indices. @since cuDNN 9.0.0 */
} cudnnIndicesType_t CUDNN_DEPRECATED;
/**
* @brief Creates a reduce tensor descriptor.
*
* @param[out] reduceTensorDesc Pointer to the newly created reduce tensor descriptor.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was created successfully.
* @retval CUDNN_STATUS_ALLOC_FAILED Memory allocation failed.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnDestroyReduceTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnCreateReduceTensorDescriptor(cudnnReduceTensorDescriptor_t *reduceTensorDesc);
/**
* @brief Configures a reduce tensor descriptor.
*
* @param[in,out] reduceTensorDesc Reduce tensor descriptor to configure.
* @param[in] reduceTensorOp Reduction operation to perform.
* @param[in] reduceTensorCompType Computation data type.
* @param[in] reduceTensorNanOpt NaN propagation policy (applies to min/max only).
* @param[in] reduceTensorIndices Whether to compute indices.
* @param[in] reduceTensorIndicesType Data type for computed indices.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnGetReduceTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnSetReduceTensorDescriptor(cudnnReduceTensorDescriptor_t reduceTensorDesc,
cudnnReduceTensorOp_t reduceTensorOp,
cudnnDataType_t reduceTensorCompType,
cudnnNanPropagation_t reduceTensorNanOpt,
cudnnReduceTensorIndices_t reduceTensorIndices,
cudnnIndicesType_t reduceTensorIndicesType);
/**
* @brief Retrieves the settings of a reduce tensor descriptor.
*
* @param[in] reduceTensorDesc Reduce tensor descriptor to query.
* @param[out] reduceTensorOp Reduction operation type.
* @param[out] reduceTensorCompType Computation data type.
* @param[out] reduceTensorNanOpt NaN propagation policy.
* @param[out] reduceTensorIndices Whether indices are computed.
* @param[out] reduceTensorIndicesType Data type for computed indices.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetReduceTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetReduceTensorDescriptor(const cudnnReduceTensorDescriptor_t reduceTensorDesc,
cudnnReduceTensorOp_t *reduceTensorOp,
cudnnDataType_t *reduceTensorCompType,
cudnnNanPropagation_t *reduceTensorNanOpt,
cudnnReduceTensorIndices_t *reduceTensorIndices,
cudnnIndicesType_t *reduceTensorIndicesType);
/**
* @brief Destroys a reduce tensor descriptor.
*
* @param[in] reduceTensorDesc Reduce tensor descriptor to destroy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was destroyed successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnCreateReduceTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnDestroyReduceTensorDescriptor(cudnnReduceTensorDescriptor_t reduceTensorDesc);
/**
* @brief Returns the minimum size of the index space for a reduction operation.
*
* @param[in] handle cuDNN library handle.
* @param[in] reduceTensorDesc Reduce tensor descriptor.
* @param[in] aDesc Input tensor descriptor.
* @param[in] cDesc Output tensor descriptor.
* @param[out] sizeInBytes Minimum index space size in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnReduceTensor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetReductionIndicesSize(cudnnHandle_t handle,
const cudnnReduceTensorDescriptor_t reduceTensorDesc,
const cudnnTensorDescriptor_t aDesc,
const cudnnTensorDescriptor_t cDesc,
size_t *sizeInBytes);
/**
* @brief Returns the minimum workspace size required for a reduction operation.
*
* @param[in] handle cuDNN library handle.
* @param[in] reduceTensorDesc Reduce tensor descriptor.
* @param[in] aDesc Input tensor descriptor.
* @param[in] cDesc Output tensor descriptor.
* @param[out] sizeInBytes Minimum workspace size in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnReduceTensor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetReductionWorkspaceSize(cudnnHandle_t handle,
const cudnnReduceTensorDescriptor_t reduceTensorDesc,
const cudnnTensorDescriptor_t aDesc,
const cudnnTensorDescriptor_t cDesc,
size_t *sizeInBytes);
/**
* @brief Performs a tensor reduction operation.
*
* Computes C = reduce_op(alpha * A) + beta * C. NaN propagation applies only
* to min and max operations. The indices space is ignored for operations other
* than min or max.
*
* @param[in] handle cuDNN library handle.
* @param[in] reduceTensorDesc Reduce tensor descriptor.
* @param[out] indices Pointer to index space (for min/max ops).
* @param[in] indicesSizeInBytes Size of the index space in bytes.
* @param[out] workspace Pointer to workspace memory.
* @param[in] workspaceSizeInBytes Size of the workspace in bytes.
* @param[in] alpha Scaling factor for the input tensor.
* @param[in] aDesc Input tensor descriptor.
* @param[in] A Pointer to input tensor data.
* @param[in] beta Scaling factor for the output tensor.
* @param[in] cDesc Output tensor descriptor.
* @param[in,out] C Pointer to output tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnGetReductionWorkspaceSize, cudnnGetReductionIndicesSize
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnReduceTensor(cudnnHandle_t handle,
const cudnnReduceTensorDescriptor_t reduceTensorDesc,
void *indices,
size_t indicesSizeInBytes,
void *workspace,
size_t workspaceSizeInBytes,
const void *alpha,
const cudnnTensorDescriptor_t aDesc,
const void *A,
const void *beta,
const cudnnTensorDescriptor_t cDesc,
void *C);
/**
* @brief Fills a tensor with a constant value.
*
* Sets every element of the tensor to the specified value: y[i] = value[0].
*
* @param[in] handle cuDNN library handle.
* @param[in] yDesc Tensor descriptor.
* @param[out] y Pointer to tensor data.
* @param[in] valuePtr Pointer to the fill value (type matches tensor data type).
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnScaleTensor
*/
cudnnStatus_t CUDNNWINAPI
cudnnSetTensor(cudnnHandle_t handle, const cudnnTensorDescriptor_t yDesc, void *y, const void *valuePtr);
/**
* @brief Scales all elements of a tensor by a constant factor.
*
* Performs y[i] = alpha * y[i] for every element.
*
* @param[in] handle cuDNN library handle.
* @param[in] yDesc Tensor descriptor.
* @param[in,out] y Pointer to tensor data.
* @param[in] alpha Scaling factor (type matches tensor computation type).
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetTensor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnScaleTensor(cudnnHandle_t handle, const cudnnTensorDescriptor_t yDesc, void *y, const void *alpha);
/**
* @brief Creates a filter descriptor.
*
* Allocates and initializes a new filter (convolution kernel) descriptor.
*
* @param[out] filterDesc Pointer to the newly created filter descriptor.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was created successfully.
* @retval CUDNN_STATUS_ALLOC_FAILED Memory allocation failed.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnDestroyFilterDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnCreateFilterDescriptor(cudnnFilterDescriptor_t *filterDesc);
/**
* @brief Sets a 4D filter descriptor.
*
* Initializes a filter descriptor with the specified data type, format, and dimensions.
*
* @param[in,out] filterDesc Filter descriptor to initialize.
* @param[in] dataType Data type of the filter elements.
* @param[in] format Memory layout format.
* @param[in] k Number of output feature maps.
* @param[in] c Number of input feature maps.
* @param[in] h Height of each filter.
* @param[in] w Width of each filter.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnGetFilter4dDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnSetFilter4dDescriptor(cudnnFilterDescriptor_t filterDesc,
cudnnDataType_t dataType, /* image data type */
cudnnTensorFormat_t format,
int k, /* number of output feature maps */
int c, /* number of input feature maps */
int h, /* height of each input filter */
int w); /* width of each input filter */
/**
* @brief Retrieves the settings of a 4D filter descriptor.
*
* @param[in] filterDesc Filter descriptor to query.
* @param[out] dataType Data type of the filter.
* @param[out] format Memory layout format.
* @param[out] k Number of output feature maps.
* @param[out] c Number of input feature maps.
* @param[out] h Height of each filter.
* @param[out] w Width of each filter.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetFilter4dDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetFilter4dDescriptor(const cudnnFilterDescriptor_t filterDesc,
cudnnDataType_t *dataType, /* image data type */
cudnnTensorFormat_t *format,
int *k, /* number of output feature maps */
int *c, /* number of input feature maps */
int *h, /* height of each input filter */
int *w); /* width of each input filter */
/**
* @brief Sets an N-dimensional filter descriptor.
*
* @param[in,out] filterDesc Filter descriptor to initialize.
* @param[in] dataType Data type of the filter elements.
* @param[in] format Memory layout format.
* @param[in] nbDims Number of dimensions.
* @param[in] filterDimA Array of filter dimension sizes (length nbDims).
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnGetFilterNdDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnSetFilterNdDescriptor(cudnnFilterDescriptor_t filterDesc,
cudnnDataType_t dataType, /* image data type */
cudnnTensorFormat_t format,
int nbDims,
const int filterDimA[]);
/**
* @brief Retrieves the settings of an N-dimensional filter descriptor.
*
* @param[in] filterDesc Filter descriptor to query.
* @param[in] nbDimsRequested Number of dimensions to retrieve.
* @param[out] dataType Data type of the filter.
* @param[out] format Memory layout format.
* @param[out] nbDims Actual number of dimensions.
* @param[out] filterDimA Array to receive dimension sizes.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetFilterNdDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetFilterNdDescriptor(const cudnnFilterDescriptor_t filterDesc,
int nbDimsRequested,
cudnnDataType_t *dataType, /* image data type */
cudnnTensorFormat_t *format,
int *nbDims,
int filterDimA[]);
/**
* @brief Returns the memory size in bytes required by a filter.
*
* @param[in] filterDesc Filter descriptor to query.
* @param[out] size Memory size in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetFilterSizeInBytes(const cudnnFilterDescriptor_t filterDesc, size_t *size);
/**
* @brief Transforms filter data between layouts.
*
* Converts filter data from one format to another using the specified transform descriptor.
*
* @param[in] handle cuDNN library handle.
* @param[in] transDesc Transform descriptor specifying the operation.
* @param[in] alpha Scaling factor for the source filter.
* @param[in] srcDesc Source filter descriptor.
* @param[in] srcData Pointer to source filter data.
* @param[in] beta Scaling factor for the destination filter.
* @param[in] destDesc Destination filter descriptor.
* @param[in,out] destData Pointer to destination filter data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnTransformTensorEx
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnTransformFilter(cudnnHandle_t handle,
const cudnnTensorTransformDescriptor_t transDesc,
const void *alpha,
const cudnnFilterDescriptor_t srcDesc,
const void *srcData,
const void *beta,
const cudnnFilterDescriptor_t destDesc,
void *destData);
/**
* @brief Destroys a filter descriptor.
*
* @param[in] filterDesc Filter descriptor to destroy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was destroyed successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnCreateFilterDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnDestroyFilterDescriptor(cudnnFilterDescriptor_t filterDesc);
/**
* @brief Selects the softmax implementation algorithm.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_SOFTMAX_FAST = 0, /**< Straightforward softmax without overflow protection. @since cuDNN 9.0.0 */
CUDNN_SOFTMAX_ACCURATE = 1, /**< Scales by max value to avoid floating-point overflow. @since cuDNN 9.0.0 */
CUDNN_SOFTMAX_LOG = 2 /**< Log-softmax with max-value scaling for overflow protection. @since cuDNN 9.0.0 */
} cudnnSoftmaxAlgorithm_t;
/**
* @brief Selects the scope over which the softmax computation is performed.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_SOFTMAX_MODE_INSTANCE = 0, /**< Compute softmax over all C, H, W for each image (N). @since cuDNN 9.0.0 */
CUDNN_SOFTMAX_MODE_CHANNEL = 1 /**< Compute softmax over channel (C) for each spatial location (H, W) and image (N). @since cuDNN 9.0.0 */
} cudnnSoftmaxMode_t;
/* Softmax functions: All of the form "output = alpha * Op(inputs) + beta * output" */
/**
* @brief Performs forward softmax computation.
*
* Computes y = alpha * softmax(x) + beta * y.
*
* @param[in] handle cuDNN library handle.
* @param[in] algo Softmax algorithm to use.
* @param[in] mode Softmax computation scope.
* @param[in] alpha Scaling factor for the result.
* @param[in] xDesc Input tensor descriptor.
* @param[in] x Pointer to input tensor data.
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] yDesc Output tensor descriptor.
* @param[in,out] y Pointer to output tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSoftmaxBackward
*/
cudnnStatus_t CUDNNWINAPI
cudnnSoftmaxForward(cudnnHandle_t handle,
cudnnSoftmaxAlgorithm_t algo,
cudnnSoftmaxMode_t mode,
const void *alpha,
const cudnnTensorDescriptor_t xDesc,
const void *x,
const void *beta,
const cudnnTensorDescriptor_t yDesc,
void *y);
/**
* @brief Selects the pooling method used in pooling operations.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_POOLING_MAX = 0, /**< Maximum value in the pooling window. @since cuDNN 9.0.0 */
CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING = 1, /**< Average pooling; element count includes padded positions. @since cuDNN 9.0.0 */
CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING = 2, /**< Average pooling; element count excludes padded positions. @since cuDNN 9.0.0 */
CUDNN_POOLING_MAX_DETERMINISTIC = 3 /**< Deterministic max pooling (reproducible results). @since cuDNN 9.0.0 */
} cudnnPoolingMode_t CUDNN_DEPRECATED;
/**
* @brief Creates a pooling descriptor.
*
* @param[out] poolingDesc Pointer to the newly created pooling descriptor.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was created successfully.
* @retval CUDNN_STATUS_ALLOC_FAILED Memory allocation failed.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnDestroyPoolingDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnCreatePoolingDescriptor(cudnnPoolingDescriptor_t *poolingDesc);
/**
* @brief Configures a 2D pooling descriptor.
*
* @param[in,out] poolingDesc Pooling descriptor to configure.
* @param[in] mode Pooling mode (max, average, etc.).
* @param[in] maxpoolingNanOpt NaN propagation policy for max pooling.
* @param[in] windowHeight Height of the pooling window.
* @param[in] windowWidth Width of the pooling window.
* @param[in] verticalPadding Vertical padding size.
* @param[in] horizontalPadding Horizontal padding size.
* @param[in] verticalStride Vertical stride.
* @param[in] horizontalStride Horizontal stride.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnGetPooling2dDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnSetPooling2dDescriptor(cudnnPoolingDescriptor_t poolingDesc,
cudnnPoolingMode_t mode,
cudnnNanPropagation_t maxpoolingNanOpt,
int windowHeight,
int windowWidth,
int verticalPadding,
int horizontalPadding,
int verticalStride,
int horizontalStride);
/**
* @brief Retrieves the settings of a 2D pooling descriptor.
*
* @param[in] poolingDesc Pooling descriptor to query.
* @param[out] mode Pooling mode.
* @param[out] maxpoolingNanOpt NaN propagation policy.
* @param[out] windowHeight Height of the pooling window.
* @param[out] windowWidth Width of the pooling window.
* @param[out] verticalPadding Vertical padding size.
* @param[out] horizontalPadding Horizontal padding size.
* @param[out] verticalStride Vertical stride.
* @param[out] horizontalStride Horizontal stride.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetPooling2dDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetPooling2dDescriptor(const cudnnPoolingDescriptor_t poolingDesc,
cudnnPoolingMode_t *mode,
cudnnNanPropagation_t *maxpoolingNanOpt,
int *windowHeight,
int *windowWidth,
int *verticalPadding,
int *horizontalPadding,
int *verticalStride,
int *horizontalStride);
/**
* @brief Configures an N-dimensional pooling descriptor.
*
* @param[in,out] poolingDesc Pooling descriptor to configure.
* @param[in] mode Pooling mode.
* @param[in] maxpoolingNanOpt NaN propagation policy for max pooling.
* @param[in] nbDims Number of dimensions.
* @param[in] windowDimA Array of pooling window sizes (length nbDims).
* @param[in] paddingA Array of padding sizes (length nbDims).
* @param[in] strideA Array of strides (length nbDims).
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnGetPoolingNdDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnSetPoolingNdDescriptor(cudnnPoolingDescriptor_t poolingDesc,
const cudnnPoolingMode_t mode,
const cudnnNanPropagation_t maxpoolingNanOpt,
int nbDims,
const int windowDimA[],
const int paddingA[],
const int strideA[]);
/**
* @brief Retrieves the settings of an N-dimensional pooling descriptor.
*
* @param[in] poolingDesc Pooling descriptor to query.
* @param[in] nbDimsRequested Number of dimensions to retrieve.
* @param[out] mode Pooling mode.
* @param[out] maxpoolingNanOpt NaN propagation policy.
* @param[out] nbDims Actual number of dimensions.
* @param[out] windowDimA Array to receive window sizes.
* @param[out] paddingA Array to receive padding sizes.
* @param[out] strideA Array to receive strides.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetPoolingNdDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetPoolingNdDescriptor(const cudnnPoolingDescriptor_t poolingDesc,
int nbDimsRequested,
cudnnPoolingMode_t *mode,
cudnnNanPropagation_t *maxpoolingNanOpt,
int *nbDims,
int windowDimA[],
int paddingA[],
int strideA[]);
/**
* @brief Computes the output dimensions of an N-dimensional pooling operation.
*
* @param[in] poolingDesc Pooling descriptor.
* @param[in] inputTensorDesc Input tensor descriptor.
* @param[in] nbDims Number of dimensions.
* @param[out] outputTensorDimA Array to receive output dimension sizes.
*
* @retval CUDNN_STATUS_SUCCESS The dimensions were computed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetPoolingNdForwardOutputDim(const cudnnPoolingDescriptor_t poolingDesc,
const cudnnTensorDescriptor_t inputTensorDesc,
int nbDims,
int outputTensorDimA[]);
/**
* @brief Computes the output dimensions of a 2D pooling operation.
*
* @param[in] poolingDesc Pooling descriptor.
* @param[in] inputTensorDesc Input tensor descriptor.
* @param[out] n Output batch size.
* @param[out] c Output number of channels.
* @param[out] h Output height.
* @param[out] w Output width.
*
* @retval CUDNN_STATUS_SUCCESS The dimensions were computed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetPooling2dForwardOutputDim(const cudnnPoolingDescriptor_t poolingDesc,
const cudnnTensorDescriptor_t inputTensorDesc,
int *n,
int *c,
int *h,
int *w);
/**
* @brief Destroys a pooling descriptor.
*
* @param[in] poolingDesc Pooling descriptor to destroy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was destroyed successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnCreatePoolingDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnDestroyPoolingDescriptor(cudnnPoolingDescriptor_t poolingDesc);
/* Pooling functions: All of the form "output = alpha * Op(inputs) + beta * output" */
/**
* @brief Performs forward pooling.
*
* Computes y = alpha * pool(x) + beta * y.
*
* @param[in] handle cuDNN library handle.
* @param[in] poolingDesc Pooling descriptor.
* @param[in] alpha Scaling factor for the pooling result.
* @param[in] xDesc Input tensor descriptor.
* @param[in] x Pointer to input tensor data.
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] yDesc Output tensor descriptor.
* @param[in,out] y Pointer to output tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnPoolingBackward
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnPoolingForward(cudnnHandle_t handle,
const cudnnPoolingDescriptor_t poolingDesc,
const void *alpha,
const cudnnTensorDescriptor_t xDesc,
const void *x,
const void *beta,
const cudnnTensorDescriptor_t yDesc,
void *y);
/* Activation functions: All of the form "output = alpha * Op(inputs) + beta * output" */
/**
* @brief Creates an activation descriptor.
*
* @param[out] activationDesc Pointer to the newly created activation descriptor.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was created successfully.
* @retval CUDNN_STATUS_ALLOC_FAILED Memory allocation failed.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnDestroyActivationDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnCreateActivationDescriptor(cudnnActivationDescriptor_t *activationDesc);
/**
* @brief Configures an activation descriptor.
*
* @param[in,out] activationDesc Activation descriptor to configure.
* @param[in] mode Activation function type.
* @param[in] reluNanOpt NaN propagation policy for ReLU.
* @param[in] coef Ceiling for clipped ReLU, or alpha for ELU.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnGetActivationDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnSetActivationDescriptor(cudnnActivationDescriptor_t activationDesc,
cudnnActivationMode_t mode,
cudnnNanPropagation_t reluNanOpt,
double coef); /* ceiling for clipped RELU, alpha for ELU */
/**
* @brief Retrieves the settings of an activation descriptor.
*
* @param[in] activationDesc Activation descriptor to query.
* @param[out] mode Activation function type.
* @param[out] reluNanOpt NaN propagation policy.
* @param[out] coef Ceiling for clipped ReLU, or alpha for ELU.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetActivationDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetActivationDescriptor(const cudnnActivationDescriptor_t activationDesc,
cudnnActivationMode_t *mode,
cudnnNanPropagation_t *reluNanOpt,
double *coef); /* ceiling for clipped RELU, alpha for ELU */
/**
* @brief Sets the beta parameter for Swish activation.
*
* @param[in,out] activationDesc Activation descriptor to modify.
* @param[in] swish_beta Beta value for the Swish activation function.
*
* @retval CUDNN_STATUS_SUCCESS The parameter was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnGetActivationDescriptorSwishBeta
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnSetActivationDescriptorSwishBeta(cudnnActivationDescriptor_t activationDesc, double swish_beta);
/**
* @brief Retrieves the beta parameter for Swish activation.
*
* @param[in] activationDesc Activation descriptor to query.
* @param[out] swish_beta Beta value for the Swish activation function.
*
* @retval CUDNN_STATUS_SUCCESS The parameter was retrieved successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnSetActivationDescriptorSwishBeta
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetActivationDescriptorSwishBeta(cudnnActivationDescriptor_t activationDesc, double *swish_beta);
/**
* @brief Destroys an activation descriptor.
*
* @param[in] activationDesc Activation descriptor to destroy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was destroyed successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnCreateActivationDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnDestroyActivationDescriptor(cudnnActivationDescriptor_t activationDesc);
/**
* @brief Performs forward activation.
*
* Computes y = alpha * activation(x) + beta * y.
*
* @param[in] handle cuDNN library handle.
* @param[in] activationDesc Activation descriptor.
* @param[in] alpha Scaling factor for the activation result.
* @param[in] xDesc Input tensor descriptor.
* @param[in] x Pointer to input tensor data.
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] yDesc Output tensor descriptor.
* @param[in,out] y Pointer to output tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnActivationBackward
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnActivationForward(cudnnHandle_t handle,
cudnnActivationDescriptor_t activationDesc,
const void *alpha,
const cudnnTensorDescriptor_t xDesc,
const void *x,
const void *beta,
const cudnnTensorDescriptor_t yDesc,
void *y);
/**
* @brief Creates a Local Response Normalization (LRN) descriptor.
*
* Uses lrnN=5, lrnAlpha=1e-4, lrnBeta=0.75, lrnK=2.0 as defaults from
* Krizhevsky'12 ImageNet paper.
*
* @param[out] normDesc Pointer to the newly created LRN descriptor.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was created successfully.
* @retval CUDNN_STATUS_ALLOC_FAILED Memory allocation failed.
*
* @since cuDNN 9.0.0
* @see cudnnDestroyLRNDescriptor, cudnnSetLRNDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnCreateLRNDescriptor(cudnnLRNDescriptor_t *normDesc);
#define CUDNN_LRN_MIN_N 1 /* minimum allowed lrnN */
#define CUDNN_LRN_MAX_N 16 /* maximum allowed lrnN */
#define CUDNN_LRN_MIN_K 1e-5 /* minimum allowed lrnK */
#define CUDNN_LRN_MIN_BETA 0.01 /* minimum allowed lrnBeta */
/**
* @brief Selects the Local Response Normalization (LRN) mode.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_LRN_CROSS_CHANNEL_DIM1 = 0, /**< LRN computed across tensor dimension dimA[1]. @since cuDNN 9.0.0 */
} cudnnLRNMode_t;
/**
* @brief Configures an LRN descriptor.
*
* Uses a window [center-lookBehind, center+lookAhead], where
* lookBehind = floor((lrnN-1)/2), lookAhead = lrnN-lookBehind-1.
* Values of double parameters are cast to the tensor data type.
*
* @param[in,out] normDesc LRN descriptor to configure.
* @param[in] lrnN Normalization window size (must be in [CUDNN_LRN_MIN_N, CUDNN_LRN_MAX_N]).
* @param[in] lrnAlpha Alpha parameter (must be >= CUDNN_LRN_MIN_K).
* @param[in] lrnBeta Beta parameter (must be >= CUDNN_LRN_MIN_BETA).
* @param[in] lrnK K parameter.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnGetLRNDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnSetLRNDescriptor(cudnnLRNDescriptor_t normDesc, unsigned lrnN, double lrnAlpha, double lrnBeta, double lrnK);
/**
* @brief Retrieves the settings of an LRN descriptor.
*
* Any of the output pointers can be NULL (the corresponding value will not be returned).
*
* @param[in] normDesc LRN descriptor to query.
* @param[out] lrnN Normalization window size.
* @param[out] lrnAlpha Alpha parameter.
* @param[out] lrnBeta Beta parameter.
* @param[out] lrnK K parameter.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @see cudnnSetLRNDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnGetLRNDescriptor(cudnnLRNDescriptor_t normDesc, unsigned *lrnN, double *lrnAlpha, double *lrnBeta, double *lrnK);
/**
* @brief Destroys an LRN descriptor.
*
* @param[in] lrnDesc LRN descriptor to destroy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was destroyed successfully.
*
* @since cuDNN 9.0.0
* @see cudnnCreateLRNDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnDestroyLRNDescriptor(cudnnLRNDescriptor_t lrnDesc);
/* LRN functions: output = alpha * normalize(x) + beta * old_y */
/**
* @brief Performs forward LRN cross-channel normalization.
*
* Computes y = alpha * normalize(x) + beta * y. Double parameters are cast
* to the tensor data type.
*
* @param[in] handle cuDNN library handle.
* @param[in] normDesc LRN descriptor.
* @param[in] lrnMode LRN mode.
* @param[in] alpha Scaling factor for the normalization result.
* @param[in] xDesc Input tensor descriptor.
* @param[in] x Pointer to input tensor data.
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] yDesc Output tensor descriptor.
* @param[in,out] y Pointer to output tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnLRNCrossChannelBackward
*/
cudnnStatus_t CUDNNWINAPI
cudnnLRNCrossChannelForward(cudnnHandle_t handle,
cudnnLRNDescriptor_t normDesc,
cudnnLRNMode_t lrnMode,
const void *alpha,
const cudnnTensorDescriptor_t xDesc,
const void *x,
const void *beta,
const cudnnTensorDescriptor_t yDesc,
void *y);
/**
* @brief Selects the divisive normalization mode.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_DIVNORM_PRECOMPUTED_MEANS = 0, /**< Use precomputed means for divisive normalization. @since cuDNN 9.0.0 */
} cudnnDivNormMode_t;
/**
* @brief Performs forward divisive normalization.
*
* Computes y = alpha * normalize(x) + beta * y. If means is NULL, means are
* assumed to be zero. The xDesc is used for means, temp, and temp2 as well.
*
* @param[in] handle cuDNN library handle.
* @param[in] normDesc LRN descriptor (shared with LRN functions).
* @param[in] mode Divisive normalization mode.
* @param[in] alpha Scaling factor for the normalization result.
* @param[in] xDesc Input tensor descriptor (also used for means, temp, temp2).
* @param[in] x Pointer to input tensor data.
* @param[in] means Pointer to means tensor data (NULL for zero means).
* @param[out] temp Temporary workspace tensor.
* @param[out] temp2 Temporary workspace tensor.
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] yDesc Output tensor descriptor.
* @param[in,out] y Pointer to output tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnDivisiveNormalizationBackward
*/
cudnnStatus_t CUDNNWINAPI
cudnnDivisiveNormalizationForward(cudnnHandle_t handle,
cudnnLRNDescriptor_t normDesc,
cudnnDivNormMode_t mode,
const void *alpha,
const cudnnTensorDescriptor_t xDesc, /* same desc for means, temp, temp2 */
const void *x,
const void *means, /* if NULL, means are assumed to be zero */
void *temp,
void *temp2,
const void *beta,
const cudnnTensorDescriptor_t yDesc,
void *y);
/**
* @brief Selects the batch normalization mode.
* @since cuDNN 9.0.0
*/
typedef enum {
/** @brief Per-activation: bnScale/bnBias dims are 1xCxHxWx.. (normalized over N). @since cuDNN 9.0.0 */
CUDNN_BATCHNORM_PER_ACTIVATION = 0, /**< Per-activation: bnScale/bnBias shape 1xCxHxW, normalized over N. @since cuDNN 9.0.0 */
/** @brief Spatial: bnScale/bnBias dims are 1xCx1x1 (normalized over NxHxW). @since cuDNN 9.0.0 */
CUDNN_BATCHNORM_SPATIAL = 1, /**< Spatial: bnScale/bnBias shape 1xCx1x1, normalized over N+spatial dims. @since cuDNN 9.0.0 */
/**
* @brief Spatial persistent: same as SPATIAL but may be faster with limits on value range.
* @since cuDNN 9.0.0
*/
CUDNN_BATCHNORM_SPATIAL_PERSISTENT = 2, /**< Like SPATIAL but faster via scaled atomic int reduction. NCHW, CC>=6.0. @since cuDNN 9.0.0 */
} cudnnBatchNormMode_t CUDNN_DEPRECATED;
#define CUDNN_BN_MIN_EPSILON 0.0 /* Minimum epsilon allowed to be used in the Batch Normalization formula */
/**
* @brief Derives a tensor descriptor for batch normalization parameters.
*
* Computes the dimensions for bnScale, bnBias, mean, and variance tensors based
* on the input tensor descriptor and batch normalization mode. Use this for
* bnScaleBiasMeanVarDesc and bnScaleBiasDiffDesc parameters.
*
* @param[in,out] derivedBnDesc Tensor descriptor to be derived.
* @param[in] xDesc Input tensor descriptor.
* @param[in] mode Batch normalization mode.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was derived successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnBatchNormalizationForwardTraining
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnDeriveBNTensorDescriptor(cudnnTensorDescriptor_t derivedBnDesc,
const cudnnTensorDescriptor_t xDesc,
cudnnBatchNormMode_t mode);
/**
* @brief Selects the extended batch normalization operation mode.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_BATCHNORM_OPS_BN = 0, /**< Batch normalization only. @since cuDNN 9.0.0 */
CUDNN_BATCHNORM_OPS_BN_ACTIVATION = 1, /**< Batch normalization followed by activation. @since cuDNN 9.0.0 */
CUDNN_BATCHNORM_OPS_BN_ADD_ACTIVATION = 2, /**< Batch normalization, element-wise add, then activation. @since cuDNN 9.0.0 */
} cudnnBatchNormOps_t CUDNN_DEPRECATED;
/**
* @brief Performs batch normalization during inference.
*
* Computes y[i] = bnScale[k]*(x[i]-estimatedMean[k])/sqrt(epsilon+estimatedVariance[k]) + bnBias[k],
* with tensors indexed according to spatial or per-activation mode.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Batch normalization mode.
* @param[in] alpha Result blend factor.
* @param[in] beta Destination layer blend factor.
* @param[in] xDesc Input tensor descriptor.
* @param[in] x Pointer to input tensor data (NxCxHxW).
* @param[in] yDesc Output tensor descriptor.
* @param[in,out] y Pointer to output tensor data (NxCxHxW).
* @param[in] bnScaleBiasMeanVarDesc Descriptor for scale, bias, mean, variance tensors.
* @param[in] bnScale Pointer to scale (gamma) tensor data.
* @param[in] bnBias Pointer to bias (beta) tensor data.
* @param[in] estimatedMean Pointer to running mean tensor data.
* @param[in] estimatedVariance Pointer to running variance tensor data.
* @param[in] epsilon Epsilon value (must be >= CUDNN_BN_MIN_EPSILON).
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnBatchNormalizationForwardTraining, cudnnDeriveBNTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnBatchNormalizationForwardInference(cudnnHandle_t handle,
cudnnBatchNormMode_t mode,
const void *alpha, /* alpha[0] = result blend factor */
const void *beta, /* beta[0] = dest layer blend factor */
const cudnnTensorDescriptor_t xDesc,
const void *x, /* NxCxHxW */
const cudnnTensorDescriptor_t yDesc,
void *y, /* NxCxHxW */
const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
const void *bnScale,
const void *bnBias,
const void *estimatedMean,
const void *estimatedVariance,
double epsilon);
/**
* @brief Selects the normalization mode.
* @since cuDNN 9.0.0
*/
typedef enum {
/** @brief Per-activation: normScale/normBias dims are 1xCxHxWx.. (normalized over N). @since cuDNN 9.0.0 */
CUDNN_NORM_PER_ACTIVATION = 0, /**< Norm per activation. @since cuDNN 9.0.0 */
/** @brief Per-channel: normScale/normBias dims are 1xCx1x1 (normalized over NxHxW). @since cuDNN 9.0.0 */
CUDNN_NORM_PER_CHANNEL = 1, /**< Norm per channel. @since cuDNN 9.0.0 */
} cudnnNormMode_t CUDNN_DEPRECATED;
/**
* @brief Selects the normalization algorithm.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_NORM_ALGO_STANDARD = 0, /**< Standard normalization algorithm. @since cuDNN UNPUBLISHED */
CUDNN_NORM_ALGO_PERSIST = 1 /**< Persistent normalization (requires compute capability 6.0+). @since cuDNN UNPUBLISHED */
} cudnnNormAlgo_t CUDNN_DEPRECATED;
/**
* @brief Derives tensor descriptors for normalization parameters.
*
* Computes the dimensions for normScale, normBias, mean, and variance tensors based
* on the input tensor descriptor and normalization mode.
*
* @param[in,out] derivedNormScaleBiasDesc Descriptor to be derived for scale/bias tensors.
* @param[in,out] derivedNormMeanVarDesc Descriptor to be derived for mean/variance tensors.
* @param[in] xDesc Input tensor descriptor.
* @param[in] mode Normalization mode.
* @param[in] groupCnt Group count (reserved, should be set to 1).
*
* @retval CUDNN_STATUS_SUCCESS The descriptors were derived successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnNormalizationForwardTraining
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnDeriveNormTensorDescriptor(cudnnTensorDescriptor_t derivedNormScaleBiasDesc,
cudnnTensorDescriptor_t derivedNormMeanVarDesc,
const cudnnTensorDescriptor_t xDesc,
cudnnNormMode_t mode,
int groupCnt); /* Place hold for future work, should be set to 1 now*/
/**
* @brief Selects the extended normalization operation mode.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_NORM_OPS_NORM = 0, /**< Normalization only. @since cuDNN 9.0.0 */
CUDNN_NORM_OPS_NORM_ACTIVATION = 1, /**< Normalization followed by activation. @since cuDNN 9.0.0 */
CUDNN_NORM_OPS_NORM_ADD_ACTIVATION = 2, /**< Normalization, element-wise add, then activation. @since cuDNN 9.0.0 */
} cudnnNormOps_t CUDNN_DEPRECATED;
/**
* @brief Performs normalization during inference.
*
* Computes y[i] = normScale[k]*(x[i]-estimatedMean[k])/sqrt(epsilon+estimatedVariance[k]) + normBias[k],
* with tensors indexed according to per-channel or per-activation mode.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Normalization mode.
* @param[in] normOps Extended normalization operation mode.
* @param[in] algo Normalization algorithm.
* @param[in] alpha Result blend factor.
* @param[in] beta Destination layer blend factor.
* @param[in] xDesc Input tensor descriptor.
* @param[in] x Pointer to input tensor data (NxCxHxW).
* @param[in] normScaleBiasDesc Descriptor for normalization scale/bias tensors.
* @param[in] normScale Pointer to normalization scale tensor data.
* @param[in] normBias Pointer to normalization bias tensor data.
* @param[in] normMeanVarDesc Descriptor for mean/variance tensors.
* @param[in] estimatedMean Pointer to running mean tensor data.
* @param[in] estimatedVariance Pointer to running variance tensor data.
* @param[in] zDesc Descriptor for z tensor (used with add operations).
* @param[in] z Pointer to z tensor data.
* @param[in] activationDesc Activation descriptor (used with activation operations).
* @param[in] yDesc Output tensor descriptor.
* @param[in,out] y Pointer to output tensor data (NxCxHxW).
* @param[in] epsilon Epsilon value (must be >= 0).
* @param[in] groupCnt Group count (reserved, should be set to 1).
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnNormalizationForwardTraining, cudnnDeriveNormTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnNormalizationForwardInference(cudnnHandle_t handle,
cudnnNormMode_t mode,
cudnnNormOps_t normOps,
cudnnNormAlgo_t algo,
const void *alpha, /* alpha[0] = result blend factor */
const void *beta, /* beta[0] = dest layer blend factor */
const cudnnTensorDescriptor_t xDesc,
const void *x, /* NxCxHxW */
const cudnnTensorDescriptor_t normScaleBiasDesc,
const void *normScale,
const void *normBias,
const cudnnTensorDescriptor_t normMeanVarDesc,
const void *estimatedMean,
const void *estimatedVariance,
const cudnnTensorDescriptor_t zDesc,
const void *z,
cudnnActivationDescriptor_t activationDesc,
const cudnnTensorDescriptor_t yDesc,
void *y, /* NxCxHxW */
double epsilon,
int groupCnt); /* Place hold for future work*/
/* APIs for spatial transformer network*/
/**
* @brief Selects the spatial sampler type for spatial transformer networks.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_SAMPLER_BILINEAR = 0, /**< Bilinear sampler. @since cuDNN 9.0.0 */
} cudnnSamplerType_t;
/**
* @brief Creates a spatial transformer descriptor.
*
* @param[out] stDesc Pointer to the newly created spatial transformer descriptor.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was created successfully.
* @retval CUDNN_STATUS_ALLOC_FAILED Memory allocation failed.
*
* @since cuDNN 9.0.0
* @see cudnnDestroySpatialTransformerDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnCreateSpatialTransformerDescriptor(cudnnSpatialTransformerDescriptor_t *stDesc);
/**
* @brief Configures an N-dimensional spatial transformer descriptor.
*
* @param[in,out] stDesc Spatial transformer descriptor to configure.
* @param[in] samplerType Type of sampler to use.
* @param[in] dataType Data type of the tensors.
* @param[in] nbDims Number of dimensions.
* @param[in] dimA Array of dimension sizes (length nbDims).
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was set successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSpatialTfGridGeneratorForward, cudnnSpatialTfSamplerForward
*/
cudnnStatus_t CUDNNWINAPI
cudnnSetSpatialTransformerNdDescriptor(cudnnSpatialTransformerDescriptor_t stDesc,
cudnnSamplerType_t samplerType,
cudnnDataType_t dataType,
const int nbDims,
const int dimA[]);
/**
* @brief Destroys a spatial transformer descriptor.
*
* @param[in] stDesc Spatial transformer descriptor to destroy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was destroyed successfully.
*
* @since cuDNN 9.0.0
* @see cudnnCreateSpatialTransformerDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnDestroySpatialTransformerDescriptor(cudnnSpatialTransformerDescriptor_t stDesc);
/**
* @brief Generates a sampling grid for a spatial transformer (forward).
*
* Generates a grid of sampling coordinates from the affine transformation matrix theta.
*
* @param[in] handle cuDNN library handle.
* @param[in] stDesc Spatial transformer descriptor.
* @param[in] theta Pointer to affine transformation matrices.
* @param[out] grid Pointer to output sampling grid data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSpatialTfGridGeneratorBackward
*/
cudnnStatus_t CUDNNWINAPI
cudnnSpatialTfGridGeneratorForward(cudnnHandle_t handle,
const cudnnSpatialTransformerDescriptor_t stDesc,
const void *theta,
void *grid);
/**
* @brief Performs spatial transformer sampling (forward).
*
* Samples the input tensor at the grid coordinates to produce the output tensor.
*
* @param[in] handle cuDNN library handle.
* @param[in] stDesc Spatial transformer descriptor.
* @param[in] alpha Scaling factor for the sampled result.
* @param[in] xDesc Input tensor descriptor.
* @param[in] x Pointer to input tensor data.
* @param[in] grid Pointer to sampling grid data.
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] yDesc Output tensor descriptor.
* @param[in,out] y Pointer to output tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSpatialTfSamplerBackward
*/
cudnnStatus_t CUDNNWINAPI
cudnnSpatialTfSamplerForward(cudnnHandle_t handle,
cudnnSpatialTransformerDescriptor_t stDesc,
const void *alpha,
const cudnnTensorDescriptor_t xDesc,
const void *x,
const void *grid,
const void *beta,
cudnnTensorDescriptor_t yDesc,
void *y);
/** @brief Opaque descriptor for dropout operations. @since cuDNN 9.0.0 */
typedef struct cudnnDropoutStruct *cudnnDropoutDescriptor_t;
/**
* @brief Creates a dropout descriptor.
*
* @param[out] dropoutDesc Pointer to the newly created dropout descriptor.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was created successfully.
* @retval CUDNN_STATUS_ALLOC_FAILED Memory allocation failed.
*
* @since cuDNN 9.0.0
* @see cudnnDestroyDropoutDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnCreateDropoutDescriptor(cudnnDropoutDescriptor_t *dropoutDesc);
/**
* @brief Destroys a dropout descriptor.
*
* @param[in] dropoutDesc Dropout descriptor to destroy.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was destroyed successfully.
*
* @since cuDNN 9.0.0
* @see cudnnCreateDropoutDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnDestroyDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc);
/**
* @brief Returns the size of the states buffer required for dropout.
*
* @param[in] handle cuDNN library handle.
* @param[out] sizeInBytes Size of the required states buffer in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @see cudnnSetDropoutDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnDropoutGetStatesSize(cudnnHandle_t handle, size_t *sizeInBytes);
/**
* @brief Returns the size of the reserve space required for dropout forward/backward.
*
* @param[in] xdesc Input tensor descriptor.
* @param[out] sizeInBytes Size of the required reserve space in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @see cudnnDropoutForward, cudnnDropoutBackward
*/
cudnnStatus_t CUDNNWINAPI
cudnnDropoutGetReserveSpaceSize(cudnnTensorDescriptor_t xdesc, size_t *sizeInBytes);
/**
* @brief Configures a dropout descriptor and initializes random state.
*
* @param[in,out] dropoutDesc Dropout descriptor to configure.
* @param[in] handle cuDNN library handle.
* @param[in] dropout Probability of dropping (0 = no dropout, 1 = all dropped).
* @param[in,out] states Pointer to device memory for RNG state storage.
* @param[in] stateSizeInBytes Size of the states buffer in bytes.
* @param[in] seed Seed for the random number generator.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was configured successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnGetDropoutDescriptor, cudnnRestoreDropoutDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnSetDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc,
cudnnHandle_t handle,
float dropout,
void *states,
size_t stateSizeInBytes,
unsigned long long seed);
/**
* @brief Restores a dropout descriptor to a previously saved state.
*
* @param[in,out] dropoutDesc Dropout descriptor to restore.
* @param[in] handle cuDNN library handle.
* @param[in] dropout Dropout probability.
* @param[in] states Pointer to previously saved RNG state.
* @param[in] stateSizeInBytes Size of the states buffer in bytes.
* @param[in] seed Seed used to initialize the original state.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was restored successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSetDropoutDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnRestoreDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc,
cudnnHandle_t handle,
float dropout,
void *states,
size_t stateSizeInBytes,
unsigned long long seed);
/**
* @brief Retrieves the settings of a dropout descriptor.
*
* @param[in] dropoutDesc Dropout descriptor to query.
* @param[in] handle cuDNN library handle.
* @param[out] dropout Dropout probability.
* @param[out] states Pointer to RNG state memory.
* @param[out] seed Seed used for the RNG.
*
* @retval CUDNN_STATUS_SUCCESS The descriptor was queried successfully.
*
* @since cuDNN 9.0.0
* @see cudnnSetDropoutDescriptor
*/
cudnnStatus_t CUDNNWINAPI
cudnnGetDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc,
cudnnHandle_t handle,
float *dropout,
void **states,
unsigned long long *seed);
/**
* @brief Performs forward dropout.
*
* Randomly sets elements to zero based on the dropout probability. The reserve
* space stores the mask for use in the backward pass.
*
* @param[in] handle cuDNN library handle.
* @param[in] dropoutDesc Dropout descriptor.
* @param[in] xdesc Input tensor descriptor.
* @param[in] x Pointer to input tensor data.
* @param[in] ydesc Output tensor descriptor.
* @param[out] y Pointer to output tensor data.
* @param[out] reserveSpace Pointer to reserve space for the dropout mask.
* @param[in] reserveSpaceSizeInBytes Size of reserve space in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnDropoutBackward, cudnnDropoutGetReserveSpaceSize
*/
cudnnStatus_t CUDNNWINAPI
cudnnDropoutForward(cudnnHandle_t handle,
const cudnnDropoutDescriptor_t dropoutDesc,
const cudnnTensorDescriptor_t xdesc,
const void *x,
const cudnnTensorDescriptor_t ydesc,
void *y,
void *reserveSpace,
size_t reserveSpaceSizeInBytes);
/* TODO: move these enums out to the appropriate submodule */
/**
* @brief Enumerates convolution forward algorithms.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM = 0, /**< Implicit GEMM: matrix product without forming input matrix. No extra workspace. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM = 1, /**< Implicit GEMM with precomputed indices. Needs workspace for index precomputation. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_FWD_ALGO_GEMM = 2, /**< Explicit GEMM: forms input matrix explicitly. Requires significant workspace. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_FWD_ALGO_DIRECT = 3, /**< Direct convolution without matrix multiplication. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_FWD_ALGO_FFT = 4, /**< FFT-based convolution. Requires significant workspace. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING = 5, /**< FFT with tiled inputs. Significant workspace but less than FFT for large inputs. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD = 6, /**< Winograd transform. Moderate workspace. Not supported on Hopper+. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED = 7, /**< Winograd non-fused variant. May require significant workspace. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_FWD_ALGO_COUNT = 8 /**< Number of forward convolution algorithms. @since cuDNN 9.0.0 */
} cudnnConvolutionFwdAlgo_t;
/**
* @brief Enumerates convolution backward filter algorithms.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0 = 0, /**< Sum of matrix products with atomic adds. Non-deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1 = 1, /**< Implicit GEMM without forming input matrix. Deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT = 2, /**< FFT-based. Significant workspace. Deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3 = 3, /**< Like ALGO_0 with precomputed indices. Non-deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD = 4, /**< Winograd transform (not implemented). @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED = 5, /**< Winograd non-fused. Significant workspace. Deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING = 6, /**< FFT with tiling. Significant workspace. Deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT = 7 /**< Number of backward filter algorithms. @since cuDNN 9.0.0 */
} cudnnConvolutionBwdFilterAlgo_t;
/**
* @brief Enumerates convolution backward data algorithms.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_CONVOLUTION_BWD_DATA_ALGO_0 = 0, /**< Sum of matrix products with atomic adds. Non-deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_DATA_ALGO_1 = 1, /**< Implicit GEMM without forming input matrix. Deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT = 2, /**< FFT-based. Significant workspace. Deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING = 3, /**< FFT with tiling. Significant workspace. Deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD = 4, /**< Winograd transform. Moderate workspace. Deterministic. Not on Hopper+. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD_NONFUSED = 5, /**< Winograd non-fused. Significant workspace. Deterministic. @since cuDNN 9.0.0 */
CUDNN_CONVOLUTION_BWD_DATA_ALGO_COUNT = 6 /**< Number of backward data algorithms. @since cuDNN 9.0.0 */
} cudnnConvolutionBwdDataAlgo_t;
/**
* @brief Enumerates CTC loss computation algorithms.
* @since cuDNN 9.0.0
*/
typedef enum {
CUDNN_CTC_LOSS_ALGO_DETERMINISTIC = 0, /**< Deterministic CTC loss. @since cuDNN UNPUBLISHED */
CUDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC = 1 /**< Non-deterministic CTC loss. @since cuDNN UNPUBLISHED */
} cudnnCTCLossAlgo_t;
/**
* @brief Cross-library version checker for the ops sub-library.
*
* This function is implemented differently in each sub-library. Each sub-library
* checks whether its own version matches that of its dependencies.
*
* @retval CUDNN_STATUS_SUCCESS The version check passed.
* @retval CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH The versions are inconsistent.
*
* @since cuDNN 9.0.0
*/
cudnnStatus_t CUDNNWINAPI
cudnnOpsVersionCheck(void);
/**
* @brief Performs backward softmax computation.
*
* Computes the gradient of the softmax function.
*
* @param[in] handle cuDNN library handle.
* @param[in] algo Softmax algorithm used in the forward pass.
* @param[in] mode Softmax computation scope.
* @param[in] alpha Scaling factor for the result.
* @param[in] yDesc Output tensor descriptor (from forward pass).
* @param[in] y Pointer to output tensor data (from forward pass).
* @param[in] dyDesc Output gradient tensor descriptor.
* @param[in] dy Pointer to output gradient tensor data.
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] dxDesc Input gradient tensor descriptor.
* @param[in,out] dx Pointer to input gradient tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSoftmaxForward
*/
cudnnStatus_t CUDNNWINAPI
cudnnSoftmaxBackward(cudnnHandle_t handle,
cudnnSoftmaxAlgorithm_t algo,
cudnnSoftmaxMode_t mode,
const void *alpha,
const cudnnTensorDescriptor_t yDesc,
const void *y,
const cudnnTensorDescriptor_t dyDesc,
const void *dy,
const void *beta,
const cudnnTensorDescriptor_t dxDesc,
void *dx);
/**
* @brief Performs backward pooling.
*
* Computes the gradient of the pooling operation.
*
* @param[in] handle cuDNN library handle.
* @param[in] poolingDesc Pooling descriptor.
* @param[in] alpha Scaling factor for the result.
* @param[in] yDesc Output tensor descriptor (from forward pass).
* @param[in] y Pointer to output tensor data (from forward pass).
* @param[in] dyDesc Output gradient tensor descriptor.
* @param[in] dy Pointer to output gradient tensor data.
* @param[in] xDesc Input tensor descriptor (from forward pass).
* @param[in] x Pointer to input tensor data (from forward pass).
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] dxDesc Input gradient tensor descriptor.
* @param[in,out] dx Pointer to input gradient tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnPoolingForward
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnPoolingBackward(cudnnHandle_t handle,
const cudnnPoolingDescriptor_t poolingDesc,
const void *alpha,
const cudnnTensorDescriptor_t yDesc,
const void *y,
const cudnnTensorDescriptor_t dyDesc,
const void *dy,
const cudnnTensorDescriptor_t xDesc,
const void *x,
const void *beta,
const cudnnTensorDescriptor_t dxDesc,
void *dx);
/**
* @brief Performs backward activation.
*
* Computes the gradient of the activation function.
*
* @param[in] handle cuDNN library handle.
* @param[in] activationDesc Activation descriptor.
* @param[in] alpha Scaling factor for the result.
* @param[in] yDesc Output tensor descriptor (from forward pass).
* @param[in] y Pointer to output tensor data (from forward pass).
* @param[in] dyDesc Output gradient tensor descriptor.
* @param[in] dy Pointer to output gradient tensor data.
* @param[in] xDesc Input tensor descriptor (from forward pass).
* @param[in] x Pointer to input tensor data (from forward pass).
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] dxDesc Input gradient tensor descriptor.
* @param[in,out] dx Pointer to input gradient tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnActivationForward
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnActivationBackward(cudnnHandle_t handle,
cudnnActivationDescriptor_t activationDesc,
const void *alpha,
const cudnnTensorDescriptor_t yDesc,
const void *y,
const cudnnTensorDescriptor_t dyDesc,
const void *dy,
const cudnnTensorDescriptor_t xDesc,
const void *x,
const void *beta,
const cudnnTensorDescriptor_t dxDesc,
void *dx);
/**
* @brief Performs backward LRN cross-channel normalization.
*
* Computes the gradient of the LRN cross-channel normalization. Double
* parameters are cast to the tensor data type.
*
* @param[in] handle cuDNN library handle.
* @param[in] normDesc LRN descriptor.
* @param[in] lrnMode LRN mode.
* @param[in] alpha Scaling factor for the result.
* @param[in] yDesc Output tensor descriptor (from forward pass).
* @param[in] y Pointer to output tensor data (from forward pass).
* @param[in] dyDesc Output gradient tensor descriptor.
* @param[in] dy Pointer to output gradient tensor data.
* @param[in] xDesc Input tensor descriptor (from forward pass).
* @param[in] x Pointer to input tensor data (from forward pass).
* @param[in] beta Scaling factor for the destination tensor.
* @param[in] dxDesc Input gradient tensor descriptor.
* @param[in,out] dx Pointer to input gradient tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnLRNCrossChannelForward
*/
cudnnStatus_t CUDNNWINAPI
cudnnLRNCrossChannelBackward(cudnnHandle_t handle,
cudnnLRNDescriptor_t normDesc,
cudnnLRNMode_t lrnMode,
const void *alpha,
const cudnnTensorDescriptor_t yDesc,
const void *y,
const cudnnTensorDescriptor_t dyDesc,
const void *dy,
const cudnnTensorDescriptor_t xDesc,
const void *x,
const void *beta,
const cudnnTensorDescriptor_t dxDesc,
void *dx);
/**
* @brief Performs backward divisive normalization.
*
* Computes the gradients of the divisive normalization operation. If means is NULL,
* means are assumed to be zero.
*
* @param[in] handle cuDNN library handle.
* @param[in] normDesc LRN descriptor (shared with LRN functions).
* @param[in] mode Divisive normalization mode.
* @param[in] alpha Scaling factor for the result.
* @param[in] xDesc Input tensor descriptor (also used for means, dy, temp, temp2).
* @param[in] x Pointer to input tensor data.
* @param[in] means Pointer to means tensor data (NULL for zero means).
* @param[in] dy Pointer to output gradient tensor data.
* @param[out] temp Temporary workspace tensor.
* @param[out] temp2 Temporary workspace tensor.
* @param[in] beta Scaling factor for the destination tensors.
* @param[in] dXdMeansDesc Descriptor for dx and dMeans tensors.
* @param[in,out] dx Pointer to input gradient tensor data.
* @param[in,out] dMeans Pointer to means gradient tensor data (can be NULL).
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnDivisiveNormalizationForward
*/
cudnnStatus_t CUDNNWINAPI
cudnnDivisiveNormalizationBackward(cudnnHandle_t handle,
cudnnLRNDescriptor_t normDesc,
cudnnDivNormMode_t mode,
const void *alpha,
const cudnnTensorDescriptor_t xDesc, /* same desc for x, means, dy, temp, temp2 */
const void *x,
const void *means, /* if NULL, means are assumed to be zero */
const void *dy,
void *temp,
void *temp2,
const void *beta,
const cudnnTensorDescriptor_t dXdMeansDesc, /* same desc for dx, dMeans */
void *dx, /* output x differential */
void *dMeans); /* output means differential, can be NULL */
/**
* @brief Returns the workspace size for extended batch normalization forward training.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Batch normalization mode.
* @param[in] bnOps Extended batch normalization operation.
* @param[in] xDesc Input tensor descriptor.
* @param[in] zDesc Z tensor descriptor (for add operations).
* @param[in] yDesc Output tensor descriptor.
* @param[in] bnScaleBiasMeanVarDesc Descriptor for BN parameter tensors.
* @param[in] activationDesc Activation descriptor.
* @param[out] sizeInBytes Required workspace size in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnBatchNormalizationForwardTrainingEx
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize(cudnnHandle_t handle,
cudnnBatchNormMode_t mode,
cudnnBatchNormOps_t bnOps,
const cudnnTensorDescriptor_t xDesc,
const cudnnTensorDescriptor_t zDesc,
const cudnnTensorDescriptor_t yDesc,
const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
const cudnnActivationDescriptor_t activationDesc,
size_t *sizeInBytes);
/**
* @brief Returns the workspace size for extended batch normalization backward.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Batch normalization mode.
* @param[in] bnOps Extended batch normalization operation.
* @param[in] xDesc Input tensor descriptor.
* @param[in] yDesc Output tensor descriptor.
* @param[in] dyDesc Output gradient tensor descriptor.
* @param[in] dzDesc Z gradient tensor descriptor.
* @param[in] dxDesc Input gradient tensor descriptor.
* @param[in] dBnScaleBiasDesc Descriptor for BN parameter gradient tensors.
* @param[in] activationDesc Activation descriptor.
* @param[out] sizeInBytes Required workspace size in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnBatchNormalizationBackwardEx
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetBatchNormalizationBackwardExWorkspaceSize(cudnnHandle_t handle,
cudnnBatchNormMode_t mode,
cudnnBatchNormOps_t bnOps,
const cudnnTensorDescriptor_t xDesc,
const cudnnTensorDescriptor_t yDesc,
const cudnnTensorDescriptor_t dyDesc,
const cudnnTensorDescriptor_t dzDesc,
const cudnnTensorDescriptor_t dxDesc,
const cudnnTensorDescriptor_t dBnScaleBiasDesc,
const cudnnActivationDescriptor_t activationDesc,
size_t *sizeInBytes);
/**
* @brief Returns the reserve space size for extended batch normalization training.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Batch normalization mode.
* @param[in] bnOps Extended batch normalization operation.
* @param[in] activationDesc Activation descriptor.
* @param[in] xDesc Input tensor descriptor.
* @param[out] sizeInBytes Required reserve space size in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnBatchNormalizationForwardTrainingEx
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetBatchNormalizationTrainingExReserveSpaceSize(cudnnHandle_t handle,
cudnnBatchNormMode_t mode,
cudnnBatchNormOps_t bnOps,
const cudnnActivationDescriptor_t activationDesc,
const cudnnTensorDescriptor_t xDesc,
size_t *sizeInBytes);
/**
* @brief Performs batch normalization forward training.
*
* Computes y = BN(x). Also accumulates moving averages of mean and inverse variances.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Batch normalization mode.
* @param[in] alpha Result blend factor.
* @param[in] beta Destination layer blend factor.
* @param[in] xDesc Input tensor descriptor.
* @param[in] x Pointer to input tensor data (NxCxHxW).
* @param[in] yDesc Output tensor descriptor.
* @param[out] y Pointer to output tensor data (NxCxHxW).
* @param[in] bnScaleBiasMeanVarDesc Descriptor for BN parameter tensors.
* @param[in] bnScale Pointer to scale (gamma) tensor data.
* @param[in] bnBias Pointer to bias (beta) tensor data.
* @param[in] exponentialAverageFactor Factor for computing running averages.
* @param[in,out] resultRunningMean Running mean (updated with exponential average).
* @param[in,out] resultRunningVariance Running variance (updated with exponential average).
* @param[in] epsilon Epsilon value (must be >= CUDNN_BN_MIN_EPSILON).
* @param[out] resultSaveMean Optionally cached mean for backward pass (NULL if unused).
* @param[out] resultSaveInvVariance Optionally cached inverse variance for backward pass (NULL if unused).
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnBatchNormalizationBackward, cudnnDeriveBNTensorDescriptor
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnBatchNormalizationForwardTraining(
cudnnHandle_t handle,
cudnnBatchNormMode_t mode,
const void *alpha, /* alpha[0] = result blend factor */
const void *beta, /* beta[0] = dest layer blend factor */
const cudnnTensorDescriptor_t xDesc,
const void *x, /* NxCxHxW */
const cudnnTensorDescriptor_t yDesc,
void *y, /* NxCxHxW */
/* Shared desc for the next 6 tensors in the argument list.
Data type to be set as follows:
type = (typeOf(x) == double) ? double : float
Dimensions for this descriptor depend on normalization mode
- Spatial Normalization : tensors are expected to have dims 1xCx1x1
(normalization is performed across NxHxW)
- Per-Activation Normalization : tensors are expected to have dims of 1xCxHxW
(normalization is performed across N) */
const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
/* 'Gamma' and 'Beta' respectively in Ioffe and Szegedy's paper's notation */
const void *bnScale,
const void *bnBias,
/* MUST use factor=1 in the very first call of a complete training cycle.
Use a factor=1/(1+n) at N-th call to the function to get
Cumulative Moving Average (CMA) behavior
CMA[n] = (x[1]+...+x[n])/n
Since CMA[n+1] = (n*CMA[n]+x[n+1])/(n+1) =
((n+1)*CMA[n]-CMA[n])/(n+1) + x[n+1]/(n+1) =
CMA[n]*(1-1/(n+1)) + x[n+1]*1/(n+1) */
double exponentialAverageFactor,
/* Used in Training phase only.
runningMean = newMean*factor + runningMean*(1-factor) */
void *resultRunningMean,
/* Output in training mode, input in inference. Is the moving average
of variance[x] (factor is applied in the same way as for runningMean) */
void *resultRunningVariance,
/* Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */
double epsilon,
/* Optionally save intermediate results from the forward pass here
- can be reused to speed up backward pass. NULL if unused */
void *resultSaveMean,
void *resultSaveInvVariance);
/**
* @brief Performs extended batch normalization forward training with optional activation.
*
* Computes y = relu(BN(x) + z). Also accumulates moving averages of mean and inverse variances.
* Supports fused batch normalization + activation and batch normalization + add + activation.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Batch normalization mode.
* @param[in] bnOps Extended batch normalization operation.
* @param[in] alpha Result blend factor.
* @param[in] beta Destination layer blend factor.
* @param[in] xDesc Input tensor descriptor.
* @param[in] xData Pointer to input tensor data.
* @param[in] zDesc Z tensor descriptor (for add operations).
* @param[in] zData Pointer to z tensor data.
* @param[in] yDesc Output tensor descriptor.
* @param[out] yData Pointer to output tensor data.
* @param[in] bnScaleBiasMeanVarDesc Descriptor for BN parameter tensors.
* @param[in] bnScale Pointer to scale tensor data.
* @param[in] bnBias Pointer to bias tensor data.
* @param[in] exponentialAverageFactor Factor for computing running averages.
* @param[in,out] resultRunningMean Running mean.
* @param[in,out] resultRunningVariance Running variance.
* @param[in] epsilon Epsilon value (must be >= CUDNN_BN_MIN_EPSILON).
* @param[out] resultSaveMean Cached mean for backward pass (NULL if unused).
* @param[out] resultSaveInvVariance Cached inverse variance for backward pass (NULL if unused).
* @param[in] activationDesc Activation descriptor.
* @param[in,out] workspace Pointer to workspace memory.
* @param[in] workSpaceSizeInBytes Size of workspace in bytes.
* @param[in,out] reserveSpace Pointer to reserve space memory.
* @param[in] reserveSpaceSizeInBytes Size of reserve space in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnBatchNormalizationBackwardEx, cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnBatchNormalizationForwardTrainingEx(
cudnnHandle_t handle,
cudnnBatchNormMode_t mode,
cudnnBatchNormOps_t bnOps,
const void *alpha, /* alpha[0] = result blend factor */
const void *beta, /* beta[0] = dest layer blend factor */
const cudnnTensorDescriptor_t xDesc,
const void *xData,
const cudnnTensorDescriptor_t zDesc,
const void *zData,
const cudnnTensorDescriptor_t yDesc,
void *yData,
const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
const void *bnScale,
const void *bnBias,
double exponentialAverageFactor,
void *resultRunningMean,
void *resultRunningVariance,
/* Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */
double epsilon,
/* Optionally save intermediate results from the forward pass here
- can be reused to speed up backward pass. NULL if unused */
void *resultSaveMean,
void *resultSaveInvVariance,
cudnnActivationDescriptor_t activationDesc,
void *workspace,
size_t workSpaceSizeInBytes,
void *reserveSpace,
size_t reserveSpaceSizeInBytes);
/**
* @brief Performs backward batch normalization.
*
* Computes gradients for x, bnScale, and bnBias.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Batch normalization mode.
* @param[in] alphaDataDiff Scaling factor for dx result.
* @param[in] betaDataDiff Scaling factor for dx destination.
* @param[in] alphaParamDiff Scaling factor for parameter gradient results.
* @param[in] betaParamDiff Scaling factor for parameter gradient destinations.
* @param[in] xDesc Input tensor descriptor (same for x, dx, dy).
* @param[in] x Pointer to input tensor data.
* @param[in] dyDesc Output gradient tensor descriptor.
* @param[in] dy Pointer to output gradient tensor data.
* @param[in] dxDesc Input gradient tensor descriptor.
* @param[in,out] dx Pointer to input gradient tensor data.
* @param[in] dBnScaleBiasDesc Shared descriptor for parameter gradient tensors.
* @param[in] bnScale Pointer to scale tensor data.
* @param[out] dBnScaleResult Pointer to scale gradient result.
* @param[out] dBnBiasResult Pointer to bias gradient result.
* @param[in] epsilon Same epsilon as forward pass.
* @param[in] savedMean Optionally cached mean from forward pass.
* @param[in] savedInvVariance Optionally cached inverse variance from forward pass.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnBatchNormalizationForwardTraining
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnBatchNormalizationBackward(cudnnHandle_t handle,
cudnnBatchNormMode_t mode,
const void *alphaDataDiff,
const void *betaDataDiff,
const void *alphaParamDiff,
const void *betaParamDiff,
const cudnnTensorDescriptor_t xDesc, /* same desc for x, dx, dy */
const void *x,
const cudnnTensorDescriptor_t dyDesc,
const void *dy,
const cudnnTensorDescriptor_t dxDesc,
void *dx,
/* Shared tensor desc for the 4 tensors below */
const cudnnTensorDescriptor_t dBnScaleBiasDesc,
const void *bnScale, /* bnBias doesn't affect backpropagation */
/* scale and bias diff are not backpropagated below this layer */
void *dBnScaleResult,
void *dBnBiasResult,
/* Same epsilon as forward pass */
double epsilon,
/* Optionally cached intermediate results from
forward pass */
const void *savedMean,
const void *savedInvVariance);
/**
* @brief Performs extended backward batch normalization with optional activation.
*
* Computes gradients for the fused batch normalization + activation operations.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Batch normalization mode.
* @param[in] bnOps Extended batch normalization operation.
* @param[in] alphaDataDiff Scaling factor for data gradient results.
* @param[in] betaDataDiff Scaling factor for data gradient destinations.
* @param[in] alphaParamDiff Scaling factor for parameter gradient results.
* @param[in] betaParamDiff Scaling factor for parameter gradient destinations.
* @param[in] xDesc Input tensor descriptor.
* @param[in] xData Pointer to input tensor data.
* @param[in] yDesc Output tensor descriptor.
* @param[in] yData Pointer to output tensor data.
* @param[in] dyDesc Output gradient tensor descriptor.
* @param[in] dyData Pointer to output gradient tensor data.
* @param[in] dzDesc Z gradient tensor descriptor.
* @param[in,out] dzData Pointer to z gradient tensor data.
* @param[in] dxDesc Input gradient tensor descriptor.
* @param[in,out] dxData Pointer to input gradient tensor data.
* @param[in] dBnScaleBiasDesc Shared descriptor for parameter gradient tensors.
* @param[in] bnScaleData Pointer to scale tensor data.
* @param[in] bnBiasData Pointer to bias tensor data (needed for activation).
* @param[out] dBnScaleData Pointer to scale gradient result.
* @param[out] dBnBiasData Pointer to bias gradient result.
* @param[in] epsilon Same epsilon as forward pass.
* @param[in] savedMean Optionally cached mean from forward pass.
* @param[in] savedInvVariance Optionally cached inverse variance from forward pass.
* @param[in] activationDesc Activation descriptor.
* @param[in,out] workSpace Pointer to workspace memory.
* @param[in] workSpaceSizeInBytes Size of workspace in bytes.
* @param[in,out] reserveSpace Pointer to reserve space memory.
* @param[in] reserveSpaceSizeInBytes Size of reserve space in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnBatchNormalizationForwardTrainingEx
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnBatchNormalizationBackwardEx(cudnnHandle_t handle,
cudnnBatchNormMode_t mode,
cudnnBatchNormOps_t bnOps,
const void *alphaDataDiff,
const void *betaDataDiff,
const void *alphaParamDiff,
const void *betaParamDiff,
const cudnnTensorDescriptor_t xDesc,
const void *xData,
const cudnnTensorDescriptor_t yDesc,
const void *yData,
const cudnnTensorDescriptor_t dyDesc,
const void *dyData,
const cudnnTensorDescriptor_t dzDesc,
void *dzData,
const cudnnTensorDescriptor_t dxDesc,
void *dxData,
/* Shared tensor desc for the 4 tensors below */
const cudnnTensorDescriptor_t dBnScaleBiasDesc,
const void *bnScaleData,
const void *bnBiasData, /* needed if there is activation */
void *dBnScaleData,
void *dBnBiasData,
double epsilon, /* Same epsilon as forward pass */
/* Optionally cached intermediate results from
forward pass */
const void *savedMean,
const void *savedInvVariance,
cudnnActivationDescriptor_t activationDesc,
void *workSpace,
size_t workSpaceSizeInBytes,
void *reserveSpace,
size_t reserveSpaceSizeInBytes);
/**
* @brief Returns the workspace size for normalization forward training.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Normalization mode.
* @param[in] normOps Extended normalization operation.
* @param[in] algo Normalization algorithm.
* @param[in] xDesc Input tensor descriptor.
* @param[in] zDesc Z tensor descriptor (for add operations).
* @param[in] yDesc Output tensor descriptor.
* @param[in] normScaleBiasDesc Descriptor for normalization scale/bias tensors.
* @param[in] activationDesc Activation descriptor.
* @param[in] normMeanVarDesc Descriptor for mean/variance tensors.
* @param[out] sizeInBytes Required workspace size in bytes.
* @param[in] groupCnt Group count (reserved, should be set to 1).
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnNormalizationForwardTraining
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetNormalizationForwardTrainingWorkspaceSize(cudnnHandle_t handle,
cudnnNormMode_t mode,
cudnnNormOps_t normOps,
cudnnNormAlgo_t algo,
const cudnnTensorDescriptor_t xDesc,
const cudnnTensorDescriptor_t zDesc,
const cudnnTensorDescriptor_t yDesc,
const cudnnTensorDescriptor_t normScaleBiasDesc,
const cudnnActivationDescriptor_t activationDesc,
const cudnnTensorDescriptor_t normMeanVarDesc,
size_t *sizeInBytes,
int groupCnt); /* Place hold for future work, should be set to 1 now*/
/**
* @brief Returns the workspace size for normalization backward.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Normalization mode.
* @param[in] normOps Extended normalization operation.
* @param[in] algo Normalization algorithm.
* @param[in] xDesc Input tensor descriptor.
* @param[in] yDesc Output tensor descriptor.
* @param[in] dyDesc Output gradient tensor descriptor.
* @param[in] dzDesc Z gradient tensor descriptor.
* @param[in] dxDesc Input gradient tensor descriptor.
* @param[in] dNormScaleBiasDesc Descriptor for normalization parameter gradient tensors.
* @param[in] activationDesc Activation descriptor.
* @param[in] normMeanVarDesc Descriptor for mean/variance tensors.
* @param[out] sizeInBytes Required workspace size in bytes.
* @param[in] groupCnt Group count (reserved, should be set to 1).
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnNormalizationBackward
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetNormalizationBackwardWorkspaceSize(cudnnHandle_t handle,
cudnnNormMode_t mode,
cudnnNormOps_t normOps,
cudnnNormAlgo_t algo,
const cudnnTensorDescriptor_t xDesc,
const cudnnTensorDescriptor_t yDesc,
const cudnnTensorDescriptor_t dyDesc,
const cudnnTensorDescriptor_t dzDesc,
const cudnnTensorDescriptor_t dxDesc,
const cudnnTensorDescriptor_t dNormScaleBiasDesc,
const cudnnActivationDescriptor_t activationDesc,
const cudnnTensorDescriptor_t normMeanVarDesc,
size_t *sizeInBytes,
int groupCnt); /* Place hold for future work, should be set to 1 now*/
/**
* @brief Returns the reserve space size for normalization training.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Normalization mode.
* @param[in] normOps Extended normalization operation.
* @param[in] algo Normalization algorithm.
* @param[in] activationDesc Activation descriptor.
* @param[in] xDesc Input tensor descriptor.
* @param[out] sizeInBytes Required reserve space size in bytes.
* @param[in] groupCnt Group count (reserved, should be set to 1).
*
* @retval CUDNN_STATUS_SUCCESS The size was returned successfully.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnNormalizationForwardTraining
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnGetNormalizationTrainingReserveSpaceSize(cudnnHandle_t handle,
cudnnNormMode_t mode,
cudnnNormOps_t normOps,
cudnnNormAlgo_t algo,
const cudnnActivationDescriptor_t activationDesc,
const cudnnTensorDescriptor_t xDesc,
size_t *sizeInBytes,
int groupCnt); /* Place hold for future work, should be set to 1 now*/
/**
* @brief Performs normalization forward training with optional activation.
*
* Computes y = relu(Norm(x) + z). Also accumulates moving averages of mean
* and inverse variances.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Normalization mode.
* @param[in] normOps Extended normalization operation.
* @param[in] algo Normalization algorithm.
* @param[in] alpha Result blend factor.
* @param[in] beta Destination layer blend factor.
* @param[in] xDesc Input tensor descriptor.
* @param[in] xData Pointer to input tensor data.
* @param[in] normScaleBiasDesc Descriptor for normalization scale/bias tensors.
* @param[in] normScale Pointer to scale tensor data.
* @param[in] normBias Pointer to bias tensor data.
* @param[in] exponentialAverageFactor Factor for computing running averages.
* @param[in] normMeanVarDesc Descriptor for mean/variance tensors.
* @param[in,out] resultRunningMean Running mean.
* @param[in,out] resultRunningVariance Running variance.
* @param[in] epsilon Epsilon value (must be >= 0).
* @param[out] resultSaveMean Cached mean for backward pass (NULL if unused).
* @param[out] resultSaveInvVariance Cached inverse variance for backward pass (NULL if unused).
* @param[in] activationDesc Activation descriptor.
* @param[in] zDesc Z tensor descriptor (for add operations).
* @param[in] zData Pointer to z tensor data.
* @param[in] yDesc Output tensor descriptor.
* @param[out] yData Pointer to output tensor data.
* @param[in,out] workspace Pointer to workspace memory.
* @param[in] workSpaceSizeInBytes Size of workspace in bytes.
* @param[in,out] reserveSpace Pointer to reserve space memory.
* @param[in] reserveSpaceSizeInBytes Size of reserve space in bytes.
* @param[in] groupCnt Group count (reserved, should be set to 1).
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnNormalizationBackward, cudnnGetNormalizationForwardTrainingWorkspaceSize
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnNormalizationForwardTraining(cudnnHandle_t handle,
cudnnNormMode_t mode,
cudnnNormOps_t normOps,
cudnnNormAlgo_t algo,
const void *alpha, /* alpha[0] = result blend factor */
const void *beta, /* beta[0] = dest layer blend factor */
const cudnnTensorDescriptor_t xDesc,
const void *xData,
const cudnnTensorDescriptor_t normScaleBiasDesc,
const void *normScale,
const void *normBias,
double exponentialAverageFactor,
const cudnnTensorDescriptor_t normMeanVarDesc,
void *resultRunningMean,
void *resultRunningVariance,
/* Has to be >= 0. Should be the same in forward and backward functions. */
double epsilon,
/* Optionally save intermediate results from the forward pass here
- can be reused to speed up backward pass. NULL if unused */
void *resultSaveMean,
void *resultSaveInvVariance,
cudnnActivationDescriptor_t activationDesc,
const cudnnTensorDescriptor_t zDesc,
const void *zData,
const cudnnTensorDescriptor_t yDesc,
void *yData,
void *workspace,
size_t workSpaceSizeInBytes,
void *reserveSpace,
size_t reserveSpaceSizeInBytes,
int groupCnt); /* Place hold for future work, should be set to 1 now*/
/**
* @brief Performs backward normalization.
*
* Computes gradients for the normalization operation, including optional activation
* and element-wise add gradients.
*
* @param[in] handle cuDNN library handle.
* @param[in] mode Normalization mode.
* @param[in] normOps Extended normalization operation.
* @param[in] algo Normalization algorithm.
* @param[in] alphaDataDiff Scaling factor for data gradient results.
* @param[in] betaDataDiff Scaling factor for data gradient destinations.
* @param[in] alphaParamDiff Scaling factor for parameter gradient results.
* @param[in] betaParamDiff Scaling factor for parameter gradient destinations.
* @param[in] xDesc Input tensor descriptor.
* @param[in] xData Pointer to input tensor data.
* @param[in] yDesc Output tensor descriptor.
* @param[in] yData Pointer to output tensor data.
* @param[in] dyDesc Output gradient tensor descriptor.
* @param[in] dyData Pointer to output gradient tensor data.
* @param[in] dzDesc Z gradient tensor descriptor.
* @param[in,out] dzData Pointer to z gradient tensor data.
* @param[in] dxDesc Input gradient tensor descriptor.
* @param[in,out] dxData Pointer to input gradient tensor data.
* @param[in] dNormScaleBiasDesc Shared descriptor for parameter gradient tensors.
* @param[in] normScaleData Pointer to scale tensor data.
* @param[in] normBiasData Pointer to bias tensor data (needed for activation).
* @param[out] dNormScaleData Pointer to scale gradient result.
* @param[out] dNormBiasData Pointer to bias gradient result.
* @param[in] epsilon Same epsilon as forward pass.
* @param[in] normMeanVarDesc Descriptor for mean/variance tensors.
* @param[in] savedMean Optionally cached mean from forward pass.
* @param[in] savedInvVariance Optionally cached inverse variance from forward pass.
* @param[in] activationDesc Activation descriptor.
* @param[in,out] workSpace Pointer to workspace memory.
* @param[in] workSpaceSizeInBytes Size of workspace in bytes.
* @param[in,out] reserveSpace Pointer to reserve space memory.
* @param[in] reserveSpaceSizeInBytes Size of reserve space in bytes.
* @param[in] groupCnt Group count (reserved, should be set to 1).
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @deprecated Since cuDNN 9.0.0. Use graph API instead.
* @see cudnnNormalizationForwardTraining
*/
CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
cudnnNormalizationBackward(cudnnHandle_t handle,
cudnnNormMode_t mode,
cudnnNormOps_t normOps,
cudnnNormAlgo_t algo,
const void *alphaDataDiff,
const void *betaDataDiff,
const void *alphaParamDiff,
const void *betaParamDiff,
const cudnnTensorDescriptor_t xDesc,
const void *xData,
const cudnnTensorDescriptor_t yDesc,
const void *yData,
const cudnnTensorDescriptor_t dyDesc,
const void *dyData,
const cudnnTensorDescriptor_t dzDesc,
void *dzData,
const cudnnTensorDescriptor_t dxDesc,
void *dxData,
/* Shared tensor desc for the 4 tensors below */
const cudnnTensorDescriptor_t dNormScaleBiasDesc,
const void *normScaleData,
const void *normBiasData, /* needed if there is activation */
void *dNormScaleData,
void *dNormBiasData,
double epsilon, /* Same epsilon as forward pass */
const cudnnTensorDescriptor_t normMeanVarDesc,
/* Optionally cached intermediate results from
forward pass */
const void *savedMean,
const void *savedInvVariance,
cudnnActivationDescriptor_t activationDesc,
void *workSpace,
size_t workSpaceSizeInBytes,
void *reserveSpace,
size_t reserveSpaceSizeInBytes,
int groupCnt); /* Place hold for future work, should be set to 1 now*/
/**
* @brief Computes the gradient of the spatial transformer grid generator (backward).
*
* @param[in] handle cuDNN library handle.
* @param[in] stDesc Spatial transformer descriptor.
* @param[in] dgrid Pointer to the grid gradient data.
* @param[out] dtheta Pointer to the theta gradient data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSpatialTfGridGeneratorForward
*/
cudnnStatus_t CUDNNWINAPI
cudnnSpatialTfGridGeneratorBackward(cudnnHandle_t handle,
const cudnnSpatialTransformerDescriptor_t stDesc,
const void *dgrid,
void *dtheta);
/**
* @brief Performs spatial transformer sampling backward.
*
* Computes the gradients of the spatial transformer sampler.
*
* @param[in] handle cuDNN library handle.
* @param[in] stDesc Spatial transformer descriptor.
* @param[in] alpha Scaling factor for the dx result.
* @param[in] xDesc Input tensor descriptor.
* @param[in] x Pointer to input tensor data.
* @param[in] beta Scaling factor for the dx destination.
* @param[in] dxDesc Input gradient tensor descriptor.
* @param[in,out] dx Pointer to input gradient tensor data.
* @param[in] alphaDgrid Scaling factor for the dgrid result.
* @param[in] dyDesc Output gradient tensor descriptor.
* @param[in] dy Pointer to output gradient tensor data.
* @param[in] grid Pointer to sampling grid data.
* @param[in] betaDgrid Scaling factor for the dgrid destination.
* @param[in,out] dgrid Pointer to grid gradient tensor data.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnSpatialTfSamplerForward
*/
cudnnStatus_t CUDNNWINAPI
cudnnSpatialTfSamplerBackward(cudnnHandle_t handle,
cudnnSpatialTransformerDescriptor_t stDesc,
const void *alpha,
const cudnnTensorDescriptor_t xDesc,
const void *x,
const void *beta,
const cudnnTensorDescriptor_t dxDesc,
void *dx,
const void *alphaDgrid,
const cudnnTensorDescriptor_t dyDesc,
const void *dy,
const void *grid,
const void *betaDgrid,
void *dgrid);
/**
* @brief Performs backward dropout.
*
* Applies the same dropout mask from the forward pass (stored in reserveSpace)
* to the gradient tensor.
*
* @param[in] handle cuDNN library handle.
* @param[in] dropoutDesc Dropout descriptor.
* @param[in] dydesc Output gradient tensor descriptor.
* @param[in] dy Pointer to output gradient tensor data.
* @param[in] dxdesc Input gradient tensor descriptor.
* @param[out] dx Pointer to input gradient tensor data.
* @param[in] reserveSpace Pointer to reserve space from forward pass.
* @param[in] reserveSpaceSizeInBytes Size of reserve space in bytes.
*
* @retval CUDNN_STATUS_SUCCESS The operation completed successfully.
* @retval CUDNN_STATUS_BAD_PARAM An invalid parameter was provided.
*
* @since cuDNN 9.0.0
* @see cudnnDropoutForward
*/
cudnnStatus_t CUDNNWINAPI
cudnnDropoutBackward(cudnnHandle_t handle,
const cudnnDropoutDescriptor_t dropoutDesc,
const cudnnTensorDescriptor_t dydesc,
const void *dy,
const cudnnTensorDescriptor_t dxdesc,
void *dx,
void *reserveSpace,
size_t reserveSpaceSizeInBytes);
#if defined(__cplusplus)
}
#endif
#endif /* CUDNN_OPS_H_ */
|