INNER CODE UNIT · Python
add_example_weight_placeholders
deepchem/deepchem · contrib/tensorflow_models/__init__.py:439
def add_example_weight_placeholders(self, graph, name_scopes):
"""Add Placeholders for example weights for each task.
This method creates the following Placeholders for each task:
weights_%d: Label tensor with shape batch_size.
Placeholders are wrapped in identity ops to avoid the error caused by
feeding and fetching the same tensor.
"""
weights = []
placeholder_scope = TensorflowGraph.get_placeholder_scope(
graph, name_scopes)
with placeholder_scope:
for task in range(self.n_tasks):
weights.append(
tf.identity(
tf.placeholder(
tf.float32, shape=[None], name='weights_%d' % task)))