本文整理汇总了Python中sugartensor.placeholder方法的典型用法代码示例。如果您正苦于以下问题:Python sugartensor.placeholder方法的具体用法?Python sugartensor.placeholder怎么用?Python sugartensor.placeholder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugartensor
的用法示例。
在下文中一共展示了sugartensor.placeholder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sg_input
# 需要导入模块: import sugartensor [as 别名]
# 或者: from sugartensor import placeholder [as 别名]
def sg_input(shape=None, dtype=sg_floatx, name=None):
r"""Creates a placeholder.
Args:
shape: A tuple/list of integers. If an integers is given, it will turn to a list.
dtype: A data type. Default is float32.
name: A name for the placeholder.
Returns:
A wrapped placeholder `Tensor`.
"""
if shape is None:
return tf.placeholder(dtype, shape=None, name=name)
else:
if not isinstance(shape, (list, tuple)):
shape = [shape]
return tf.placeholder(dtype, shape=[None] + list(shape), name=name)
#
# helper function for sugar and layer function injection
#