tensorflow / fold

Deep learning with dynamic computation graphs in TensorFlow
Apache License 2.0
1.82k stars 266 forks source link

Convert SequenceType to TupleType #75

Open bdqnghi opened 6 years ago

bdqnghi commented 6 years ago

Suppose that I have an input like this ["string1,"string2","string3]. Then I want to produce a block with produce tuple type, for example :(array([-5., 4.], dtype=float32), array([ 5., 5.], dtype=float32),array([-5., 3.], dtype=float32))

I tried something like this:

test_array = td.AllOf(td.Map(td.InputTransform(lambda x: 1))) >> tdb.Function(tf.identity)
print test_array.eval(["string1","string2"])

Maybe I'm not very clear on how to use fold block, any help is very appreciated.