'What's code snippet of tf.contrib.crf.crf_log_likelihood in latest tensorflow version 2.8

The below functions existed in Tensorflow 1.5 which is currently deprecated.

What's the corresponding code for the function:

tf.contrib.crf.crf_log_likelihood()

tf.contrib.crf.viterbi_decode()

in the latest Tensorflow 2.8 version?



Solution 1:[1]

These both functions are now available under Tensorflow Addons package.

You can access these functions using code below:

!pip install tensorflow_addons     #to install tensorflow_addons package
import tensorflow_addons as tfa  

tfa.text.crf_log_likelihood()
tfa.text.viterbi_decode() 

Please check this link for more details.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1