Using a custom TF op in Keras

22 views
Skip to first unread message

jia...@google.com

unread,
Mar 30, 2018, 12:30:55 PM3/30/18
to Keras-users
Hi everyone,

I'm just getting started with Keras and considering porting a network written in vanilla Tensorflow. My network contains a custom TF op written in CUDA. What's the recommended way of wrapping it inside a Keras layer? I Googled around but wasn't able to find my guidance. I'm hoping to have the Keras wrapper simply call the corresponding tf function but am unsure how to get started.

Thanks!

isaac.grisw...@gmail.com

unread,
Mar 30, 2018, 9:47:44 PM3/30/18
to Keras-users

Jiawen Chen

unread,
Apr 5, 2018, 1:06:09 AM4/5/18
to isaac.grisw...@gmail.com, Keras-users
It turned out to be pretty straightforward. In call(), the input is a tf.Tensor so I can just directly call my op on it.

If the op has multiple inputs, then the input is a list of Tensors.

--
You received this message because you are subscribed to a topic in the Google Groups "Keras-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/keras-users/5T6WonvYSrE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to keras-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/ef634662-8d9c-4be9-8f05-e92dfdf8c809%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages