Install
openclaw skills install tensorflowAvoid common TensorFlow mistakes — tf.function retracing, GPU memory, data pipeline bottlenecks, and gradient traps.
openclaw skills install tensorflowinput_signature for fixed shapes — @tf.function(input_signature=[tf.TensorSpec(...)])memory_growth=True before any opstf.config.experimental.set_memory_growth(gpu, True) — must be called before GPU initCUDA_VISIBLE_DEVICES="" to force CPU — for testing without GPUtf.data.Dataset without .prefetch() — CPU/GPU idle time between batches.cache() after expensive ops — but before random augmentation.batch() before .map() for vectorized ops — faster than per-elementnum_parallel_calls=tf.data.AUTOTUNE — parallel preprocessingNone for variable batch size in Input layermodel.build(input_shape) if not using Input layer — or first call errorstf.debugging.assert_shapes() for debuggingtape.watch(tensor)persistent=True for multiple gradients — otherwise tape consumed after first usetape.gradient returns None if no path — check for disconnected graph@tf.custom_gradient for custom backward — not all ops have gradientsmodel.trainable = False after compile does nothing — set before compiletraining=True/False mattersmodel.fit shuffles by default — shuffle=False for time seriesvalidation_split takes from end — shuffle data first if order mattersmodel.save() saves everything — architecture, weights, optimizer statemodel.save_weights() only weights — need model code to restoretf.saved_model.save(model, path)layers.Lambda to wrap tf ops in Sequentialtf.print vs Python print — Python print only runs at trace time in tf.functiontf.reduce_mean