3

When I'm trying to compile this code, getting the below error.

File "xla_test.py", line 25, in <module>
    @tf.function(jit_compile=True)
TypeError: function() got an unexpected keyword argument 'jit_compile'
harry
  • 970
  • 6
  • 25

2 Answers2

2

Without switching to tf-nightly just use:

@tf.function(experimental_compile=True)

From the tensorflow docs:

experimental_compile If True, the function is always compiled by XLA. XLA may be more efficient in some cases (e.g. TPU, XLA_GPU, dense tensor computations).

In my case MCMC sampling took without that parameter: ~1 min 37 sec, with experimental_compile=True: ~6 sec. Tensorflow built from sources (r2.4 branch).

Vlad
  • 21
  • 1
0

Installing tf-nightly resolved this issue.

pip install tf-nightly
harry
  • 970
  • 6
  • 25