clamp
An activation function that returns its input clamped to a specified range.
Declaration
static var clamp: BNNSActivationFunction { get }Discussion
This constant defines an activation function that returns values using the following operation:
min(max(x, alpha), beta)Use alpha and beta to specify the clamping range:
var activation = BNNSActivation(function: .clamp,
alpha: -5,
beta: 5)The following illustrates the output that the activation function generates from inputs in the range -10...10:
[Image]