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 2.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. isinf,
  25. isnan,
  26. less,
  27. less_equal,
  28. log,
  29. maximum,
  30. minimum,
  31. mod,
  32. multiply,
  33. power,
  34. relu,
  35. round,
  36. sigmoid,
  37. sin,
  38. subtract,
  39. tanh,
  40. )
  41. from .graph import add_extra_vardep, add_update, grad
  42. from .loss import (
  43. binary_cross_entropy,
  44. cross_entropy,
  45. cross_entropy_with_softmax,
  46. l1_loss,
  47. nll_loss,
  48. square_loss,
  49. triplet_margin_loss,
  50. )
  51. from .math import argmax, argmin, max, mean, min, norm, normalize, prod, sqrt, sum
  52. from .nn import (
  53. assert_equal,
  54. avg_pool2d,
  55. batch_norm2d,
  56. batched_matrix_mul,
  57. conv2d,
  58. conv_transpose2d,
  59. dropout,
  60. embedding,
  61. eye,
  62. flatten,
  63. identity,
  64. indexing_one_hot,
  65. interpolate,
  66. leaky_relu,
  67. linear,
  68. local_conv2d,
  69. matrix_mul,
  70. max_pool2d,
  71. one_hot,
  72. prelu,
  73. roi_align,
  74. roi_pooling,
  75. softmax,
  76. warp_perspective,
  77. )
  78. from .quantized import conv_bias_activation
  79. from .sort import argsort, sort, top_k
  80. from .tensor import (
  81. add_axis,
  82. arange,
  83. broadcast_to,
  84. concat,
  85. cond_take,
  86. dimshuffle,
  87. gather,
  88. linspace,
  89. remove_axis,
  90. reshape,
  91. scatter,
  92. shapeof,
  93. transpose,
  94. where,
  95. zeros_like,
  96. )
  97. from .utils import accuracy, zero_grad
  98. # delete namespace
  99. # pylint: disable=undefined-variable
  100. del elemwise, graph, loss, math, nn, tensor # type: ignore[name-defined]

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