• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tf_export.tf_export函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tensorflow.python.util.tf_export.tf_export函数的典型用法代码示例。如果您正苦于以下问题:Python tf_export函数的具体用法?Python tf_export怎么用?Python tf_export使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了tf_export函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: testExportMultipleFunctions

 def testExportMultipleFunctions(self):
   export_decorator1 = tf_export.tf_export('nameA', 'nameB')
   export_decorator2 = tf_export.tf_export('nameC', 'nameD')
   decorated_function1 = export_decorator1(_test_function)
   decorated_function2 = export_decorator2(_test_function2)
   self.assertEquals(decorated_function1, _test_function)
   self.assertEquals(decorated_function2, _test_function2)
   self.assertEquals(('nameA', 'nameB'), decorated_function1._tf_api_names)
   self.assertEquals(('nameC', 'nameD'), decorated_function2._tf_api_names)
开发者ID:supercjn,项目名称:tensorflow,代码行数:9,代码来源:tf_export_test.py


示例2: setUp

 def setUp(self):
   # Add fake op to a module that has 'tensorflow' in the name.
   sys.modules[_MODULE_NAME] = imp.new_module(_MODULE_NAME)
   setattr(sys.modules[_MODULE_NAME], 'test_op', test_op)
   setattr(sys.modules[_MODULE_NAME], 'TestClass', TestClass)
   test_op.__module__ = _MODULE_NAME
   TestClass.__module__ = _MODULE_NAME
   tf_export('consts._TEST_CONSTANT').export_constant(
       _MODULE_NAME, '_TEST_CONSTANT')
开发者ID:dan-lennox,项目名称:tensorflow,代码行数:9,代码来源:create_python_api_test.py


示例3: testExportClasses

  def testExportClasses(self):
    export_decorator_a = tf_export.tf_export('TestClassA1')
    export_decorator_a(TestClassA)
    self.assertEquals(('TestClassA1',), TestClassA._tf_api_names)
    self.assertTrue('_tf_api_names' not in TestClassB.__dict__)

    export_decorator_b = tf_export.tf_export('TestClassB1')
    export_decorator_b(TestClassB)
    self.assertEquals(('TestClassA1',), TestClassA._tf_api_names)
    self.assertEquals(('TestClassB1',), TestClassB._tf_api_names)
开发者ID:supercjn,项目名称:tensorflow,代码行数:10,代码来源:tf_export_test.py


示例4: testRaisesExceptionIfInvalidSymbolName

  def testRaisesExceptionIfInvalidSymbolName(self):
    # TensorFlow code is not allowed to export symbols under package
    # tf.estimator
    with self.assertRaises(tf_export.InvalidSymbolNameError):
      tf_export.tf_export('estimator.invalid')

    # All symbols exported by Estimator must be under tf.estimator package.
    with self.assertRaises(tf_export.InvalidSymbolNameError):
      tf_export.estimator_export('invalid')
    with self.assertRaises(tf_export.InvalidSymbolNameError):
      tf_export.estimator_export('Estimator.invalid')
    with self.assertRaises(tf_export.InvalidSymbolNameError):
      tf_export.estimator_export('invalid.estimator')
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:13,代码来源:tf_export_test.py


示例5: testExportSingleConstant

  def testExportSingleConstant(self):
    module1 = self._CreateMockModule('module1')

    export_decorator = tf_export.tf_export('NAME_A', 'NAME_B')
    export_decorator.export_constant('module1', 'test_constant')
    self.assertEquals([(('NAME_A', 'NAME_B'), 'test_constant')],
                      module1._tf_api_constants)
开发者ID:supercjn,项目名称:tensorflow,代码行数:7,代码来源:tf_export_test.py


