Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

0.8.x Use batchNorm instead of batchNormalization #310

Merged
merged 1 commit into from
Feb 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/supported_ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@

|Tensorflow Op Name|Tensorflow.js Op Name|
|---|---|
|FusedBatchNorm|batchNormalization|
|FusedBatchNormV2|batchNormalization|
|FusedBatchNorm|batchNorm|
|FusedBatchNormV2|batchNorm|
|LogSoftmax|logSoftmax|
|LRN|localResponseNormalization|
|Softmax|softmax|
Expand Down
6 changes: 3 additions & 3 deletions src/operations/executors/normalization_executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export let executeOp: OpExecutor = (node: Node, tensorMap: NamedTensorsMap,
tfc.Tensor[] => {
switch (node.op) {
case 'batchNormalization': {
return [tfc.batchNormalization(
return [tfc.batchNorm(
getParamValue('x', node, tensorMap, context) as tfc.Tensor,
getParamValue('mean', node, tensorMap, context) as tfc.Tensor,
getParamValue('variance', node, tensorMap, context) as tfc.Tensor,
getParamValue('epsilon', node, tensorMap, context) as number,
getParamValue('offset', node, tensorMap, context) as tfc.Tensor,
getParamValue('scale', node, tensorMap, context) as tfc.Tensor,
getParamValue('offset', node, tensorMap, context) as tfc.Tensor)];
getParamValue('epsilon', node, tensorMap, context) as number)];
}
case 'localResponseNormalization': {
return [tfc.localResponseNormalization(
Expand Down
8 changes: 4 additions & 4 deletions src/operations/executors/normalization_executor_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ describe('normalization', () => {

describe('executeOp', () => {
describe('batchNormalization', () => {
it('should call tfc.batchNormalization', () => {
spyOn(tfc, 'batchNormalization');
it('should call tfc.batchNorm', () => {
spyOn(tfc, 'batchNorm');
node.op = 'batchNormalization';
node.params.scale = createTensorAttr(1);
node.params.offset = createTensorAttr(2);
Expand All @@ -58,9 +58,9 @@ describe('normalization', () => {
const input5 = [tfc.scalar(4)];
executeOp(node, {input1, input2, input3, input4, input5}, context);

expect(tfc.batchNormalization)
expect(tfc.batchNorm)
.toHaveBeenCalledWith(
input1[0], input4[0], input5[0], 5, input2[0], input3[0]);
input1[0], input4[0], input5[0], input3[0], input2[0], 5);
});
});

Expand Down