Major Features and Improvements
- Add
params
as an optional third argument to theembedding_fn
argument of
nsl.estimator.add_graph_regularization
. This is similar to theparams
argument of an Estimator'smodel_fn
, which allows users to pass arbitrary
states through. Adding this as an argument toembedding_fn
will allow
users to access that state in the implementation ofembedding_fn
. - Both
nsl.keras.AdversarialRegularization
and
nsl.keras.GraphRegularization
now support thesave
method which will
save the base model. nsl.keras.AdversarialRegularization
now supports atf.keras.Sequential
base model with atf.keras.layers.DenseFeatures
layer.nsl.configs.AdvNeighborConfig
has a new fieldrandom_init
. If set to
True
, a random perturbation will be performed before FGSM/PGD steps.nsl.lib.gen_adv_neighbor
now has a new parameteruse_while_loop
. If set
toTrue
, the PGD steps are done in atf.while_loop
which is potentially
more memory efficient but has some restrictions.- New library functions:
nsl.lib.random_in_norm_ball
for generating random tensors in a norm
ball.nsl.lib.project_to_ball
for projecting tensors onto a norm ball.
Bug Fixes and Other Changes
- Dropped Python 2 support (which was deprecated 2+ years ago).
nsl.keras.AdversarialRegularization
andnsl.lib.gen_adv_neighbor
will
not attempt to calculate gradients for tensors with a non-differentiable
dtype
. This doesn’t change the functionality, but only suppresses excess
warnings.- Both
estimator/adversarial_regularization.py
and
estimator/graph_regularization.py
explicitly importestimator
from
tensorflow
as a separate import instead of accessing it viatf.estimator
and depend on the tensorflowestimator
target. - The new top-level
workshops
directory contains presentation materials from
tutorials we organized on NSL at KDD 2020, WSDM 2021, and WebConf 2021. - The new
usage.md
page describes featured usage of NSL, external talks,
blog posts, media coverage, and more. - End-to-end examples under the
examples
directory:- New examples about graph neural network modules with graph-regularizer
and graph convolution. - New README file providing an overview of the examples.
- New examples about graph neural network modules with graph-regularizer
- New tutorial examples under the
examples/notebooks
directory:- Graph regularization for image classification using synthesized graphs
- Adversarial Learning: Building Robust Image Classifiers
- Saving and loading NSL models
Thanks to our Contributors
This release contains contributions from many people at Google Research and from
TF community members: @angela-wang1 , @dipanjanS, @joshchang1112, @SamuelMarks,
@sayakpaul, @wangbingnan136, @zoeyz101