def create_placeholder(self):
"""Creates a TF placeholder_with_default.
Convenience method that produces a constant of the type, value and shape defined by the port.
Returns: a constant tensor of same type, shape and name. It can nevertheless be fed with external values
as if it was a placeholder.
"""
ph = tf.placeholder_with_default(self.default_value, self.shape, self.name)
if ph.dtype != self.dtype:
logger.warning(
"Placeholder {} with default of type {} created for TensorPort with type {}!".format(self.name,
ph.dtype,
self.dtype))
return ph
评论列表
文章目录