While standard Keras APIs provide efficient ways to build many models, certain research goals or complex applications demand greater flexibility. This chapter introduces techniques for extending TensorFlow's core functionalities to suit specific needs.
You will learn how to gain finer control over model architecture and training by:
tf.keras.Model
to create fully customized model structures.tf.keras.layers.Layer
.tf.GradientTape
for precise control over gradient computation and weight updates.tf.RaggedTensor
for variable-length inputs and tf.SparseTensor
for data with many zero values.Mastering these techniques allows you to move beyond pre-defined structures and implement novel ideas or highly specialized machine learning systems.
4.1 Subclassing tf.keras.Model for Flexibility
4.2 Creating Custom tf.keras Layers
4.3 Implementing Custom Loss Functions
4.4 Developing Custom Metrics
4.5 Writing Custom Training Loops
4.6 Working with Ragged Tensors and Sparse Tensors
4.7 Using TensorFlow Addons for Specialized Operations
4.8 Hands-on Practical: Building a Custom Model Pipeline
© 2025 ApX Machine Learning