我正在處理代碼https://www.tensorflow.org/tutorials/sequences/text_generation當(dāng)我到達(dá)該行時(shí),會(huì)產(chǎn)生以下錯(cuò)誤。 sampled_indices = tf.random.categorical(example_batch_predictions[0], num_samples=1) sampled_indices = tf.squeeze(sampled_indices,axis=-1).numpy()錯(cuò)誤AttributeErrorTraceback (most recent call last)在----> 1 sampled_indices = tf.random.categorical(example_batch_predictions[0], num_samples=1)2 sampled_indices = tf.squeeze(sampled_indices,axis=-1).numpy()AttributeError: module 'tensorflow._api.v1.random' has no attribute 'categorical'系統(tǒng)信息 - TensorFlow 版本:Ubuntu 上的 1.12 Jupyter NoteBooks可能缺少什么的任何指示?我想知道是否缺少導(dǎo)入?
Tensorflow text_generation
繁華開(kāi)滿天機(jī)
2021-10-12 10:49:56