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.

version.py 1.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. """version information for MegBrain package"""
  10. import collections
  11. from . import mgb as _mgb
  12. class Version(
  13. collections.namedtuple("VersionBase", ["major", "minor", "patch", "dev"])
  14. ):
  15. """simple sematic version object"""
  16. @classmethod
  17. def __normalize(cls, v):
  18. if isinstance(v, str):
  19. v = v.split(".")
  20. a, b, c = map(int, v)
  21. return cls(a, b, c)
  22. def __eq__(self, rhs):
  23. return super().__eq__(self.__normalize(rhs))
  24. def __ne__(self, rhs):
  25. return super().__ne__(self.__normalize(rhs))
  26. def __lt__(self, rhs):
  27. return super().__lt__(self.__normalize(rhs))
  28. def __le__(self, rhs):
  29. return super().__le__(self.__normalize(rhs))
  30. def __gt__(self, rhs):
  31. return super().__gt__(self.__normalize(rhs))
  32. def __ge__(self, rhs):
  33. return super().__ge__(self.__normalize(rhs))
  34. def __str__(self):
  35. rst = "{}.{}.{}".format(self.major, self.minor, self.patch)
  36. if self.dev:
  37. rst += "-dev{}".format(self.dev)
  38. return rst
  39. Version.__new__.__defaults__ = (0,) # dev defaults to 0
  40. version_info = Version(*_mgb._get_mgb_version())
  41. __version__ = str(version_info)

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