You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 1.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # -*- coding: utf-8 -*-
  2. # MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  3. #
  4. # Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
  5. #
  6. # Unless required by applicable law or agreed to in writing,
  7. # software distributed under the License is distributed on an
  8. # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. # pylint: disable=redefined-builtin
  10. from .elemwise import (
  11. abs,
  12. add,
  13. arccos,
  14. arcsin,
  15. ceil,
  16. clamp,
  17. cos,
  18. divide,
  19. equal,
  20. exp,
  21. floor,
  22. greater,
  23. greater_equal,
  24. less,
  25. less_equal,
  26. log,
  27. maximum,
  28. minimum,
  29. mod,
  30. multiply,
  31. power,
  32. relu,
  33. round,
  34. sigmoid,
  35. sin,
  36. subtract,
  37. tanh,
  38. )
  39. from .graph import add_extra_vardep, add_update, grad
  40. from .loss import (
  41. binary_cross_entropy,
  42. cross_entropy,
  43. cross_entropy_with_softmax,
  44. l1_loss,
  45. nll_loss,
  46. square_loss,
  47. triplet_margin_loss,
  48. )
  49. from .math import argmax, argmin, max, mean, min, norm, prod, sqrt, sum
  50. from .nn import (
  51. assert_equal,
  52. avg_pool2d,
  53. batch_norm2d,
  54. batched_matrix_mul,
  55. conv2d,
  56. conv_transpose2d,
  57. dropout,
  58. embedding,
  59. eye,
  60. flatten,
  61. identity,
  62. indexing_one_hot,
  63. interpolate,
  64. leaky_relu,
  65. linear,
  66. matrix_mul,
  67. max_pool2d,
  68. one_hot,
  69. prelu,
  70. roi_align,
  71. roi_pooling,
  72. softmax,
  73. warp_perspective,
  74. )
  75. from .sort import argsort, sort, top_k
  76. from .tensor import (
  77. add_axis,
  78. arange,
  79. broadcast_to,
  80. concat,
  81. dimshuffle,
  82. gather,
  83. linspace,
  84. remove_axis,
  85. reshape,
  86. scatter,
  87. shapeof,
  88. transpose,
  89. where,
  90. zeros_like,
  91. )
  92. from .utils import accuracy, zero_grad
  93. # delete namespace
  94. # pylint: disable=undefined-variable
  95. del elemwise, graph, loss, math, nn, tensor # type: ignore[name-defined]

MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台