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.8 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. broadcast_to,
  79. concat,
  80. dimshuffle,
  81. gather,
  82. linspace,
  83. remove_axis,
  84. reshape,
  85. scatter,
  86. shapeof,
  87. transpose,
  88. where,
  89. zeros_like,
  90. )
  91. from .utils import accuracy, zero_grad
  92. # delete namespace
  93. # pylint: disable=undefined-variable
  94. del elemwise, graph, loss, math, nn, tensor # type: ignore[name-defined]

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