更新后的colab:
setInterval(()=>{
let a =document.querySelector('colab-connect-button');
if(a.shadowRoot.querySelector('#connect').innerText==="重新连接"){
a.click();
}
},1000)
更新前的colab:
setInterval(()=>{
if(Array.from(document.getElementById("connect").children[0].children[2].innerHTML).splice(3,4).toString() === '重,新,连,接'){
document.getElementById("connect").children[0].children[2].click()
}
},1000)
使用TensorFlow 2.0:
%tensorflow_version 2.x
import tensorflow as tf
from tensorflow.keras import layers
print(tf.__version__)
print(tf.keras.__version__)
来源:51CTO
作者:wx5e1ee5904afef
链接:https://blog.51cto.com/14667342/2474144