Skip to content

Commit

Permalink
Deploying to gh-pages from @ fff8a4b 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
Honry committed Oct 25, 2024
1 parent 1491dd2 commit 78d0b48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion code/samples/mul_add.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const context = await navigator.ml.createContext();
const builder = new MLGraphBuilder(context);
// 1. Create a computational graph 'C = 0.2 * A + B'.
const constant = builder.constant(
{dataType: 'float32'}, new Float32Array([0.2]));
{dataType: 'float32', shape: []}, new Float32Array([0.2]));
const A = builder.input('A', desc);
const B = builder.input('B', desc);
const C = builder.add(builder.mul(A, constant), B);
Expand Down
5 changes: 3 additions & 2 deletions nnotepad/js/nnotepad.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,9 @@ export class NNotepad {

function serializeScalar(number, dataType) {
const ctor = WebNNUtil.dataTypeToBufferType(dataType);
return `_.constant({dataType:"${dataType}"}, new ${ctor.name}([${
Util.stringifyNumber(number, dataType)}]))`;
// building a 0-D scalar input with empty shape
return `_.constant({dataType:"${dataType}", dimensions: [], shape: []},
new ${ctor.name}([${Util.stringifyNumber(number, dataType)}]))`;
}
function suffixToDataType(suffix) {
return {
Expand Down

0 comments on commit 78d0b48

Please sign in to comment.