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.

operator.py 773 B

12345678910111213141516171819202122232425262728293031323334353637
  1. %pythoncode {
  2. __owner_graph = None
  3. @property
  4. def owner_graph(self):
  5. """get the owner graph; note that a reference would be kept in this var"""
  6. if self.__owner_graph is None:
  7. self.__owner_graph = self._get_owner_graph()
  8. return self.__owner_graph
  9. @property
  10. def id(self):
  11. """an integer identifier for this opr that is unique in the computing
  12. graph"""
  13. return int(self._get_id())
  14. @property
  15. def name(self):
  16. return self._get_name()
  17. @property
  18. def params(self):
  19. import json
  20. return json.loads(self._get_params())
  21. @property
  22. def inputs(self):
  23. return tuple(self._get_inputs())
  24. @property
  25. def outputs(self):
  26. return tuple(self._get_outputs())
  27. def __repr__(self):
  28. return 'Operator(id={},name={})'.format(self.id, self.name)
  29. }

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