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.

megbrain_serialize_TensorValueDumperContext.py 872 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. %pythoncode {
  2. @property
  3. def name(self):
  4. """name of the param
  5. :type: str
  6. """
  7. return str(self._name())
  8. @property
  9. def type(self):
  10. """operator type
  11. :type: str
  12. """
  13. return str(self._type())
  14. @property
  15. def value(self):
  16. """numerical value of the param
  17. :type: :class:`numpy.ndarray`
  18. """
  19. return self._value()
  20. def write(self, buf):
  21. """write raw data to the output file
  22. :param buf: value to be written
  23. :type buf: :class:`bytes`
  24. :return: self
  25. """
  26. assert type(buf) is bytes, 'bad value: {!r}'.format(type(buf))
  27. self._write(buf)
  28. def write_default(self):
  29. """dump the numerical value in default format
  30. :return: self
  31. """
  32. self._write_default()
  33. return self
  34. }

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