ฟังก์ชันเพิ่มเติมสำหรับ TensorFlow ดูแลโดย SIG-addons
import tensorflow as tf import tensorflow_addons as tfa train,test = tf.keras.datasets.mnist.load_data() x_train, y_train = train x_train = x_train[..., tf.newaxis] / 255.0 # TFA layers and activations model = tf.keras.Sequential([ tf.keras.layers.Conv2D(filters=10, kernel_size=(3,3), activation=tfa.activations.gelu), tfa.layers.GroupNormalization(groups=5, axis=3), tf.keras.layers.Flatten(), tf.keras.layers.Dense(10, activation='softmax') ]) # TFA optimizers, losses and metrics model.compile( optimizer=tfa.optimizers.RectifiedAdam(0.001), loss=tfa.losses.TripletSemiHardLoss(), metrics=[tfa.metrics.MultiLabelConfusionMatrix(num_classes=10)]) history = model.fit(x_train, y_train, epochs=10)
TensorFlow SIG Addons เป็นที่เก็บการสนับสนุนของชุมชนที่สอดคล้องกับรูปแบบ API ที่เป็นที่ยอมรับ แต่ใช้ฟังก์ชันการทำงานใหม่ที่ไม่มีใน TensorFlow หลัก
TensorFlow รองรับโอเปอเรเตอร์ เลเยอร์ เมตริก การสูญเสีย ออปติไมเซอร์ และอื่นๆ จำนวนมาก อย่างไรก็ตาม ในสาขาที่เคลื่อนไหวอย่างรวดเร็ว เช่น ML มีการพัฒนาใหม่ที่น่าสนใจมากมายที่ไม่สามารถรวมเข้ากับ TensorFlow หลักได้ (เนื่องจากการใช้งานในวงกว้างยังไม่ชัดเจน หรือส่วนใหญ่จะใช้โดยกลุ่มย่อยที่เล็กกว่าของชุมชน)