示例6: testExportSingleFunction

 def testExportSingleFunction(self):
   export_decorator = tf_export.tf_export('nameA', 'nameB')
   decorated_function = export_decorator(_test_function)
   self.assertEquals(decorated_function, _test_function)
   self.assertEquals(('nameA', 'nameB'), decorated_function._tf_api_names)
   self.assertEquals(['nameA', 'nameB'],
                     tf_export.get_v1_names(decorated_function))
   self.assertEquals(['nameA', 'nameB'],
                     tf_export.get_v2_names(decorated_function))
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:9,代码来源:tf_export_test.py


示例7: testExportMultipleConstants

  def testExportMultipleConstants(self):
    module1 = self._CreateMockModule('module1')
    module2 = self._CreateMockModule('module2')

    test_constant1 = 123
    test_constant2 = 'abc'
    test_constant3 = 0.5

    export_decorator1 = tf_export.tf_export('NAME_A', 'NAME_B')
    export_decorator2 = tf_export.tf_export('NAME_C', 'NAME_D')
    export_decorator3 = tf_export.tf_export('NAME_E', 'NAME_F')
    export_decorator1.export_constant('module1', test_constant1)
    export_decorator2.export_constant('module2', test_constant2)
    export_decorator3.export_constant('module2', test_constant3)
    self.assertEquals([(('NAME_A', 'NAME_B'), 123)],
                      module1._tf_api_constants)
    self.assertEquals([(('NAME_C', 'NAME_D'), 'abc'),
                       (('NAME_E', 'NAME_F'), 0.5)],
                      module2._tf_api_constants)
开发者ID:supercjn,项目名称:tensorflow,代码行数:19,代码来源:tf_export_test.py


示例8: testOverridesFunction

  def testOverridesFunction(self):
    _test_function2._tf_api_names = ['abc']

    export_decorator = tf_export.tf_export(
        'nameA', 'nameB', overrides=[_test_function2])
    export_decorator(_test_function)

    # _test_function overrides _test_function2. So, _tf_api_names
    # should be removed from _test_function2.
    self.assertFalse(hasattr(_test_function2, '_tf_api_names'))
开发者ID:supercjn,项目名称:tensorflow,代码行数:10,代码来源:tf_export_test.py


示例9: testMultipleDecorators

  def testMultipleDecorators(self):
    def get_wrapper(func):
      def wrapper(*unused_args, **unused_kwargs):
        pass
      return tf_decorator.make_decorator(func, wrapper)
    decorated_function = get_wrapper(_test_function)

    export_decorator = tf_export.tf_export('nameA', 'nameB')
    exported_function = export_decorator(decorated_function)
    self.assertEquals(decorated_function, exported_function)
    self.assertEquals(('nameA', 'nameB'), _test_function._tf_api_names)
开发者ID:supercjn,项目名称:tensorflow,代码行数:11,代码来源:tf_export_test.py


示例10: testExportClassInEstimator

  def testExportClassInEstimator(self):
    export_decorator_a = tf_export.tf_export('TestClassA1')
    export_decorator_a(TestClassA)
    self.assertEquals(('TestClassA1',), TestClassA._tf_api_names)

    export_decorator_b = tf_export.estimator_export(
        'estimator.TestClassB1')
    export_decorator_b(TestClassB)
    self.assertTrue('_tf_api_names' not in TestClassB.__dict__)
    self.assertEquals(('TestClassA1',), TestClassA._tf_api_names)
    self.assertEquals(['TestClassA1'], tf_export.get_v1_names(TestClassA))
    self.assertEquals(['estimator.TestClassB1'],
                      tf_export.get_v1_names(TestClassB))
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:13,代码来源:tf_export_test.py


示例11: tf_export

from tensorflow.python.keras import activations
from tensorflow.python.keras import applications
from tensorflow.python.keras import backend
from tensorflow.python.keras import callbacks
from tensorflow.python.keras import constraints
from tensorflow.python.keras import datasets
from tensorflow.python.keras import estimator
from tensorflow.python.keras import initializers
from tensorflow.python.keras import layers
from tensorflow.python.keras import losses
from tensorflow.python.keras import metrics
from tensorflow.python.keras import models
from tensorflow.python.keras import optimizers
from tensorflow.python.keras import preprocessing
from tensorflow.python.keras import regularizers
from tensorflow.python.keras import utils
from tensorflow.python.keras import wrappers
from tensorflow.python.keras.layers import Input
from tensorflow.python.keras.models import Model
from tensorflow.python.keras.models import Sequential

