Rewriting the function tf.contrib.training.bucket_by_sequence_length() from 1.x to tensorflow 2.x

  python, tensorflow, tensorflow1.15, tensorflow2.0

since my GPU only support TensorFlow 2.x, I have to rewrite a code which is written in TensorFlow 1.x .

I used the following code: https://www.tensorflow.org/guide/upgrade

Everything worked fine until I came to the following function:

tf.contrib.training.bucket_by_sequence_length(input_length,
tensors,
batch_size,
bucket_boundaries,
num_threads=1,
capacity=32,
bucket_capacities=None,
shapes=None,
dynamic_pad=False,
allow_smaller_final_batch=False,
keep_input=True,
shared_name=None,
name=None)

Unfortunately therefore I haven’t a solution how to rewrite this code.

I am glad for any idea how to solve this problem.

Source: Python Questions

LEAVE A COMMENT