fold icon indicating copy to clipboard operation
fold copied to clipboard

How to use td.Map with lambda

Open acelove opened this issue 7 years ago • 2 comments

Assum that a is a sequence of number, b is a number and c is a number too. How can I use Map and lambda to get a sequence of number [a1+b+c, a2+b+c, ... , an+b+c] I think Map(Function(lambda x,y,z: x+y+x)) is not work?

acelove avatar Apr 08 '17 01:04 acelove

I use Broadcast and Zip to achieve my goal.However, Broadcast copy the data many times so it cost a lot of memery.Is there a more efficient way?

acelove avatar Apr 10 '17 08:04 acelove

Yes, you should use broadcast and zip. Broadcast does not copy the data; it's a python generator that expands a single element to a stream.

On Mon, Apr 10, 2017 at 1:50 AM, acelove [email protected] wrote:

I use Broadcast and Zip to achieve my goal.However, Broadcast copy the data many times so it cost a lot of memery.Is there a more efficient way?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/fold/issues/43#issuecomment-292887904, or mute the thread https://github.com/notifications/unsubscribe-auth/AGGbTfHDQMWoAQ43uXm1ifeBFnVi5Py9ks5rue09gaJpZM4M3jOJ .

-- DeLesley Hutchins | Software Engineer | [email protected] | 505-206-0315

delesley avatar Apr 10 '17 16:04 delesley