示例#1
0
 def input_fn():
     doc1 = Document()
     doc1.id = 1
     doc1.text = 'title: this is mode1 from doc1, body: this is mode2 from doc1'
     doc2 = Document()
     doc2.id = 2
     doc2.text = 'title: this is mode1 from doc2, body: this is mode2 from doc2'
     doc3 = Document()
     doc3.id = 3
     doc3.text = 'title: this is mode1 from doc3, body: this is mode2 from doc3'
     return [doc1, doc2, doc3]
示例#2
0
def input_fn():
    doc1 = Document()
    doc1.id = 1
    doc1.embedding.CopyFrom(array2pb(np.random.random([7])))
    c = doc1.chunks.add()
    c.id = 3
    c.embedding.CopyFrom(array2pb(np.random.random([5])))
    doc2 = Document()
    doc2.id = 2
    doc2.embedding.CopyFrom(array2pb(np.random.random([3])))
    d = doc2.chunks.add()
    d.id = 4
    d.embedding.CopyFrom(array2pb(np.random.random([9])))
    return [doc1, doc2]
示例#3
0
def input_fn():
    doc1 = Document()
    doc1.id = 1
    doc1.embedding.CopyFrom(array2pb(e1))
    c = doc1.chunks.add()
    c.id = 3
    c.embedding.CopyFrom(array2pb(e2))
    doc2 = Document()
    doc2.id = 2
    doc2.embedding.CopyFrom(array2pb(e3))
    d = doc2.chunks.add()
    d.id = 4
    d.embedding.CopyFrom(array2pb(e4))
    return [doc1, doc2]