Как на самом деле работают DocumentSink, DocumentSource ops в TF Syntaxnet?
После прохождения кода... я мог понять поток как...
В parser_eval.py
sink_documents = tf.placeholder(tf.string)
sink = gen_parser_ops.document_sink(sink_documents,
task_context=task_context,
corpus_name=FLAGS.output)
sess.run(sink, feed_dict={sink_documents: tf_documents})
И пройдя через gen_parser_ops.py я нашел
def document_sink(documents, task_context, corpus_name=None, name=None):
r"""Write documents to documents_path.
Args:
documents: A `Tensor` of type `string`. documents to write.
task_context: A `string`.
corpus_name: An optional `string`. Defaults to `"documents"`.
name: A name for the operation (optional).
Returns:
The created Operation.
"""
result = _op_def_lib.apply_op("DocumentSink", documents=documents,
task_context=task_context,
corpus_name=corpus_name, name=name)
return result
Но я не мог понять, как фрагмент кода ниже сохраняет документы в файл.
_op_def_lib.apply_op("DocumentSink", documents=documents,
task_context=task_context,
corpus_name=corpus_name, name=name)
а также было бы очень полезно, если бы кто-нибудь мог помочь мне привести небольшой пример того, как использовать op_def_lib из TensorFlow.