probability icon indicating copy to clipboard operation
probability copied to clipboard

Is there any c++ inference API in tfp?

Open Capri2014 opened this issue 7 years ago • 2 comments

Is there any c++ inference API in tfp?

Thanks

Capri2014 avatar Oct 01 '19 21:10 Capri2014

For c++ I'd suggest using tf.saved_model to export a tf.Module with the relevant inference inside a tf.function method thereof. You should then be able to use the TF serving package.

On Tue, Oct 1, 2019, 5:52 PM Qi Luo [email protected] wrote:

Is there any c++ inference API in tfp?

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/probability/issues/582?email_source=notifications&email_token=AFJFSIZ77THAG45VQLZADCDQMPBBLA5CNFSM4I4PIKRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HO7FV5A, or mute the thread https://github.com/notifications/unsubscribe-auth/AFJFSIZDFESYFY7MOVSVFIDQMPBBLANCNFSM4I4PIKRA .

brianwa84 avatar Oct 01 '19 21:10 brianwa84

Simplest possible thing:

class Model(tf.Module):
  @tf.function(input_signature=(tf.TensorSpec(dtype=tf.float32, shape=[2])
  def f(self, loc):
    return tfd.Normal(loc, 1).sample(3)

tf.saved_model.save(Model(), '/tmp/model')

brianwa84 avatar Oct 12 '19 00:10 brianwa84