Missed TensorFlow World? Check out the recap. Learn more

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 feature_mask is not None.

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

gen_adv_neighbor(...): Generates adversarial neighbors for the given input and loss.

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 a specified vector norm.

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

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

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

virtual_adv_regularizer(...): Calculates virtual adversarial loss for the given input.