clip_constraint

KGE.constraint.clip_constraint(X, p, value, axis)[source]

Clip embeddings

If X’s p-norm exceeds value, clip the value that let p-norm of X equals value.

Parameters
  • X (tf.Tensor) – Tensor to be constraint

  • p (int) – p-norm

  • value (float) – restrict value

  • axis (int or tuple) – along what axis

Returns

constraint tensor with same shape as X

Return type

tf.Tensor