from tensorflow.python.util.tf_export import tf_export

__version__ = '2.2.4-tf'

tf_export('keras.__version__').export_constant(__name__, '__version__')

del absolute_import
del division
del print_function
开发者ID:JonathanRaiman,项目名称:tensorflow,代码行数:30,代码来源:__init__.py


示例12: tf_export

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python import pywrap_tensorflow
from tensorflow.python.util.tf_export import tf_export

__version__ = pywrap_tensorflow.__version__
__git_version__ = pywrap_tensorflow.__git_version__
__compiler_version__ = pywrap_tensorflow.__compiler_version__
__cxx11_abi_flag__ = pywrap_tensorflow.__cxx11_abi_flag__
__monolithic_build__ = pywrap_tensorflow.__monolithic_build__

VERSION = __version__
tf_export("VERSION").export_constant(__name__, "VERSION")
GIT_VERSION = __git_version__
tf_export("GIT_VERSION").export_constant(__name__, "GIT_VERSION")
COMPILER_VERSION = __compiler_version__
tf_export("COMPILER_VERSION").export_constant(__name__, "COMPILER_VERSION")
CXX11_ABI_FLAG = __cxx11_abi_flag__
MONOLITHIC_BUILD = __monolithic_build__

GRAPH_DEF_VERSION = pywrap_tensorflow.GRAPH_DEF_VERSION
tf_export("GRAPH_DEF_VERSION").export_constant(__name__, "GRAPH_DEF_VERSION")
GRAPH_DEF_VERSION_MIN_CONSUMER = (
    pywrap_tensorflow.GRAPH_DEF_VERSION_MIN_CONSUMER)
tf_export("GRAPH_DEF_VERSION_MIN_CONSUMER").export_constant(
    __name__, "GRAPH_DEF_VERSION_MIN_CONSUMER")
GRAPH_DEF_VERSION_MIN_PRODUCER = (
    pywrap_tensorflow.GRAPH_DEF_VERSION_MIN_PRODUCER)
开发者ID:NevesLucas,项目名称:tensorflow,代码行数:30,代码来源:versions.py


示例13: tf_export

