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

4 years ago
4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """Deep learning and Reinforcement learning library for Researchers and Engineers"""
  4. # import backend
  5. from .backend import *
  6. # from .backend import ops
  7. # import dataflow
  8. # from .dataflow import *
  9. import os
  10. from distutils.version import LooseVersion
  11. from tensorlayer.package_info import (
  12. VERSION, __contact_emails__, __contact_names__, __description__, __download_url__, __homepage__, __keywords__,
  13. __license__, __package_name__, __repository_url__, __shortversion__, __version__
  14. )
  15. if 'TENSORLAYER_PACKAGE_BUILDING' not in os.environ:
  16. try:
  17. import tensorflow
  18. except Exception as e:
  19. raise ImportError(
  20. "Tensorflow is not installed, please install it with the one of the following commands:\n"
  21. " - `pip install --upgrade tensorflow`\n"
  22. " - `pip install --upgrade tensorflow-gpu`"
  23. )
  24. if ("SPHINXBUILD" not in os.environ and "READTHEDOCS" not in os.environ and
  25. LooseVersion(tensorflow.__version__) < LooseVersion("2.0.0")):
  26. raise RuntimeError(
  27. "TensorLayer does not support Tensorflow version older than 2.0.0.\n"
  28. "Please update Tensorflow with:\n"
  29. " - `pip install --upgrade tensorflow`\n"
  30. " - `pip install --upgrade tensorflow-gpu`"
  31. )
  32. from tensorlayer import array_ops
  33. from tensorlayer import cost
  34. from tensorlayer import decorators
  35. from tensorlayer import files
  36. from tensorlayer import initializers
  37. from tensorlayer import iterate
  38. from tensorlayer import layers
  39. from tensorlayer import lazy_imports
  40. from tensorlayer import logging
  41. from tensorlayer import models
  42. from tensorlayer import optimizers
  43. from tensorlayer import rein
  44. from tensorlayer import utils
  45. from tensorlayer import dataflow
  46. from tensorlayer import metric
  47. from tensorlayer import vision
  48. from tensorlayer.lazy_imports import LazyImport
  49. # Lazy Imports
  50. db = LazyImport("tensorlayer.db")
  51. distributed = LazyImport("tensorlayer.distributed")
  52. nlp = LazyImport("tensorlayer.nlp")
  53. prepro = LazyImport("tensorlayer.prepro")
  54. utils = LazyImport("tensorlayer.utils")
  55. visualize = LazyImport("tensorlayer.visualize")
  56. # alias
  57. vis = visualize
  58. alphas = array_ops.alphas
  59. alphas_like = array_ops.alphas_like
  60. # global vars
  61. global_flag = {}
  62. global_dict = {}

TensorLayer3.0 是一款兼容多种深度学习框架为计算后端的深度学习库。计划兼容TensorFlow, Pytorch, MindSpore, Paddle.