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
34 changes: 25 additions & 9 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ let rank = document.getElementById("rank");

const tensor = stat => {
if (variable.value === "") {
return alert("Please enter a variable name in the 'variable' field, in the 'Create Tensor' section");
return alert("Please enter a variable name in the 'variable' field, in the 'Create Tensor' section.");
} else if (value.value === "") {
return alert("Please enter a comma separated list of integers, floats, or Booleans in the 'value' field, in the 'Create Tensor' section");
return alert("Please enter a comma separated list of integers, floats, or Booleans in the 'value' field, in the 'Create Tensor' section.");
} else {
let keepOne = "";
let keepTwo = "";
Expand All @@ -26,7 +26,7 @@ const tensor = stat => {
let average = array.length / degree;

if (parseInt(average) - average !== 0) {
return alert("Please enter more values in the 'value' field for the selected 'rank' in the 'Create Tensor' section");
return alert("Please enter more values in the 'value' field for the selected 'rank' in the 'Create Tensor' section.");
}

let nest = [];
Expand All @@ -52,7 +52,7 @@ const tensor = stat => {
string = nest.slice(0, -4).replace(/\s*,\s*/, ", ");
}
} else {
return alert("Please enter more values in the 'value' field for the selected 'rank' in the 'Create Tensor' section");
return alert("Please enter more values in the 'value' field for the selected 'rank' in the 'Create Tensor' section.");
}
}
}
Expand All @@ -69,7 +69,7 @@ const tensor = stat => {
} else if (array.length > 0) {
if (array.every(el => Number(el))) {
} else {
return alert("Please enter a number for the 'value' field in the 'Create Tensor' section");
return alert("Please enter a number for the 'value' field in the 'Create Tensor' section.");
}
}
}
Expand All @@ -81,15 +81,15 @@ const tensor = stat => {
// Data at a glance
const data = (stat) => {
if (variable.value === "") {
return alert("Please enter a variable name in the 'Create Tensor' section");
return alert("Please enter a variable name in the 'Create Tensor' section.");
} else {
document.editor.textbox.value+= '\ntf.' + stat.slice(0, -2) + '(' + document.editor.variable.value + ')';
}
}

const shape = (stat) => {
if (variable.value === "") {
return alert("Please enter a variable name in the 'Load data' section");
return alert("Please enter a variable name in the 'Create Tensor' section.");
} else {
document.editor.textbox.value+= '\n' + document.editor.variable.value + '.' + stat;
}
Expand All @@ -102,7 +102,7 @@ let column = document.getElementById("column");

const onesZerosFunc = (arg) => {
if (variable.value === "") {
return alert("Please enter a variable name in the 'Create Tensor' section");
return alert("Please enter a variable name in the 'Create Tensor' section.");
} else if (batch.value === "") {
return alert("Please enter a number in the 'batch' field in the 'Tensor functions' section.");
} else if (row.value === "") {
Expand All @@ -116,7 +116,7 @@ const onesZerosFunc = (arg) => {

const reshape = (arg) => {
if (variable.value === "") {
return alert("Please enter a variable name in the 'Create Tensor' section");
return alert("Please enter a variable name in the 'Create Tensor' section.");
} else if (batch.value === "") {
return alert("Please enter a number in the 'batch' field in the 'Tensor functions' section.");
} else if (row.value === "") {
Expand All @@ -131,3 +131,19 @@ const reshape = (arg) => {
document.editor.textbox.value+="\n" + variable.value + "_1 = tf." + arg + "(" + variable.value + ", [" + batch.value + ", " + row.value + keep + "])";
}
}

// Select
const access = () => {
if (variable.value === "") {
return alert("Please enter a variable name in the 'Create Tensor' section.");
} else if (row.value === "") {
return alert("Please enter a number in the 'row' field in the 'Tensor functions' section.");
} else {
let keep = "";

if (column.value) {
keep = ", " + column.value;
}

}
}
Loading