Skip to content

Instantly share code, notes, and snippets.

@braingineer
braingineer / lambdawithmask.py
Last active March 10, 2021 09:47
keras lambda layer supporting masking
class Lambda(Layer):
'''Used for evaluating an arbitrary Theano / TensorFlow expression
on the output of the previous layer.
# Examples
```python
# add a x -> x^2 layer
model.add(Lambda(lambda x: x ** 2))
```