#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# pylint: disable=invalid-name
"""Inception V3 model for Keras.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from keras_applications import inception_v3
from tensorflow.python.util.tf_export import tf_export

InceptionV3 = inception_v3.InceptionV3
decode_predictions = inception_v3.decode_predictions
preprocess_input = inception_v3.preprocess_input

tf_export('keras.applications.inception_v3.InceptionV3',
          'keras.applications.InceptionV3')(InceptionV3)
tf_export('keras.applications.inception_v3.preprocess_input')(preprocess_input)
开发者ID:ZhangXinNan,项目名称:tensorflow,代码行数:30,代码来源:inception_v3.py


示例14: DType

    np.bool8: (False, True),
    np.uint8: (0, 255),
    np.uint16: (0, 65535),
    np.int8: (-128, 127),
    np.int16: (-32768, 32767),
    np.int64: (-2**63, 2**63 - 1),
    np.uint64: (0, 2**64 - 1),
    np.int32: (-2**31, 2**31 - 1),
    np.uint32: (0, 2**32 - 1),
    np.float32: (-1, 1),
    np.float64: (-1, 1)
}

# Define standard wrappers for the types_pb2.DataType enum.
resource = DType(types_pb2.DT_RESOURCE)
tf_export("resource").export_constant(__name__, "resource")
variant = DType(types_pb2.DT_VARIANT)
tf_export("variant").export_constant(__name__, "variant")
float16 = DType(types_pb2.DT_HALF)
tf_export("float16").export_constant(__name__, "float16")
half = float16
tf_export("half").export_constant(__name__, "half")
float32 = DType(types_pb2.DT_FLOAT)
tf_export("float32").export_constant(__name__, "float32")
float64 = DType(types_pb2.DT_DOUBLE)
tf_export("float64").export_constant(__name__, "float64")
double = float64
tf_export("double").export_constant(__name__, "double")
int32 = DType(types_pb2.DT_INT32)
tf_export("int32").export_constant(__name__, "int32")
uint8 = DType(types_pb2.DT_UINT8)
开发者ID:AndrewTwinz,项目名称:tensorflow,代码行数:31,代码来源:dtypes.py


示例15: tf_export

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python import pywrap_tensorflow
from tensorflow.python.util.tf_export import tf_export

__version__ = pywrap_tensorflow.__version__
__git_version__ = pywrap_tensorflow.__git_version__
__compiler_version__ = pywrap_tensorflow.__compiler_version__
__cxx11_abi_flag__ = pywrap_tensorflow.__cxx11_abi_flag__
__monolithic_build__ = pywrap_tensorflow.__monolithic_build__

VERSION = __version__
tf_export("VERSION", "__version__").export_constant(__name__, "VERSION")
GIT_VERSION = __git_version__
tf_export("GIT_VERSION", "__git_version__").export_constant(
    __name__, "GIT_VERSION")
COMPILER_VERSION = __compiler_version__
tf_export("COMPILER_VERSION", "__compiler_version__").export_constant(
    __name__, "COMPILER_VERSION")
CXX11_ABI_FLAG = __cxx11_abi_flag__
tf_export("CXX11_ABI_FLAG", "__cxx11_abi_flag__").export_constant(
    __name__, "CXX11_ABI_FLAG")
MONOLITHIC_BUILD = __monolithic_build__
tf_export("MONOLITHIC_BUILD", "__monolithic_build__").export_constant(
    __name__, "MONOLITHIC_BUILD")

GRAPH_DEF_VERSION = pywrap_tensorflow.GRAPH_DEF_VERSION
tf_export("GRAPH_DEF_VERSION").export_constant(__name__, "GRAPH_DEF_VERSION")
开发者ID:AnishShah,项目名称:tensorflow,代码行数:30,代码来源:versions.py


示例16: tf_export

from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import gen_linalg_ops
from tensorflow.python.ops import linalg_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import special_math_ops
from tensorflow.python.util.tf_export import tf_export

# Linear algebra ops.
band_part = array_ops.matrix_band_part
cholesky = linalg_ops.cholesky
cholesky_solve = linalg_ops.cholesky_solve
det = linalg_ops.matrix_determinant
slogdet = gen_linalg_ops.log_matrix_determinant
tf_export('linalg.slogdet')(slogdet)
diag = array_ops.matrix_diag
diag_part = array_ops.matrix_diag_part
eigh = linalg_ops.self_adjoint_eig
eigvalsh = linalg_ops.self_adjoint_eigvals
einsum = special_math_ops.einsum
expm = gen_linalg_ops.matrix_exponential
tf_export('linalg.expm')(expm)
eye = linalg_ops.eye
inv = linalg_ops.matrix_inverse
logm = gen_linalg_ops.matrix_logarithm
tf_export('linalg.logm')(logm)
lstsq = linalg_ops.matrix_solve_ls
norm = linalg_ops.norm
qr = linalg_ops.qr
set_diag = array_ops.matrix_set_diag
开发者ID:AndrewTwinz,项目名称:tensorflow,代码行数:30,代码来源:linalg_impl.py


示例17: tf_export

# ==============================================================================
"""Signature constants for SavedModel save and restore operations.

"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python.util.tf_export import tf_export


# Key in the signature def map for `default` serving signatures. The default
# signature is used in inference requests where a specific signature was not
# specified.
DEFAULT_SERVING_SIGNATURE_DEF_KEY = "serving_default"
tf_export("saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY"
         ).export_constant(__name__, "DEFAULT_SERVING_SIGNATURE_DEF_KEY")

