Join us at TensorFlow World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

Module: nsl.lib

View source on GitHub

Library APIs for Neural Structured Learning.

Classes

class GenNeighbor: Abstract class for generating neighbors.

Functions

adv_regularizer(...): Calculates adversarial loss from generated adversarial samples.

apply_feature_mask(...): Applies a feature mask on features if the mask is not None.

bimodal_integration(...): Compute the bimodal integration between x and y.

decay_over_time(...): Returns a decayed value of init_value over time.

gen_adv_neighbor(...): Functional interface of _GenAdvNeighbor.

get_target_indices(...): Selects targeting classes for adversarial attack (classification only).

jensen_shannon_divergence(...): Adds a Jensen-Shannon divergence to the training procedure.

kl_divergence(...): Adds a KL-divergence to the training procedure.

maximize_within_unit_norm(...): Solves the maximization problem weights^T*x with the constraint norm(x)=1.

normalize(...): Normalizes the values in tensor with respect to the specified vector norm.

pairwise_distance_wrapper(...): A wrapper to compute pairwise distance between sources and targets.

replicate_embeddings(...): Replicates the embeddings by replicate_times.

unpack_neighbor_features(...): Extracts sample features, neighbor features, and neighbor weights.

virtual_adv_regularizer(...): API to calculate virtual adversarial loss for given input.