__init__.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155
  1. # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import typing
  15. try:
  16. from paddle.cuda_env import * # noqa: F403
  17. from paddle.version import ( # noqa: F401
  18. commit as __git_commit__,
  19. full_version as __version__,
  20. )
  21. except ImportError:
  22. import sys
  23. sys.stderr.write(
  24. '''Warning with import paddle: you should not
  25. import paddle from the source directory; please install paddlepaddle*.whl firstly.'''
  26. )
  27. # NOTE(SigureMo): We should place the import of base.core before other modules,
  28. # because there are some initialization codes in base/core/__init__.py.
  29. from .base import core # noqa: F401
  30. from .batch import batch
  31. # Do the *DUPLICATED* monkey-patch for the tensor object.
  32. # We need remove the duplicated code here once we fix
  33. # the illogical implement in the monkey-patch methods later.
  34. from .framework import monkey_patch_math_tensor, monkey_patch_variable
  35. from .pir import monkey_patch_dtype, monkey_patch_program, monkey_patch_value
  36. monkey_patch_variable()
  37. monkey_patch_math_tensor()
  38. monkey_patch_value()
  39. monkey_patch_program()
  40. monkey_patch_dtype()
  41. from .base.dataset import * # noqa: F403
  42. from .framework import (
  43. disable_signal_handler,
  44. disable_static,
  45. enable_static,
  46. get_flags,
  47. in_dynamic_mode,
  48. set_flags,
  49. )
  50. from .framework.dtype import (
  51. bfloat16,
  52. bool,
  53. complex64,
  54. complex128,
  55. dtype,
  56. finfo,
  57. float16,
  58. float32,
  59. float64,
  60. iinfo,
  61. int8,
  62. int16,
  63. int32,
  64. int64,
  65. uint8,
  66. )
  67. if typing.TYPE_CHECKING:
  68. from .tensor.tensor import Tensor
  69. else:
  70. Tensor = framework.core.eager.Tensor
  71. Tensor.__qualname__ = 'Tensor'
  72. import paddle.distributed.fleet
  73. import paddle.text
  74. import paddle.vision
  75. from paddle import ( # noqa: F401
  76. amp,
  77. audio,
  78. autograd,
  79. dataset,
  80. decomposition,
  81. device,
  82. distributed,
  83. distribution,
  84. geometric,
  85. incubate,
  86. inference,
  87. io,
  88. jit,
  89. metric,
  90. nn,
  91. onnx,
  92. optimizer,
  93. quantization,
  94. reader,
  95. regularizer,
  96. sparse,
  97. static,
  98. sysconfig,
  99. vision,
  100. )
  101. # high-level api
  102. from . import ( # noqa: F401
  103. _pir_ops,
  104. _typing as _typing,
  105. callbacks,
  106. fft,
  107. hub,
  108. linalg,
  109. signal,
  110. )
  111. from .autograd import (
  112. enable_grad,
  113. grad,
  114. is_grad_enabled,
  115. no_grad,
  116. set_grad_enabled,
  117. )
  118. from .device import ( # noqa: F401
  119. get_cudnn_version,
  120. get_device,
  121. is_compiled_with_cinn,
  122. is_compiled_with_cuda,
  123. is_compiled_with_custom_device,
  124. is_compiled_with_distribute,
  125. is_compiled_with_ipu,
  126. is_compiled_with_rocm,
  127. is_compiled_with_xpu,
  128. set_device,
  129. )
  130. from .distributed import DataParallel
  131. from .framework import ( # noqa: F401
  132. CPUPlace,
  133. CUDAPinnedPlace,
  134. CUDAPlace,
  135. CustomPlace,
  136. IPUPlace,
  137. ParamAttr,
  138. XPUPlace,
  139. async_save,
  140. clear_async_save_task_queue,
  141. get_default_dtype,
  142. load,
  143. save,
  144. set_default_dtype,
  145. )
  146. from .framework.random import (
  147. get_cuda_rng_state,
  148. get_rng_state,
  149. seed,
  150. set_cuda_rng_state,
  151. set_rng_state,
  152. )
  153. from .hapi import (
  154. Model,
  155. flops,
  156. summary,
  157. )
  158. from .nn.functional.distance import (
  159. pdist,
  160. )
  161. from .nn.initializer.lazy_init import LazyGuard
  162. from .tensor.attribute import (
  163. imag,
  164. is_complex,
  165. is_floating_point,
  166. is_integer,
  167. rank,
  168. real,
  169. shape,
  170. )
  171. from .tensor.creation import (
  172. arange,
  173. assign,
  174. cauchy_,
  175. clone,
  176. complex,
  177. create_parameter,
  178. diag,
  179. diag_embed,
  180. diagflat,
  181. empty,
  182. empty_like,
  183. eye,
  184. full,
  185. full_like,
  186. geometric_,
  187. linspace,
  188. logspace,
  189. meshgrid,
  190. ones,
  191. ones_like,
  192. polar,
  193. to_tensor,
  194. tril,
  195. tril_,
  196. tril_indices,
  197. triu,
  198. triu_,
  199. triu_indices,
  200. zeros,
  201. zeros_like,
  202. )
  203. from .tensor.einsum import einsum
  204. from .tensor.linalg import ( # noqa: F401
  205. bincount,
  206. bmm,
  207. cdist,
  208. cholesky,
  209. cross,
  210. dist,
  211. dot,
  212. eigvalsh,
  213. histogram,
  214. histogramdd,
  215. matmul,
  216. mv,
  217. norm,
  218. t,
  219. t_,
  220. transpose,
  221. transpose_,
  222. )
  223. from .tensor.logic import (
  224. allclose,
  225. bitwise_and,
  226. bitwise_and_,
  227. bitwise_not,
  228. bitwise_not_,
  229. bitwise_or,
  230. bitwise_or_,
  231. bitwise_xor,
  232. bitwise_xor_,
  233. equal,
  234. equal_,
  235. equal_all,
  236. greater_equal,
  237. greater_equal_,
  238. greater_than,
  239. greater_than_,
  240. is_empty,
  241. is_tensor,
  242. isclose,
  243. less_equal,
  244. less_equal_,
  245. less_than,
  246. less_than_,
  247. logical_and,
  248. logical_and_,
  249. logical_not,
  250. logical_not_,
  251. logical_or,
  252. logical_or_,
  253. logical_xor,
  254. logical_xor_, # noqa: F401
  255. not_equal,
  256. not_equal_, # noqa: F401
  257. )
  258. from .tensor.manipulation import (
  259. as_complex,
  260. as_real,
  261. as_strided,
  262. atleast_1d,
  263. atleast_2d,
  264. atleast_3d,
  265. block_diag,
  266. broadcast_tensors,
  267. broadcast_to,
  268. cast,
  269. cast_,
  270. chunk,
  271. column_stack,
  272. concat,
  273. crop,
  274. diagonal_scatter,
  275. dsplit,
  276. dstack,
  277. expand,
  278. expand_as,
  279. flatten,
  280. flatten_,
  281. flip,
  282. flip as reverse,
  283. gather,
  284. gather_nd,
  285. hsplit,
  286. hstack,
  287. index_add,
  288. index_add_,
  289. index_fill,
  290. index_fill_,
  291. index_put,
  292. index_put_,
  293. masked_fill,
  294. masked_fill_,
  295. masked_scatter,
  296. masked_scatter_,
  297. moveaxis,
  298. put_along_axis,
  299. repeat_interleave,
  300. reshape,
  301. reshape_,
  302. roll,
  303. rot90,
  304. row_stack,
  305. scatter,
  306. scatter_,
  307. scatter_nd,
  308. scatter_nd_add,
  309. select_scatter,
  310. shard_index,
  311. slice,
  312. slice_scatter,
  313. split,
  314. squeeze,
  315. squeeze_,
  316. stack,
  317. strided_slice,
  318. take_along_axis,
  319. tensor_split,
  320. tensordot,
  321. tile,
  322. tolist,
  323. unbind,
  324. unflatten,
  325. unfold,
  326. unique,
  327. unique_consecutive,
  328. unsqueeze,
  329. unsqueeze_,
  330. unstack,
  331. view,
  332. view_as,
  333. vsplit,
  334. vstack,
  335. )
  336. from .tensor.math import ( # noqa: F401
  337. abs,
  338. abs_,
  339. acos,
  340. acos_,
  341. acosh,
  342. acosh_,
  343. add,
  344. add_n,
  345. addmm,
  346. addmm_,
  347. all,
  348. amax,
  349. amin,
  350. angle,
  351. any,
  352. asin,
  353. asin_,
  354. asinh,
  355. asinh_,
  356. atan,
  357. atan2,
  358. atan_,
  359. atanh,
  360. atanh_,
  361. bitwise_left_shift,
  362. bitwise_left_shift_,
  363. bitwise_right_shift,
  364. bitwise_right_shift_,
  365. broadcast_shape,
  366. ceil,
  367. clip,
  368. combinations,
  369. conj,
  370. copysign,
  371. copysign_,
  372. cos,
  373. cos_,
  374. cosh,
  375. cosh_,
  376. count_nonzero,
  377. cummax,
  378. cummin,
  379. cumprod,
  380. cumprod_,
  381. cumsum,
  382. cumsum_,
  383. cumulative_trapezoid,
  384. deg2rad,
  385. diagonal,
  386. diff,
  387. digamma,
  388. digamma_,
  389. divide,
  390. divide_,
  391. erf,
  392. erf_,
  393. erfinv,
  394. exp,
  395. expm1,
  396. expm1_,
  397. floor,
  398. floor_divide,
  399. floor_divide_,
  400. floor_mod,
  401. floor_mod_,
  402. fmax,
  403. fmin,
  404. frac,
  405. frac_,
  406. frexp,
  407. gammainc,
  408. gammainc_,
  409. gammaincc,
  410. gammaincc_,
  411. gammaln,
  412. gammaln_,
  413. gcd,
  414. gcd_,
  415. heaviside,
  416. hypot,
  417. hypot_,
  418. i0,
  419. i0_,
  420. i0e,
  421. i1,
  422. i1e,
  423. increment,
  424. inner,
  425. inverse,
  426. isfinite,
  427. isin,
  428. isinf,
  429. isnan,
  430. isneginf,
  431. isposinf,
  432. isreal,
  433. kron,
  434. lcm,
  435. lcm_,
  436. ldexp,
  437. ldexp_,
  438. lerp,
  439. lgamma,
  440. lgamma_,
  441. log,
  442. log1p,
  443. log1p_,
  444. log2,
  445. log2_,
  446. log10,
  447. log10_,
  448. log_,
  449. logaddexp,
  450. logcumsumexp,
  451. logit,
  452. logit_,
  453. logsumexp,
  454. max,
  455. maximum,
  456. min,
  457. minimum,
  458. mm,
  459. mod,
  460. mod_,
  461. multigammaln,
  462. multigammaln_,
  463. multiplex,
  464. multiply,
  465. multiply_,
  466. nan_to_num,
  467. nan_to_num_,
  468. nanmean,
  469. nansum,
  470. neg,
  471. neg_,
  472. nextafter,
  473. outer,
  474. polygamma,
  475. polygamma_,
  476. pow,
  477. pow_,
  478. prod,
  479. rad2deg,
  480. reciprocal,
  481. reduce_as,
  482. remainder,
  483. remainder_,
  484. renorm,
  485. renorm_,
  486. round,
  487. rsqrt,
  488. scale,
  489. sgn,
  490. sign,
  491. signbit,
  492. sin,
  493. sin_,
  494. sinc,
  495. sinc_,
  496. sinh,
  497. sinh_,
  498. sqrt,
  499. square,
  500. square_,
  501. stanh,
  502. subtract,
  503. sum,
  504. take,
  505. tan,
  506. tan_,
  507. tanh,
  508. tanh_,
  509. trace,
  510. trapezoid,
  511. trunc,
  512. trunc_,
  513. vander,
  514. )
  515. from .tensor.random import (
  516. bernoulli,
  517. bernoulli_,
  518. binomial,
  519. check_shape,
  520. multinomial,
  521. normal,
  522. normal_,
  523. poisson,
  524. rand,
  525. randint,
  526. randint_like,
  527. randn,
  528. randperm,
  529. standard_gamma,
  530. standard_normal,
  531. uniform,
  532. )
  533. from .tensor.search import (
  534. argmax,
  535. argmin,
  536. argsort,
  537. bucketize,
  538. index_sample,
  539. index_select,
  540. kthvalue,
  541. masked_select,
  542. mode,
  543. nonzero,
  544. searchsorted,
  545. sort,
  546. topk,
  547. where,
  548. where_,
  549. )
  550. from .tensor.stat import (
  551. mean,
  552. median,
  553. nanmedian,
  554. nanquantile,
  555. numel,
  556. quantile,
  557. std,
  558. var,
  559. )
  560. from .tensor.to_string import set_printoptions
  561. # CINN has to set a flag to include a lib
  562. if is_compiled_with_cinn():
  563. import os
  564. package_dir = os.path.dirname(os.path.abspath(__file__))
  565. runtime_include_dir = os.path.join(package_dir, "libs")
  566. cuh_file = os.path.join(runtime_include_dir, "cinn_cuda_runtime_source.cuh")
  567. if os.path.exists(cuh_file):
  568. os.environ.setdefault('runtime_include_dir', runtime_include_dir)
  569. if is_compiled_with_cuda():
  570. import os
  571. import platform
  572. if (
  573. platform.system() == 'Linux'
  574. and platform.machine() == 'x86_64'
  575. and paddle.version.with_pip_cuda_libraries == 'ON'
  576. ):
  577. package_dir = os.path.dirname(os.path.abspath(__file__))
  578. nvidia_package_path = package_dir + "/.." + "/nvidia"
  579. set_flags({"FLAGS_nvidia_package_dir": nvidia_package_path})
  580. cublas_lib_path = package_dir + "/.." + "/nvidia/cublas/lib"
  581. set_flags({"FLAGS_cublas_dir": cublas_lib_path})
  582. cudnn_lib_path = package_dir + "/.." + "/nvidia/cudnn/lib"
  583. set_flags({"FLAGS_cudnn_dir": cudnn_lib_path})
  584. curand_lib_path = package_dir + "/.." + "/nvidia/curand/lib"
  585. set_flags({"FLAGS_curand_dir": curand_lib_path})
  586. cusolver_lib_path = package_dir + "/.." + "/nvidia/cusolver/lib"
  587. set_flags({"FLAGS_cusolver_dir": cusolver_lib_path})
  588. cusparse_lib_path = package_dir + "/.." + "/nvidia/cusparse/lib"
  589. set_flags({"FLAGS_cusparse_dir": cusparse_lib_path})
  590. nccl_lib_path = package_dir + "/.." + "/nvidia/nccl/lib"
  591. set_flags({"FLAGS_nccl_dir": nccl_lib_path})
  592. cupti_dir_lib_path = package_dir + "/.." + "/nvidia/cuda_cupti/lib"
  593. set_flags({"FLAGS_cupti_dir": cupti_dir_lib_path})
  594. elif (
  595. platform.system() == 'Windows'
  596. and platform.machine() in ('x86_64', 'AMD64')
  597. and paddle.version.with_pip_cuda_libraries == 'ON'
  598. ):
  599. package_dir = os.path.dirname(os.path.abspath(__file__))
  600. win_cuda_bin_path = package_dir + "\\.." + "\\nvidia"
  601. set_flags({"FLAGS_win_cuda_bin_dir": win_cuda_bin_path})
  602. import sys
  603. if sys.platform == 'win32':
  604. pfiles_path = os.getenv('ProgramFiles', 'C:\\Program Files')
  605. py_dll_path = os.path.join(sys.exec_prefix, 'Library', 'bin')
  606. th_dll_path = os.path.join(os.path.dirname(__file__), 'libs')
  607. site_cuda_base_path = os.path.join(
  608. os.path.dirname(__file__), '..', 'nvidia'
  609. )
  610. site_cuda_list = [
  611. "cublas",
  612. "cuda_nvrtc",
  613. "cuda_runtime",
  614. "cudnn",
  615. "cufft",
  616. "curand",
  617. "cusolver",
  618. "cusparse",
  619. "nvjitlink",
  620. ]
  621. if sys.exec_prefix != sys.base_exec_prefix:
  622. base_py_dll_path = os.path.join(
  623. sys.base_exec_prefix, 'Library', 'bin'
  624. )
  625. else:
  626. base_py_dll_path = ''
  627. dll_paths = list(
  628. filter(
  629. os.path.exists, [th_dll_path, py_dll_path, base_py_dll_path]
  630. )
  631. )
  632. for site_cuda_package in site_cuda_list:
  633. site_cuda_path = os.path.join(
  634. site_cuda_base_path, site_cuda_package, 'bin'
  635. )
  636. if os.path.exists(site_cuda_path):
  637. dll_paths.append(site_cuda_path)
  638. import ctypes
  639. kernel32 = ctypes.WinDLL('kernel32.dll', use_last_error=True)
  640. with_load_library_flags = hasattr(kernel32, 'AddDllDirectory')
  641. prev_error_mode = kernel32.SetErrorMode(0x0001)
  642. kernel32.LoadLibraryW.restype = ctypes.c_void_p
  643. if with_load_library_flags:
  644. kernel32.LoadLibraryExW.restype = ctypes.c_void_p
  645. for dll_path in dll_paths:
  646. os.add_dll_directory(dll_path)
  647. try:
  648. ctypes.CDLL('vcruntime140.dll')
  649. ctypes.CDLL('msvcp140.dll')
  650. ctypes.CDLL('vcruntime140_1.dll')
  651. except OSError:
  652. import logging
  653. logging.error(
  654. '''Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.
  655. It can be downloaded at https://aka.ms/vs/16/release/vc_redist.x64.exe'''
  656. )
  657. import glob
  658. dlls = glob.glob(os.path.join(th_dll_path, '*.dll'))
  659. for site_cuda_package in site_cuda_list:
  660. site_cuda_path = os.path.join(
  661. site_cuda_base_path, site_cuda_package, 'bin'
  662. )
  663. if os.path.exists(site_cuda_path):
  664. dlls.extend(
  665. glob.glob(os.path.join(site_cuda_path, '*.dll'))
  666. )
  667. # Not load 32 bit dlls in 64 bit python.
  668. dlls = [dll for dll in dlls if '32_' not in dll]
  669. path_patched = False
  670. for dll in dlls:
  671. is_loaded = False
  672. if with_load_library_flags:
  673. res = kernel32.LoadLibraryExW(dll, None, 0x00001100)
  674. last_error = ctypes.get_last_error()
  675. if res is None and last_error != 126:
  676. err = ctypes.WinError(last_error)
  677. err.strerror += f' Error loading "{dll}" or one of its dependencies.'
  678. raise err
  679. elif res is not None:
  680. is_loaded = True
  681. if not is_loaded:
  682. if not path_patched:
  683. prev_path = os.environ['PATH']
  684. os.environ['PATH'] = ';'.join(
  685. dll_paths + [os.environ['PATH']]
  686. )
  687. path_patched = True
  688. res = kernel32.LoadLibraryW(dll)
  689. if path_patched:
  690. os.environ['PATH'] = prev_path
  691. if res is None:
  692. err = ctypes.WinError(ctypes.get_last_error())
  693. err.strerror += f' Error loading "{dll}" or one of its dependencies.'
  694. raise err
  695. kernel32.SetErrorMode(prev_error_mode)
  696. disable_static()
  697. from .pir_utils import IrGuard
  698. ir_guard = IrGuard()
  699. ir_guard._switch_to_pir()
  700. __all__ = [
  701. 'block_diag',
  702. 'iinfo',
  703. 'finfo',
  704. 'dtype',
  705. 'uint8',
  706. 'int8',
  707. 'int16',
  708. 'int32',
  709. 'int64',
  710. 'float16',
  711. 'float32',
  712. 'float64',
  713. 'bfloat16',
  714. 'bool',
  715. 'complex64',
  716. 'complex128',
  717. 'addmm',
  718. 'addmm_',
  719. 'allclose',
  720. 'isclose',
  721. 't',
  722. 't_',
  723. 'add',
  724. 'subtract',
  725. 'diag',
  726. 'diagflat',
  727. 'diag_embed',
  728. 'isnan',
  729. 'scatter_nd_add',
  730. 'unstack',
  731. 'get_default_dtype',
  732. 'save',
  733. 'multinomial',
  734. 'get_cuda_rng_state',
  735. 'get_rng_state',
  736. 'rank',
  737. 'empty_like',
  738. 'eye',
  739. 'cumsum',
  740. 'cumsum_',
  741. 'cummax',
  742. 'cummin',
  743. 'cumprod',
  744. 'cumprod_',
  745. 'logaddexp',
  746. 'logcumsumexp',
  747. 'logit',
  748. 'logit_',
  749. 'LazyGuard',
  750. 'sign',
  751. 'is_empty',
  752. 'equal',
  753. 'equal_',
  754. 'equal_all',
  755. 'is_tensor',
  756. 'is_complex',
  757. 'is_integer',
  758. 'cross',
  759. 'where',
  760. 'where_',
  761. 'log1p',
  762. 'cos',
  763. 'cos_',
  764. 'tan',
  765. 'tan_',
  766. 'mean',
  767. 'mode',
  768. 'mv',
  769. 'in_dynamic_mode',
  770. 'min',
  771. 'amin',
  772. 'any',
  773. 'slice',
  774. 'slice_scatter',
  775. 'normal',
  776. 'normal_',
  777. 'logsumexp',
  778. 'full',
  779. 'unsqueeze',
  780. 'unsqueeze_',
  781. 'argmax',
  782. 'Model',
  783. 'summary',
  784. 'flops',
  785. 'sort',
  786. 'searchsorted',
  787. 'bucketize',
  788. 'split',
  789. 'tensor_split',
  790. 'hsplit',
  791. 'dsplit',
  792. 'vsplit',
  793. 'logical_and',
  794. 'logical_and_',
  795. 'full_like',
  796. 'less_than',
  797. 'less_than_',
  798. 'kron',
  799. 'clip',
  800. 'Tensor',
  801. 'crop',
  802. 'ParamAttr',
  803. 'stanh',
  804. 'randint',
  805. 'randint_like',
  806. 'assign',
  807. 'gather',
  808. 'scale',
  809. 'zeros',
  810. 'rsqrt',
  811. 'squeeze',
  812. 'squeeze_',
  813. 'to_tensor',
  814. 'gather_nd',
  815. 'isin',
  816. 'isinf',
  817. 'isneginf',
  818. 'isposinf',
  819. 'isreal',
  820. 'uniform',
  821. 'floor_divide',
  822. 'floor_divide_',
  823. 'remainder',
  824. 'remainder_',
  825. 'floor_mod',
  826. 'floor_mod_',
  827. 'roll',
  828. 'batch',
  829. 'max',
  830. 'amax',
  831. 'logical_or',
  832. 'logical_or_',
  833. 'bitwise_and',
  834. 'bitwise_and_',
  835. 'bitwise_or',
  836. 'bitwise_or_',
  837. 'bitwise_xor',
  838. 'bitwise_xor_',
  839. 'bitwise_not',
  840. 'bitwise_not_',
  841. 'mm',
  842. 'flip',
  843. 'rot90',
  844. 'bincount',
  845. 'histogram',
  846. 'histogramdd',
  847. 'multiplex',
  848. 'CUDAPlace',
  849. 'empty',
  850. 'shape',
  851. 'real',
  852. 'imag',
  853. 'is_floating_point',
  854. 'complex',
  855. 'reciprocal',
  856. 'rand',
  857. 'less_equal',
  858. 'less_equal_',
  859. 'triu',
  860. 'triu_',
  861. 'sin',
  862. 'sin_',
  863. 'dist',
  864. 'cdist',
  865. 'pdist',
  866. 'unbind',
  867. 'meshgrid',
  868. 'arange',
  869. 'load',
  870. 'numel',
  871. 'median',
  872. 'nanmedian',
  873. 'quantile',
  874. 'nanquantile',
  875. 'no_grad',
  876. 'enable_grad',
  877. 'set_grad_enabled',
  878. 'is_grad_enabled',
  879. 'mod',
  880. 'mod_',
  881. 'abs',
  882. 'abs_',
  883. 'tril',
  884. 'tril_',
  885. 'pow',
  886. 'pow_',
  887. 'zeros_like',
  888. 'maximum',
  889. 'topk',
  890. 'index_select',
  891. 'CPUPlace',
  892. 'matmul',
  893. 'seed',
  894. 'acos',
  895. 'acos_',
  896. 'logical_xor',
  897. 'exp',
  898. 'expm1',
  899. 'expm1_',
  900. 'bernoulli',
  901. 'bernoulli_',
  902. 'binomial',
  903. 'poisson',
  904. 'standard_gamma',
  905. 'sinh',
  906. 'sinh_',
  907. 'sinc',
  908. 'sinc_',
  909. 'round',
  910. 'DataParallel',
  911. 'argmin',
  912. 'prod',
  913. 'broadcast_shape',
  914. 'conj',
  915. 'neg',
  916. 'neg_',
  917. 'lgamma',
  918. 'lgamma_',
  919. 'gammaincc',
  920. 'gammaincc_',
  921. 'gammainc',
  922. 'gammainc_',
  923. 'lerp',
  924. 'erfinv',
  925. 'inner',
  926. 'outer',
  927. 'square',
  928. 'square_',
  929. 'divide',
  930. 'divide_',
  931. 'gammaln',
  932. 'gammaln_',
  933. 'ceil',
  934. 'atan',
  935. 'atan_',
  936. 'atan2',
  937. 'rad2deg',
  938. 'deg2rad',
  939. 'gcd',
  940. 'gcd_',
  941. 'lcm',
  942. 'lcm_',
  943. 'expand',
  944. 'broadcast_to',
  945. 'ones_like',
  946. 'index_sample',
  947. 'cast',
  948. 'cast_',
  949. 'grad',
  950. 'all',
  951. 'ones',
  952. 'not_equal',
  953. 'sum',
  954. 'reduce_as',
  955. 'nansum',
  956. 'nanmean',
  957. 'count_nonzero',
  958. 'tile',
  959. 'greater_equal',
  960. 'greater_equal_',
  961. 'isfinite',
  962. 'create_parameter',
  963. 'dot',
  964. 'increment',
  965. 'erf',
  966. 'erf_',
  967. 'bmm',
  968. 'chunk',
  969. 'tolist',
  970. 'tensordot',
  971. 'greater_than',
  972. 'greater_than_',
  973. 'shard_index',
  974. 'argsort',
  975. 'tanh',
  976. 'tanh_',
  977. 'transpose',
  978. 'transpose_',
  979. 'cauchy_',
  980. 'geometric_',
  981. 'randn',
  982. 'strided_slice',
  983. 'unique',
  984. 'unique_consecutive',
  985. 'set_cuda_rng_state',
  986. 'set_rng_state',
  987. 'set_printoptions',
  988. 'std',
  989. 'flatten',
  990. 'flatten_',
  991. 'asin',
  992. 'multiply',
  993. 'multiply_',
  994. 'disable_static',
  995. 'masked_select',
  996. 'var',
  997. 'trace',
  998. 'enable_static',
  999. 'scatter_nd',
  1000. 'set_default_dtype',
  1001. 'disable_signal_handler',
  1002. 'expand_as',
  1003. 'stack',
  1004. 'hstack',
  1005. 'vstack',
  1006. 'dstack',
  1007. 'column_stack',
  1008. 'row_stack',
  1009. 'sqrt',
  1010. 'randperm',
  1011. 'linspace',
  1012. 'logspace',
  1013. 'reshape',
  1014. 'reshape_',
  1015. 'atleast_1d',
  1016. 'atleast_2d',
  1017. 'atleast_3d',
  1018. 'reverse',
  1019. 'nonzero',
  1020. 'CUDAPinnedPlace',
  1021. 'logical_not',
  1022. 'logical_not_',
  1023. 'add_n',
  1024. 'minimum',
  1025. 'scatter',
  1026. 'scatter_',
  1027. 'floor',
  1028. 'cosh',
  1029. 'log',
  1030. 'log_',
  1031. 'log2',
  1032. 'log2_',
  1033. 'log10',
  1034. 'log10_',
  1035. 'concat',
  1036. 'check_shape',
  1037. 'trunc',
  1038. 'trunc_',
  1039. 'frac',
  1040. 'frac_',
  1041. 'digamma',
  1042. 'digamma_',
  1043. 'standard_normal',
  1044. 'diagonal',
  1045. 'broadcast_tensors',
  1046. 'einsum',
  1047. 'set_flags',
  1048. 'get_flags',
  1049. 'asinh',
  1050. 'acosh',
  1051. 'atanh',
  1052. 'as_complex',
  1053. 'as_real',
  1054. 'diff',
  1055. 'angle',
  1056. 'fmax',
  1057. 'fmin',
  1058. 'moveaxis',
  1059. 'repeat_interleave',
  1060. 'clone',
  1061. 'kthvalue',
  1062. 'renorm',
  1063. 'renorm_',
  1064. 'take_along_axis',
  1065. 'put_along_axis',
  1066. 'select_scatter',
  1067. 'multigammaln',
  1068. 'multigammaln_',
  1069. 'nan_to_num',
  1070. 'nan_to_num_',
  1071. 'heaviside',
  1072. 'tril_indices',
  1073. 'index_add',
  1074. "index_add_",
  1075. "index_put",
  1076. "index_put_",
  1077. 'sgn',
  1078. 'triu_indices',
  1079. 'take',
  1080. 'frexp',
  1081. 'ldexp',
  1082. 'ldexp_',
  1083. 'trapezoid',
  1084. 'cumulative_trapezoid',
  1085. 'polar',
  1086. 'vander',
  1087. 'unflatten',
  1088. 'as_strided',
  1089. 'view',
  1090. 'view_as',
  1091. 'unfold',
  1092. 'nextafter',
  1093. 'i0',
  1094. 'i0_',
  1095. 'i0e',
  1096. 'i1',
  1097. 'i1e',
  1098. 'polygamma',
  1099. 'polygamma_',
  1100. 'copysign',
  1101. 'copysign_',
  1102. 'bitwise_left_shift',
  1103. 'bitwise_left_shift_',
  1104. 'bitwise_right_shift',
  1105. 'bitwise_right_shift_',
  1106. 'masked_fill',
  1107. 'masked_fill_',
  1108. 'masked_scatter',
  1109. 'masked_scatter_',
  1110. 'hypot',
  1111. 'hypot_',
  1112. 'index_fill',
  1113. "index_fill_",
  1114. 'diagonal_scatter',
  1115. 'combinations',
  1116. 'signbit',
  1117. ]