################################################################################
# Classification API constants.

# Classification inputs.
CLASSIFY_INPUTS = "inputs"
tf_export("saved_model.signature_constants.CLASSIFY_INPUTS").export_constant(
    __name__, "CLASSIFY_INPUTS")

# Classification method name used in a SignatureDef.
CLASSIFY_METHOD_NAME = "tensorflow/serving/classify"
tf_export(
    "saved_model.signature_constants.CLASSIFY_METHOD_NAME").export_constant(
        __name__, "CLASSIFY_METHOD_NAME")
开发者ID:AnishShah,项目名称:tensorflow,代码行数:31,代码来源:signature_constants.py


示例18: tf_export

# ==============================================================================
"""Experimental API for optimizing `tf.data` pipelines."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import gen_experimental_dataset_ops
from tensorflow.python.util.tf_export import tf_export


# A constant that can be used to enable auto-tuning.
AUTOTUNE = -1
tf_export("data.experimental.AUTOTUNE").export_constant(__name__, "AUTOTUNE")


# TODO(jsimsa): Support RE matching for both individual transformation (e.g. to
# account for indexing) and transformation sequence.
def assert_next(transformations):
  """A transformation that asserts which transformations happen next.

  Args:
    transformations: A `tf.string` vector `tf.Tensor` identifying the
      transformations that are expected to happen next.

  Returns:
    A `Dataset` transformation function, which can be passed to
    `tf.data.Dataset.apply`.
  """
开发者ID:kylin9872,项目名称:tensorflow,代码行数:31,代码来源:optimization.py


示例19: tf_export

# ==============================================================================
"""Common tags used for graphs in SavedModel.

"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python.util.tf_export import tf_export


# Tag for the `serving` graph.
SERVING = "serve"
tf_export(
    "saved_model.SERVING",
    v1=["saved_model.SERVING",
        "saved_model.tag_constants.SERVING"]).export_constant(
            __name__, "SERVING")

# Tag for the `training` graph.
TRAINING = "train"
tf_export(
    "saved_model.TRANING",
    v1=["saved_model.TRAINING",
        "saved_model.tag_constants.TRAINING"]).export_constant(
            __name__, "TRAINING")

# Tag for the `eval` graph. Not exported while the export logic is in contrib.
EVAL = "eval"

# Tag for the `gpu` graph.
开发者ID:JonathanRaiman,项目名称:tensorflow,代码行数:31,代码来源:tag_constants.py


示例20: tf_export

    "ClusterDef",
    "Example",  # from example_pb2
    "Feature",  # from example_pb2
    "Features",  # from example_pb2
    "FeatureList",  # from example_pb2
    "FeatureLists",  # from example_pb2
    "FloatList",  # from example_pb2.
    "Int64List",  # from example_pb2.
    "JobDef",
    "SaverDef",  # From saver_pb2.
    "SequenceExample",  # from example_pb2.
    "ServerDef",
]

# pylint: disable=undefined-variable
tf_export("train.BytesList")(BytesList)
tf_export("train.ClusterDef")(ClusterDef)
tf_export("train.Example")(Example)
tf_export("train.Feature")(Feature)
tf_export("train.Features")(Features)
tf_export("train.FeatureList")(FeatureList)
tf_export("train.FeatureLists")(FeatureLists)
tf_export("train.FloatList")(FloatList)
tf_export("train.Int64List")(Int64List)
tf_export("train.JobDef")(JobDef)
tf_export("train.SaverDef")(SaverDef)
tf_export("train.SequenceExample")(SequenceExample)
tf_export("train.ServerDef")(ServerDef)
# pylint: enable=undefined-variable

# Include extra modules for docstrings because:
开发者ID:QiangCai,项目名称:tensorflow,代码行数:31,代码来源:training.py



注:本文中的tensorflow.python.util.tf_export.tf_export函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tf_inspect.getargspec函数代码示例发布时间:2022-05-27
下一篇:
Python tf_decorator.unwrap函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap