शुरू करेंमुफ़्त में शुरू करें

भाग 1: पूरा मॉडल परिभाषित करना

यहाँ आप encoder-decoder मॉडल की कुछ आखिरी लेयर्स लागू करेंगे. आप Dense और TimeDistributed लेयर्स का उपयोग करके मॉडल की final predictions (अर्थात् अनुमानित फ़्रेंच शब्दों की probabilities) प्राप्त करेंगे.

अब तक जो आपने लागू किया है, उसका encoder और decoder (ऊपरी हिस्सा छोड़कर) दिया गया है. decoder की GRU लेयर का आउटपुट de_out उपलब्ध है. हम encoder से संबंधित चीजों को दर्शाने के लिए en प्रीफ़िक्स (जैसे en_gru) और decoder से संबंधित चीजों के लिए de प्रीफ़िक्स (जैसे de_gru) का उपयोग करते हैं.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Keras के साथ Machine Translation

पाठ्यक्रम देखें

अभ्यास निर्देश

  • Keras से Dense और TimeDistributed लेयर्स इम्पोर्ट करें.
  • softmax activation वाली एक Dense लेयर परिभाषित करें, जिसमें fr_vocab आउटपुट हों.
  • Dense लेयर को TimeDistributed लेयर में wrap करें.
  • मॉडल की final prediction पाने के लिए de_out को de_dense_time लेयर में पास करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Import Dense and TimeDistributed layers
from tensorflow.keras.____ import ____, ____
# Define a softmax dense layer that has fr_vocab outputs
de_dense = ____(____, ____)
# Wrap the dense layer in a TimeDistributed layer
de_dense_time = ____(de_dense)
# Get the final prediction of the model
de_pred = ____(de_out)
print("Prediction shape: ", de_pred.shape)
कोड संपादित करें और चलाएँ