The BayesFlow Keras Operations skill ensures that custom extensions, loss functions, and neural network layers remain compatible across all Keras 3 backends, including PyTorch, JAX, and TensorFlow. By providing strict guidance on using the `keras.ops` namespace, it prevents common errors like mixing backend-specific libraries with Keras tensors. The skill includes optimized implementation patterns for complex tasks such as detached sampling to save memory, straight-through estimators for differentiable indicators, and chunked log-probability calculations for processing large posterior sample sets.
Key Features
01Strict enforcement of backend-agnostic keras.ops for tensor math
02Implementation patterns for memory-efficient detached sampling
03Differentiable Straight-Through Estimator (STE) templates
04Safe numpy-to-tensor boundary crossing guidance
05Memory-bounded chunked log-probability processing patterns
060 GitHub stars