Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ partial interface MLGraphBuilder {
<div class="note">
The behavior of this operation when the input tensor is 4-D of the *"nchw"* layout and the activation is of operator type *relu* can be generically emulated from the usage of other operations as follow. However, user agents typically have a more efficient implementation for it, therefore its usage is encouraged from the performance standpoint.
<pre highlight="js">
const shape = [1,-1,1,1];
const shape = [1,null,1,1];
return builder.relu(
builder.add(
builder.mul(
Expand Down Expand Up @@ -1672,15 +1672,15 @@ partial interface MLGraphBuilder {
currentHidden[dir], hiddenSize, { bias: currentBias[dir],
recurrentBias: currentRecurrentBias[dir], resetAfter: options.resetAfter,
layout: options.layout, activations: options.activations }),
[1, -1, hiddenSize]);
[1, null, hiddenSize]);

currentOutput = (currentOutput ? builder.concat([currentOutput, result], 0) : result);
}

hiddenState = currentOutput;

if (options.returnSequence) {
currentOutput = builder.reshape(currentOutput, [1, numDirections, -1, hiddenSize]);
currentOutput = builder.reshape(currentOutput, [1, numDirections, null, hiddenSize]);
sequence = (sequence ? builder.concat([sequence, currentOutput], 0) : currentOutput);
}
}
Expand Down Expand Up @@ -1941,7 +1941,7 @@ partial interface MLGraphBuilder {

// The scale and bias values are applied per input feature
// e.g. axis 1 of the input tensor.
const shape = [1,-1,1,1];
const shape = [1,null,1,1];
return builder.add(
builder.mul(
builder.reshape(options.scale, shape),
Expand Down Expand Up @@ -2132,8 +2132,8 @@ partial interface MLGraphBuilder {
recurrentBias: currentRecurrentBias[dir], peepholeWeight: currentPeepholeWeight[dir],
layout: options.layout, activations: options.activations });

let output = builder.reshape(results[0], [1, -1, hiddenSize]);
let cell = builder.reshape(results[1], [1, -1, hiddenSize]);
let output = builder.reshape(results[0], [1, null, hiddenSize]);
let cell = builder.reshape(results[1], [1, null, hiddenSize]);

nextHidden = (nextHidden ? builder.concat([nextHidden, result], 0) : output);
nextCell = (nextCell ? builder.concat([nextCell, result], 0) : cell);
Expand All @@ -2143,7 +2143,7 @@ partial interface MLGraphBuilder {
cellState = nextCell;

if (options.returnSequence) {
nextHidden = builder.reshape(nextHidden, [1, numDirections, -1, hiddenSize]);
nextHidden = builder.reshape(nextHidden, [1, numDirections, null, hiddenSize]);
sequence = (sequence ? builder.concat([sequence, nextHidden], 0) : nextHidden);
}
}
Expand Down