当前位置: 首页>>代码示例>>Python>>正文


Python tensor_signature.create_placeholders_from_signatures函数代码示例

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


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

示例1: testSparseTensorSignaturePlaceholders

 def testSparseTensorSignaturePlaceholders(self):
   tensor = tf.SparseTensor(values=[1.0, 2.0], indices=[[0, 2], [0, 3]],
                            shape=[5, 5])
   signature = tensor_signature.create_signatures(tensor)
   placeholder = tensor_signature.create_placeholders_from_signatures(
       signature)
   self.assertTrue(isinstance(placeholder, tf.SparseTensor))
   self.assertEqual(placeholder.values.dtype, tensor.values.dtype)
开发者ID:Hwhitetooth,项目名称:tensorflow,代码行数:8,代码来源:tensor_signature_test.py

示例2: testTensorSignaturePlaceholders

  def testTensorSignaturePlaceholders(self):
    placeholder_a = array_ops.placeholder(
        name='test', shape=[None, 100], dtype=dtypes.int32)
    signatures = tensor_signature.create_signatures(placeholder_a)
    placeholder_out = tensor_signature.create_placeholders_from_signatures(
        signatures)
    self.assertEqual(placeholder_out.dtype, placeholder_a.dtype)
    self.assertTrue(placeholder_out.get_shape().is_compatible_with(
        placeholder_a.get_shape()))
    self.assertTrue(
        tensor_signature.tensors_compatible(placeholder_out, signatures))

    inputs = {'a': placeholder_a}
    signatures = tensor_signature.create_signatures(inputs)
    placeholders_out = tensor_signature.create_placeholders_from_signatures(
        signatures)
    self.assertEqual(placeholders_out['a'].dtype, placeholder_a.dtype)
    self.assertTrue(placeholders_out['a'].get_shape().is_compatible_with(
        placeholder_a.get_shape()))
    self.assertTrue(
        tensor_signature.tensors_compatible(placeholders_out, signatures))
开发者ID:AliMiraftab,项目名称:tensorflow,代码行数:21,代码来源:tensor_signature_test.py

示例3: _get_predict_ops

    def _get_predict_ops(self, features):
        """Method that builds model graph and returns prediction ops.

    Expected to be overriden by sub-classes that require custom support.
    This implementation uses `model_fn` passed as parameter to constructor to
    build model.

    Args:
      features: `Tensor` or `dict` of `Tensor` objects.

    Returns:
      predictions: `Tensor` or `dict` of `Tensor` objects.
    """
        targets = tensor_signature.create_placeholders_from_signatures(self._targets_info)
        predictions, _, _ = self._call_model_fn(features, targets, ModeKeys.INFER)
        return predictions
开发者ID:MrRabbit0o0,项目名称:tensorflow,代码行数:16,代码来源:estimator.py

示例4: _get_predict_ops

  def _get_predict_ops(self, features):
    """Method that builds model graph and returns prediction ops.

    Expected to be overriden by sub-classes that require custom support.
    This implementation uses `model_fn` passed as parameter to constructor to
    build model.

    Args:
      features: `Tensor` or `dict` of `Tensor` objects.

    Returns:
      `ModelFnOps` object.
    """

    self._set_infer_mode_feature_signature(features)
    labels = tensor_signature.create_placeholders_from_signatures(
        self._labels_info[model_fn_lib.ModeKeys.INFER])
    return self._call_model_fn(features, labels, model_fn_lib.ModeKeys.INFER)
开发者ID:ComeOnGetMe,项目名称:tensorflow,代码行数:18,代码来源:estimator.py

示例5: testTensorPlaceholderNone

 def testTensorPlaceholderNone(self):
   self.assertEqual(
       None, tensor_signature.create_placeholders_from_signatures(None))
开发者ID:Hwhitetooth,项目名称:tensorflow,代码行数:3,代码来源:tensor_signature_test.py


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