public class CapsuleUtils extends Object
CapsuleLayer
,
PrimaryCapsules
,
CapsuleStrengthLayer
Constructor and Description |
---|
CapsuleUtils() |
Modifier and Type | Method and Description |
---|---|
static SDVariable |
softmax(SameDiff SD,
SDVariable x,
int dimension,
int rank)
Compute softmax along a given dimension
|
static SDVariable |
squash(SameDiff SD,
SDVariable x,
int dim)
Compute the squash operation used in CapsNet
The formula is (||s||^2 / (1 + ||s||^2)) * (s / ||s||).
|
public static SDVariable squash(SameDiff SD, SDVariable x, int dim)
SD
- The SameDiff environmentx
- The variable to squashpublic static SDVariable softmax(SameDiff SD, SDVariable x, int dimension, int rank)
Copyright © 2019. All rights reserved.