Skip to content

Commit bc3cbd0

Browse files
committed
Update circle.js
1 parent 24d436a commit bc3cbd0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

source/circle.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,17 @@ circle.Node = class {
353353
if (options) {
354354
for (const [name, value] of Object.entries(options)) {
355355
if (name === 'fused_activation_function' && value) {
356-
if (value < 1 || value > 5) {
357-
throw new circle.Error(`Unsupported activation function index '${value}'.`);
356+
const ActivationFunctionType = circle.schema.ActivationFunctionType;
357+
let type = '';
358+
switch (value) {
359+
case ActivationFunctionType.RELU: type = 'Relu'; break;
360+
case ActivationFunctionType.RELU_N1_TO_1: type = 'ReluN1To1'; break;
361+
case ActivationFunctionType.RELU6: type = 'Relu6'; break;
362+
case ActivationFunctionType.TANH: type = 'Tanh'; break;
363+
case ActivationFunctionType.SIGN_BIT: type = 'SignBit'; break;
364+
case 6: type = 'Sigmoid'; break;
365+
default: type = value.toString(); break;
358366
}
359-
const list = ['Unknown', 'Relu', 'ReluN1To1', 'Relu6', 'Tanh', 'SignBit'];
360-
const type = list[value];
361367
const node = new circle.Node(metadata, null, { name: type }, null, []);
362368
this.chain = [node];
363369
}

0 commit comments

Comments
 (0)