Merge pull request #570 from Luis-Fernando-Molina/develop
Contribution: Machine Learning Implementation up to Features and Labels + Chinese and Bahasa languages added
This commit is contained in:
9159 files changed
+1622676
-181
No files matched your search
@@ -845,15 +845,6 @@
|
||||
"fileName": "LearningSystem.js",
|
||||
"folderName": "Learning-Bot/Low-Frequency-Learning"
|
||||
}
|
||||
],
|
||||
"algorithmModules": [
|
||||
{
|
||||
"name": "Time Series Forcasting Tensor Flow JS",
|
||||
"propertyName": "timeSeriesForcastingTensorFlowJS",
|
||||
"functionName": "newSuperalgosAlgorithmModulesTimeSeriesForcastingTensorFlowJS",
|
||||
"fileName": "LearningAlgorithm.js",
|
||||
"folderName": "Learning-Bot/Low-Frequency-Learning/Time-Series-Forcasting/Tensor-Flow-JS"
|
||||
}
|
||||
]
|
||||
},
|
||||
"CL": {}
|
||||
@@ -927,7 +918,16 @@
|
||||
"TS": {
|
||||
"globals":[],
|
||||
"functionLibraries": [],
|
||||
"utilities": []
|
||||
"utilities": [],
|
||||
"botModules": [
|
||||
{
|
||||
"name": "TensorFlow Library",
|
||||
"propertyName": "tensorFlowLibrary",
|
||||
"functionName": "newTensorFlowBotModulesTensorFlowLibrary",
|
||||
"fileName": "TensorFlowLibrary.js",
|
||||
"folderName": "Learning-Bot/Low-Frequency-Learning"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"topic": "Docs Languages",
|
||||
"pageNumber": "5",
|
||||
"type": "Docs In Simplified Chinese-Mandarin",
|
||||
"definition": {
|
||||
"text": "The Docs articles are fully written in English. The system allow users to search / browse articles in other languages as well, as long as other users contribute translations."
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Superalgos and any other integrated project are written in English, since English is considered the default language. Node types, variable names, etc., all is originally in English language. "
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The Docs content can be translated by anyone willing to contribute some time doing so. That helps users to read the contents of the Docs in their native language. "
|
||||
},
|
||||
{
|
||||
"style": "Success",
|
||||
"text": " Users can switch between languages using the links provided at the footer of every page at the Docs. ",
|
||||
"updated": 1609085068937
|
||||
},
|
||||
{
|
||||
"style": "Note",
|
||||
"text": "You can only add or delete pages to the Docs if you are navigating it in English, because English is the default language, and from there pages are later translated. "
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"topic": "Docs Languages",
|
||||
"pageNumber": "6",
|
||||
"type": "Docs In Bahasa",
|
||||
"definition": {
|
||||
"text": "The Docs articles are fully written in English. The system allow users to search / browse articles in other languages as well, as long as other users contribute translations."
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Superalgos and any other integrated project are written in English, since English is considered the default language. Node types, variable names, etc., all is originally in English language. "
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The Docs content can be translated by anyone willing to contribute some time doing so. That helps users to read the contents of the Docs in their native language. "
|
||||
},
|
||||
{
|
||||
"style": "Success",
|
||||
"text": " Users can switch between languages using the links provided at the footer of every page at the Docs. ",
|
||||
"updated": 1609085068937
|
||||
},
|
||||
{
|
||||
"style": "Note",
|
||||
"text": "You can only add or delete pages to the Docs if you are navigating it in English, because English is the default language, and from there pages are later translated. "
|
||||
}
|
||||
]
|
||||
}
|
||||
+40
-31
@@ -26,27 +26,7 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
|
||||
let sessionParameters
|
||||
let dynamicIndicators
|
||||
|
||||
let learningAlgorithmName = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.learningAlgorithm.config.codeName
|
||||
let learningAlgorithmModuleObject
|
||||
/*
|
||||
We will scan the project schema until we find the module that will run the algorithm
|
||||
defined by the user at the UI / Session Parameters.
|
||||
*/
|
||||
for (let i = 0; i < TS.projects.superalgos.globals.taskConstants.PROJECTS_SCHEMA.length; i++) {
|
||||
let project = TS.projects.superalgos.globals.taskConstants.PROJECTS_SCHEMA[i]
|
||||
if (project.name !== TS.projects.superalgos.globals.taskConstants.PROJECT_DEFINITION_NODE.config.codeName) { continue }
|
||||
for (let j = 0; j < project.TS.algorithmModules.length; j++) {
|
||||
algorithmModuleDefinition = project.TS.algorithmModules[j]
|
||||
if (algorithmModuleDefinition.name === learningAlgorithmName) {
|
||||
|
||||
TS.projects.superalgos.globals.processVariables.TOTAL_PROCESS_INSTANCES_CREATED++
|
||||
let project = TS.projects[TS.projects.superalgos.globals.taskConstants.PROJECT_DEFINITION_NODE.config.codeName.toLowerCase()]
|
||||
let botModule = project.algorithmModules[algorithmModuleDefinition.propertyName]
|
||||
let moduleFunction = botModule[algorithmModuleDefinition.functionName]
|
||||
learningAlgorithmModuleObject = moduleFunction(processIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
let machineLearningLibraryModuleObject
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -121,9 +101,38 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
|
||||
}
|
||||
|
||||
/*
|
||||
Initialize the Learning Algorithm
|
||||
Initialize the Machine Learning Library
|
||||
*/
|
||||
learningAlgorithmModuleObject.initialize(onInitializeReady)
|
||||
|
||||
let machineLearningLibrary = learningSystem.machineLearningLibrary
|
||||
|
||||
if (machineLearningLibrary === undefined) {
|
||||
// TODO
|
||||
}
|
||||
/*
|
||||
We will scan the project schema until we find the machine learning library
|
||||
defined by the user at the UI.
|
||||
*/
|
||||
for (let i = 0; i < TS.projects.superalgos.globals.taskConstants.PROJECTS_SCHEMA.length; i++) {
|
||||
let projectSchemaProject = TS.projects.superalgos.globals.taskConstants.PROJECTS_SCHEMA[i]
|
||||
if (projectSchemaProject.name !== machineLearningLibrary.project) { continue }
|
||||
|
||||
for (let j = 0; j < projectSchemaProject.TS.botModules.length; j++) {
|
||||
let botModuleDefinition = projectSchemaProject.TS.botModules[j]
|
||||
|
||||
/*
|
||||
We match the type of the machine learning library with the name at the project schema
|
||||
*/
|
||||
if (botModuleDefinition.name === machineLearningLibrary.type) {
|
||||
|
||||
let project = TS.projects[machineLearningLibrary.project.toLowerCase()]
|
||||
let botModule = project.botModules[botModuleDefinition.propertyName]
|
||||
let moduleFunction = botModule[botModuleDefinition.functionName]
|
||||
machineLearningLibraryModuleObject = moduleFunction(processIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
machineLearningLibraryModuleObject.initialize(onInitializeReady)
|
||||
|
||||
function onInitializeReady(err) {
|
||||
if (err.result === TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
|
||||
@@ -150,8 +159,8 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
|
||||
|
||||
function finalize() {
|
||||
|
||||
learningAlgorithmModuleObject.finalize()
|
||||
learningAlgorithmModuleObject = undefined
|
||||
machineLearningLibraryModuleObject.finalize()
|
||||
machineLearningLibraryModuleObject = undefined
|
||||
|
||||
chart = undefined
|
||||
exchange = undefined
|
||||
@@ -175,11 +184,11 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
|
||||
}
|
||||
|
||||
function mantain() {
|
||||
learningAlgorithmModuleObject.mantain()
|
||||
machineLearningLibraryModuleObject.mantain()
|
||||
}
|
||||
|
||||
function reset() {
|
||||
learningAlgorithmModuleObject.reset()
|
||||
machineLearningLibraryModuleObject.reset()
|
||||
|
||||
learningSystem.highlights = []
|
||||
learningSystem.errors = []
|
||||
@@ -201,7 +210,7 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
|
||||
exchange = pExchange
|
||||
market = pMarket
|
||||
|
||||
learningAlgorithmModuleObject.updateChart(pChart, pExchange, pMarket)
|
||||
machineLearningLibraryModuleObject.updateChart(pChart, pExchange, pMarket)
|
||||
}
|
||||
|
||||
function buildDynamicIndicators() {
|
||||
@@ -227,7 +236,7 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
|
||||
/*
|
||||
Initialize the Learning Algorithm
|
||||
*/
|
||||
learningAlgorithmModuleObject.run(onRun)
|
||||
machineLearningLibraryModuleObject.run(onRun)
|
||||
|
||||
function onRun(err) {
|
||||
if (err.result === TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
|
||||
@@ -271,7 +280,7 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
|
||||
}
|
||||
|
||||
/* Here we check if there is a formula to be evaluated */
|
||||
if ((node.type === 'Formula' || node.type === 'Announcement Formula') && evaluating === 'Formulas') {
|
||||
if ((node.type === 'Feature Formula' || node.type === 'Label Formula') && evaluating === 'Formulas') {
|
||||
if (node.code !== undefined) {
|
||||
/* We will eval this formula */
|
||||
if (isDescendent === true) {
|
||||
@@ -396,7 +405,7 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
|
||||
return
|
||||
} else {
|
||||
if (value !== undefined) {
|
||||
if (node.type === 'Formula' && isNaN(value)) {
|
||||
if ((node.type === 'Feature Formula' || node.type === 'Label Formula') && isNaN(value)) {
|
||||
|
||||
docs = {
|
||||
project: 'Superalgos',
|
||||
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
exports.newSuperalgosAlgorithmModulesTimeSeriesForcastingTensorFlowJS = function (processIndex) {
|
||||
/*
|
||||
This module implements a learning algorithm based on Time Series Forcasting with Tensor Flow js,
|
||||
as described at the folliwing web page:
|
||||
|
||||
https://jinglescode.github.io/time-series-forecasting-tensorflowjs/
|
||||
*/
|
||||
const MODULE_NAME = 'Time Series Forcasting Tensor Flow JS Learning Algorithm'
|
||||
let thisObject = {
|
||||
updateChart: updateChart,
|
||||
mantain: mantain,
|
||||
reset: reset,
|
||||
run: run,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let learningEngine
|
||||
let learningSystem
|
||||
let sessionParameters
|
||||
|
||||
/*
|
||||
These 3 are the main data structures available to users
|
||||
when writing conditions and formulas.
|
||||
*/
|
||||
let chart
|
||||
let exchange
|
||||
let market
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize(callbackFunction) {
|
||||
learningSystem = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.learningSystem
|
||||
learningEngine = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.learningEngine
|
||||
sessionParameters = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters
|
||||
|
||||
callbackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE)
|
||||
}
|
||||
|
||||
function finalize() {
|
||||
learningEngine = undefined
|
||||
learningSystem = undefined
|
||||
sessionParameters = undefined
|
||||
|
||||
chart = undefined
|
||||
exchange = undefined
|
||||
market = undefined
|
||||
}
|
||||
|
||||
function updateChart(pChart, pExchange, pMarket) {
|
||||
/*
|
||||
We need these 3 data structures to be a local objects
|
||||
accessible while evaluating conditions and formulas.
|
||||
*/
|
||||
chart = pChart
|
||||
exchange = pExchange
|
||||
market = pMarket
|
||||
}
|
||||
|
||||
function mantain() {
|
||||
|
||||
}
|
||||
|
||||
function reset() {
|
||||
}
|
||||
|
||||
function run(callbackFunction) {
|
||||
/*
|
||||
Do your magic here...
|
||||
*/
|
||||
|
||||
/*
|
||||
if all is good, return this...
|
||||
*/
|
||||
callbackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE)
|
||||
|
||||
/*
|
||||
if something is bad, return this...
|
||||
*/
|
||||
//callbackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE)
|
||||
|
||||
}
|
||||
|
||||
function badDefinitionUnhandledException(err, message, node) {
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Learning Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
learningSystem.addError([node.id, message, docs])
|
||||
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> " + message);
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.name = " + node.name);
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.type = " + node.type);
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.config = " + JSON.stringify(node.config));
|
||||
if (err !== undefined) {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> err.stack = " + err.stack);
|
||||
}
|
||||
throw 'Error Already Recorded'
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ function newSuperalgosFunctionLibraryDependenciesFilter() {
|
||||
return filters
|
||||
|
||||
function recursiveFilter(node) {
|
||||
if (node.type === 'Javascript Code' || node.type === 'Formula' || node.type === 'Feature Formula') {
|
||||
if (node.type === 'Javascript Code' || node.type === 'Formula' || node.type === 'Feature Formula' || node.type === 'Data Formula') {
|
||||
filter(node.code)
|
||||
}
|
||||
|
||||
|
||||
@@ -62,16 +62,30 @@ function newSuperalgosFunctionLibraryLearningSessionFunctions() {
|
||||
|
||||
let lightingPath = '' +
|
||||
'Learning System->' +
|
||||
'Tensor Flow Library->' +
|
||||
'Execution Environmnet->Supervised Learning->Unsupervised Learning->Self Learning->Reinforcement Learning->' +
|
||||
'TensorFlow Library->' +
|
||||
'Execution Environment->Supervised Learning->Unsupervised Learning->Self Learning->Reinforcement Learning->' +
|
||||
'WebGL Backend->NodeJS Backend->WASM Backend->CPU Backend->' +
|
||||
'Environment Flags->Debug Mode->Production Mode'
|
||||
'Environment Flags->Debug Mode->Production Mode->' +
|
||||
'Supervised Learning->Unsupervised Learning->Self Learning->Reinforcement Learning->' +
|
||||
'Artificial Neural Network->Model->' +
|
||||
'Optimizer->Loss Function->Metrics->' +
|
||||
'Layers API->Code API->' +
|
||||
'Secuential Model->Functional Model->' +
|
||||
'Input Layer->Secuential Layer->Output Layer->'+
|
||||
'Input Shape->Batch Input Shape->Input Features->Data Feature->Feature Formula->' +
|
||||
'Output Labels->Data Label->Label Formula->' +
|
||||
'Advanced Activation Layers->Basic Layers->Convolutional Layers->' +
|
||||
'Conv 1D Layer->Conv 2D Layer->Conv 2D Transpose Layer->Conv 3D Layer->Cropping 2D Layer->Depthwise Convo 2D Layer->Separable Convo 2D Layer->Up Sampling 2D Layer->' +
|
||||
'Activation Layer->Dense Layer->Dropout Layer->Embedding Layer->Flatten Layer->Permutable Layer->Rrepeat Vector Layer->Reshape Layer->Spatial Dropout 1D Layer->' +
|
||||
'Elu Layer->Leaky Relu Layer->Prelu Layer->Relu Layer->Softmax Layer->Thresholded Relu Layer->'+
|
||||
'Dimensionality Units->Activation Function->Batch Size->Dtype->Trainable->Weights->Tensor->Kernel->Bias->' +
|
||||
'Kernel Initializer->Kernel Constraint->Kernel Regularizer->' +
|
||||
'Bias Initializer->Bias Constraint->Bias Regularizer->'
|
||||
|
||||
let learningSystem = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node.learningSystemReference.payload.referenceParent, false, true, true, false, false, lightingPath)
|
||||
|
||||
lightingPath = '' +
|
||||
'Learning Engine->' +
|
||||
'Dynamic Indicators->Indicator Function->' +
|
||||
'Learning Current->Learning Last->Previous->' +
|
||||
'Learning Episode->' +
|
||||
'Episode Base Asset->Episode Quoted Asset->Learning Episode Counters->Learning Episode Statistics->' +
|
||||
|
||||
@@ -93,6 +93,18 @@ function newSuperalgosDocsFooter() {
|
||||
}
|
||||
HTML = HTML + '"></a>'
|
||||
|
||||
HTML = HTML + '<a href="#" onClick="UI.projects.superalgos.spaces.docsSpace.changeLanguage(\'CN\')"><img src="Images/Languages/CN.png" title="Simplified Chinese-Mandarin" class="docs-footer-language'
|
||||
if (languageCode === 'CN') {
|
||||
HTML = HTML + '-selected'
|
||||
}
|
||||
HTML = HTML + '"></a>'
|
||||
|
||||
HTML = HTML + '<a href="#" onClick="UI.projects.superalgos.spaces.docsSpace.changeLanguage(\'ID\')"><img src="Images/Languages/ID.png" title="Bahasa" class="docs-footer-language'
|
||||
if (languageCode === 'ID') {
|
||||
HTML = HTML + '-selected'
|
||||
}
|
||||
HTML = HTML + '"></a>'
|
||||
|
||||
HTML = HTML + '</div>'
|
||||
|
||||
HTML = HTML + '<div class="docs-footer-cell">'
|
||||
|
||||
@@ -1197,7 +1197,7 @@ function newUiObject() {
|
||||
answer to the command to stop. In those cases, we will stop execute the onStopped funcion anyways so as to
|
||||
return the UI to its default state.
|
||||
*/
|
||||
setTimeout(returnToDefaultState, 90000)
|
||||
setTimeout(returnToDefaultState, 15000)
|
||||
function returnToDefaultState() {
|
||||
if (wasStopped === false) {
|
||||
completeStop(callBackFunction, event)
|
||||
|
||||
@@ -24,6 +24,14 @@ function newSuperalgosUtilitiesLanguages() {
|
||||
languageLabel = 'Italian'
|
||||
break
|
||||
}
|
||||
case 'CN': {
|
||||
languageLabel = 'Simplified Chinese-Mandarin'
|
||||
break
|
||||
}
|
||||
case 'ID': {
|
||||
languageLabel = 'Bahasa'
|
||||
break
|
||||
}
|
||||
}
|
||||
return languageLabel
|
||||
}
|
||||
|
||||
@@ -351,6 +351,30 @@
|
||||
"relatedUiObject": "Core API",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "optimizer",
|
||||
"label": "Add Optimizer",
|
||||
"relatedUiObject": "Optimizer",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "lossFunction",
|
||||
"label": "Add Loss Function",
|
||||
"relatedUiObject": "Loss Function",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "metrics",
|
||||
"label": "Add Metrics",
|
||||
"relatedUiObject": "Metrics",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -383,10 +407,130 @@
|
||||
"name": "api",
|
||||
"type": "node",
|
||||
"childType": "Core API"
|
||||
},
|
||||
{
|
||||
"name": "optimizer",
|
||||
"type": "node",
|
||||
"childType": "Optimizer"
|
||||
},
|
||||
{
|
||||
"name": "lossFunction",
|
||||
"type": "node",
|
||||
"childType": "Loss Function"
|
||||
},
|
||||
{
|
||||
"name": "metrics",
|
||||
"type": "node",
|
||||
"childType": "Metrics"
|
||||
}
|
||||
],
|
||||
"icon": "tensorflow"
|
||||
},
|
||||
{
|
||||
"type": "Optimizer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"value\": \"sgd\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Model->"
|
||||
},
|
||||
"propertyNameAtParent": "optimizer",
|
||||
"childrenNodesProperties": [],
|
||||
"icon": "tensorflow"
|
||||
},
|
||||
{
|
||||
"type": "Loss Function",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"value\": \"categoricalCrossentropy\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Model->"
|
||||
},
|
||||
"propertyNameAtParent": "lossFunction",
|
||||
"childrenNodesProperties": [],
|
||||
"icon": "tensorflow"
|
||||
},
|
||||
{
|
||||
"type": "Metrics",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"value\": [\"accuracy\"]\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Model->"
|
||||
},
|
||||
"propertyNameAtParent": "metrics",
|
||||
"childrenNodesProperties": [],
|
||||
"icon": "tensorflow"
|
||||
},
|
||||
{
|
||||
"type": "Layers API",
|
||||
"menuItems": [
|
||||
@@ -524,15 +668,15 @@
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "layerType",
|
||||
"label": "Add Advanced Activation Layers",
|
||||
"propertyToCheckFor": "typeOfLayer",
|
||||
"label": "Add Activation Layers",
|
||||
"relatedUiObject": "Advanced Activation Layers",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "layerType",
|
||||
"propertyToCheckFor": "typeOfLayer",
|
||||
"label": "Add Basic Layers",
|
||||
"relatedUiObject": "Basic Layers",
|
||||
"actionFunction": "payload.executeAction"
|
||||
@@ -540,7 +684,7 @@
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "layerType",
|
||||
"propertyToCheckFor": "typeOfLayer",
|
||||
"label": "Add Convolutional Layers",
|
||||
"relatedUiObject": "Convolutional Layers",
|
||||
"actionFunction": "payload.executeAction"
|
||||
@@ -563,17 +707,17 @@
|
||||
"propertyNameAtParent": "layers",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "layerType",
|
||||
"name": "typeOfLayer",
|
||||
"type": "node",
|
||||
"childType": "Advanced Activation Layers"
|
||||
},
|
||||
{
|
||||
"name": "layerType",
|
||||
"name": "typeOfLayer",
|
||||
"type": "node",
|
||||
"childType": "Basic Layers"
|
||||
},
|
||||
{
|
||||
"name": "layerType",
|
||||
"name": "typeOfLayer",
|
||||
"type": "node",
|
||||
"childType": "Convolutional Layers"
|
||||
}
|
||||
@@ -646,7 +790,7 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Secuential Layer->"
|
||||
},
|
||||
"propertyNameAtParent": "layerType",
|
||||
"propertyNameAtParent": "typeOfLayer",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "layer",
|
||||
@@ -684,6 +828,13 @@
|
||||
{
|
||||
"type": "Elu Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -694,6 +845,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -706,6 +863,13 @@
|
||||
{
|
||||
"type": "Leaky Relu Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -716,6 +880,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -728,6 +898,13 @@
|
||||
{
|
||||
"type": "Prelu Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -738,6 +915,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -750,6 +933,13 @@
|
||||
{
|
||||
"type": "Relu Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -760,6 +950,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -772,6 +968,13 @@
|
||||
{
|
||||
"type": "Softmax Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -782,6 +985,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -794,6 +1003,13 @@
|
||||
{
|
||||
"type": "Thresholded Relu Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -804,6 +1020,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -903,7 +1125,7 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Secuential Layer->"
|
||||
},
|
||||
"propertyNameAtParent": "layerType",
|
||||
"propertyNameAtParent": "typeOfLayer",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "layer",
|
||||
@@ -956,6 +1178,13 @@
|
||||
{
|
||||
"type": "Activation Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -966,6 +1195,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -978,6 +1213,13 @@
|
||||
{
|
||||
"type": "Dense Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
@@ -1052,6 +1294,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -1720,6 +1968,13 @@
|
||||
{
|
||||
"type": "Dropout Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -1730,6 +1985,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -1742,6 +2003,13 @@
|
||||
{
|
||||
"type": "Embedding Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -1752,6 +2020,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -1764,6 +2038,13 @@
|
||||
{
|
||||
"type": "Flatten Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -1774,6 +2055,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -1786,6 +2073,13 @@
|
||||
{
|
||||
"type": "Permute Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -1796,6 +2090,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -1808,6 +2108,13 @@
|
||||
{
|
||||
"type": "Repeat Vector Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -1818,6 +2125,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -1830,6 +2143,13 @@
|
||||
{
|
||||
"type": "Reshape Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -1840,6 +2160,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -1852,6 +2178,13 @@
|
||||
{
|
||||
"type": "Spatial Dropout 1D Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -1862,6 +2195,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -1874,6 +2213,13 @@
|
||||
{
|
||||
"type": "Convolutional Layers",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
@@ -1953,7 +2299,7 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Secuential Layer->"
|
||||
},
|
||||
"propertyNameAtParent": "layerType",
|
||||
"propertyNameAtParent": "typeOfLayer",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "layer",
|
||||
@@ -2001,6 +2347,13 @@
|
||||
{
|
||||
"type": "Conv 1D Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -2011,6 +2364,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -2023,6 +2382,13 @@
|
||||
{
|
||||
"type": "Conv 2D Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -2033,6 +2399,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -2045,6 +2417,13 @@
|
||||
{
|
||||
"type": "Conv 2D Transpose Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -2055,6 +2434,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -2067,6 +2452,13 @@
|
||||
{
|
||||
"type": "Conv 3D Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -2077,6 +2469,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -2089,6 +2487,13 @@
|
||||
{
|
||||
"type": "Cropping 2D Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -2099,6 +2504,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -2111,6 +2522,13 @@
|
||||
{
|
||||
"type": "Depthwise Conv 2D Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -2121,6 +2539,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -2133,6 +2557,13 @@
|
||||
{
|
||||
"type": "Separable Conv 2D Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -2143,6 +2574,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -2155,6 +2592,13 @@
|
||||
{
|
||||
"type": "Up Sampling 2D Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration",
|
||||
"actionFunction": "uiObject.configEditor.activate"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -2165,6 +2609,12 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n \"codeName\": \"\"\n}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
@@ -2282,8 +2732,8 @@
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Feature",
|
||||
"relatedUiObject": "Feature",
|
||||
"label": "Add Data Feature",
|
||||
"relatedUiObject": "Data Feature",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
@@ -2304,20 +2754,20 @@
|
||||
"propertyNameAtParent": "inputFeatures",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "features",
|
||||
"name": "dataFeatures",
|
||||
"type": "array",
|
||||
"childType": "Feature"
|
||||
"childType": "Data Feature"
|
||||
}
|
||||
],
|
||||
"icon": "tensorflow"
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"type": "Data Feature",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "inpfeatureFormulautFeatures",
|
||||
"propertyToCheckFor": "featureFormula",
|
||||
"label": "Add Feature Formula",
|
||||
"relatedUiObject": "Feature Formula",
|
||||
"actionFunction": "payload.executeAction"
|
||||
@@ -2337,7 +2787,7 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Input Features->"
|
||||
},
|
||||
"propertyNameAtParent": "features",
|
||||
"propertyNameAtParent": "dataFeatures",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "featureFormula",
|
||||
@@ -2377,7 +2827,7 @@
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Feature->"
|
||||
"compatibleTypes": "->Data Feature->"
|
||||
},
|
||||
"propertyNameAtParent": "featureFormula",
|
||||
"childrenNodesProperties": [],
|
||||
@@ -2386,6 +2836,14 @@
|
||||
{
|
||||
"type": "Output Layer",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "outputLabels",
|
||||
"label": "Add Output Labels",
|
||||
"relatedUiObject": "Output Labels",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
@@ -2408,6 +2866,118 @@
|
||||
"compatibleTypes": "->Secuential Model->"
|
||||
},
|
||||
"propertyNameAtParent": "outputLayer",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "outputLabels",
|
||||
"type": "node",
|
||||
"childType": "Output Labels"
|
||||
}
|
||||
],
|
||||
"icon": "tensorflow"
|
||||
},
|
||||
{
|
||||
"type": "Output Labels",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"label": "Add Data Label",
|
||||
"relatedUiObject": "Data Label",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Output Layer->"
|
||||
},
|
||||
"propertyNameAtParent": "outputLabels",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "dataLabels",
|
||||
"type": "array",
|
||||
"childType": "Data Label"
|
||||
}
|
||||
],
|
||||
"icon": "tensorflow"
|
||||
},
|
||||
{
|
||||
"type": "Data Label",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "labelFormula",
|
||||
"label": "Add Label Formula",
|
||||
"relatedUiObject": "Label Formula",
|
||||
"actionFunction": "payload.executeAction"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Output Labels->"
|
||||
},
|
||||
"propertyNameAtParent": "dataLabels",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "labelFormula",
|
||||
"type": "node",
|
||||
"childType": "Label Formula",
|
||||
"autoAdd": true
|
||||
}
|
||||
],
|
||||
"icon": "tensorflow"
|
||||
},
|
||||
{
|
||||
"type": "Label Formula",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Edit",
|
||||
"actionFunction": "uiObject.formulaEditor.activate",
|
||||
"label": "Edit",
|
||||
"iconPathOn": "javascript-code",
|
||||
"iconPathOff": "javascript-code"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"formula": true
|
||||
},
|
||||
"initialValues": {
|
||||
"code": ""
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Data Label->"
|
||||
},
|
||||
"propertyNameAtParent": "labelFormula",
|
||||
"childrenNodesProperties": [],
|
||||
"icon": "tensorflow"
|
||||
},
|
||||
|
||||
+395
@@ -0,0 +1,395 @@
|
||||
exports.newTensorFlowBotModulesTensorFlowLibrary = function (processIndex) {
|
||||
|
||||
const MODULE_NAME = 'Time Series Forcasting Tensor Flow JS Learning Algorithm'
|
||||
let thisObject = {
|
||||
updateChart: updateChart,
|
||||
mantain: mantain,
|
||||
reset: reset,
|
||||
run: run,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let learningEngine
|
||||
let learningSystem
|
||||
let sessionParameters
|
||||
|
||||
/*
|
||||
These 3 are the main data structures available to users
|
||||
when writing conditions and formulas.
|
||||
*/
|
||||
let chart
|
||||
let exchange
|
||||
let market
|
||||
|
||||
let tensorFlowBackend
|
||||
let tensorFlowAPI
|
||||
let tensorFlowModel
|
||||
let tensorFlowData
|
||||
let features = []
|
||||
let labels = []
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize(callbackFunction) {
|
||||
learningSystem = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.learningSystem
|
||||
learningEngine = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.learningEngine
|
||||
sessionParameters = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters
|
||||
|
||||
setupBackend()
|
||||
setupEnvironmentFlags()
|
||||
setupModel()
|
||||
compileModel()
|
||||
|
||||
callbackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE)
|
||||
|
||||
function setupBackend() {
|
||||
/*
|
||||
Setup the default backend.
|
||||
*/
|
||||
tensorFlowBackend = require("@tensorflow/tfjs-node")
|
||||
|
||||
if (
|
||||
learningSystem.machineLearningLibrary.executionEnvironment !== undefined &&
|
||||
learningSystem.machineLearningLibrary.executionEnvironment.backend !== undefined
|
||||
) {
|
||||
/*
|
||||
Replace the backend for the one defined at the UI.
|
||||
*/
|
||||
switch (learningSystem.machineLearningLibrary.executionEnvironment.backend.config.codeName) {
|
||||
case 'node': {
|
||||
// This is already the default.
|
||||
break
|
||||
}
|
||||
case 'webgl': {
|
||||
tensorFlowBackend = require("@tensorflow/tfjs-backend-webgl")
|
||||
break
|
||||
}
|
||||
case 'wasm': {
|
||||
tensorFlowBackend = require("@tensorflow/tfjs-backend-wasm")
|
||||
break
|
||||
}
|
||||
case 'cpu': {
|
||||
tensorFlowBackend = require("@tensorflow/tfjs-backend-cpu")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupEnvironmentFlags() {
|
||||
if (
|
||||
learningSystem.machineLearningLibrary.executionEnvironment !== undefined &&
|
||||
learningSystem.machineLearningLibrary.executionEnvironment.environmentFlags !== undefined &&
|
||||
learningSystem.machineLearningLibrary.executionEnvironment.environmentFlags.mode
|
||||
) {
|
||||
switch (learningSystem.machineLearningLibrary.executionEnvironment.environmentFlags.mode.type) {
|
||||
case 'Debug Mode': {
|
||||
tensorFlowBackend.enableDebugMode()
|
||||
break
|
||||
}
|
||||
case 'Debug Mode': {
|
||||
tensorFlowBackend.enableProdMode()
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupModel() {
|
||||
if (
|
||||
learningSystem.machineLearningLibrary.typeOfLearning !== undefined &&
|
||||
learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel !== undefined &&
|
||||
learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model !== undefined &&
|
||||
learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.api !== undefined
|
||||
) {
|
||||
switch (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.api.type) {
|
||||
case 'Layers API': {
|
||||
tensorFlowAPI = require("@tensorflow/tfjs-layers")
|
||||
if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.api.layersModel === undefined) { return }
|
||||
|
||||
switch (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.api.layersModel.type) {
|
||||
case 'Secuential Model': {
|
||||
setupSecuentialModel(learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.api.layersModel)
|
||||
break
|
||||
}
|
||||
case 'Functional Model': {
|
||||
break
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'Code API': {
|
||||
tensorFlowAPI = require("@tensorflow/tfjs-core")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupSecuentialModel(secuentialModel) {
|
||||
/*
|
||||
Some validations
|
||||
*/
|
||||
if (secuentialModel.inputLayer === undefined) {
|
||||
// TODO
|
||||
return
|
||||
}
|
||||
if (secuentialModel.outputLayer === undefined) {
|
||||
// TODO
|
||||
return
|
||||
}
|
||||
if (secuentialModel.layers.length === 0) {
|
||||
// TODO
|
||||
return
|
||||
}
|
||||
if (secuentialModel.inputLayer.referenceParent === undefined) {
|
||||
// TODO
|
||||
return
|
||||
}
|
||||
|
||||
tensorFlowModel = tensorFlowAPI.sequential()
|
||||
|
||||
for (let i = 0; i < secuentialModel.layers.length; i++) {
|
||||
let layerNode = secuentialModel.layers[i]
|
||||
let layersFunction
|
||||
let argsObject = {}
|
||||
let layerObject
|
||||
|
||||
if (layerNode.typeOfLayer === undefined) { continue }
|
||||
if (layerNode.typeOfLayer.layer === undefined) { continue }
|
||||
|
||||
switch (layerNode.typeOfLayer.layer.type) {
|
||||
case 'Dense Layer': {
|
||||
layersFunction = tensorFlowAPI.layers.dense
|
||||
break
|
||||
}
|
||||
case ' ': {
|
||||
break
|
||||
}
|
||||
case ' ': {
|
||||
break
|
||||
}
|
||||
default: {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
'[WARN] Layer of type ' + layerNode.typeOfLayer.layer.type + ' not implemented yet.')
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (layerNode.typeOfLayer.layer.dimensionalityUnits !== undefined) {
|
||||
argsObject.units = layerNode.typeOfLayer.layer.dimensionalityUnits.config.value
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.activationFunction !== undefined) {
|
||||
argsObject.activation = layerNode.typeOfLayer.layer.activationFunction.config.value
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.bias !== undefined) {
|
||||
argsObject.useBias = true
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.kernel !== undefined) {
|
||||
if (layerNode.typeOfLayer.layer.kernel.kernelInitializer !== undefined) {
|
||||
argsObject.kernelInitializer = layerNode.typeOfLayer.layer.kernel.kernelInitializer.config.value
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.kernel.kernelConstraint !== undefined) {
|
||||
argsObject.kernelConstraint = layerNode.typeOfLayer.layer.kernel.kernelConstraint.config.value
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.kernel.kernelRegularizer !== undefined) {
|
||||
argsObject.kernelRegularizer = layerNode.typeOfLayer.layer.kernel.kernelRegularizer.config.value
|
||||
}
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.bias !== undefined) {
|
||||
if (layerNode.typeOfLayer.layer.bias.biasInitializer !== undefined) {
|
||||
argsObject.biasInitializer = layerNode.typeOfLayer.layer.bias.biasInitializer.config.value
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.bias.biasConstraint !== undefined) {
|
||||
argsObject.biasConstraint = layerNode.typeOfLayer.layer.bias.biasConstraint.config.value
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.bias.biasRegularizer !== undefined) {
|
||||
argsObject.biasRegularizer = layerNode.typeOfLayer.layer.bias.biasRegularizer.config.value
|
||||
}
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.batchSize !== undefined) {
|
||||
argsObject.batchSize = layerNode.typeOfLayer.layer.batchSize.config.value
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.dtype !== undefined) {
|
||||
argsObject.dtype = layerNode.typeOfLayer.layer.dtype.config.value
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.trainable !== undefined) {
|
||||
argsObject.trainable = layerNode.typeOfLayer.layer.trainable.config.value
|
||||
}
|
||||
if (layerNode.typeOfLayer.layer.weights !== undefined) {
|
||||
if (layerNode.typeOfLayer.layer.weights.tensor !== undefined) {
|
||||
argsObject.weights = layerNode.typeOfLayer.layer.weights.tensor.config.value
|
||||
}
|
||||
}
|
||||
argsObject.name = layerNode.typeOfLayer.layer.config.codeName
|
||||
|
||||
/*
|
||||
Check if this is the input layer.
|
||||
*/
|
||||
if (secuentialModel.inputLayer.referenceParent.id === layerNode.id) {
|
||||
if (secuentialModel.inputLayer.inputShape !== undefined) {
|
||||
argsObject.inputShape = secuentialModel.inputLayer.inputShape.config.value
|
||||
}
|
||||
}
|
||||
|
||||
layerObject = layersFunction(argsObject)
|
||||
|
||||
tensorFlowModel.add(layerObject)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function compileModel() {
|
||||
if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.optimizer === undefined) {
|
||||
//TODO
|
||||
return
|
||||
}
|
||||
if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.optimizer.config.value === undefined) {
|
||||
//TODO
|
||||
return
|
||||
}
|
||||
if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.lossFunction === undefined) {
|
||||
//TODO
|
||||
return
|
||||
}
|
||||
if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.lossFunction.config.value === undefined) {
|
||||
//TODO
|
||||
return
|
||||
}
|
||||
if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.metrics === undefined) {
|
||||
//TODO
|
||||
return
|
||||
}
|
||||
if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.metrics.config.value === undefined) {
|
||||
//TODO
|
||||
return
|
||||
}
|
||||
let compileArgs = {
|
||||
optimizer: learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.optimizer.config.value,
|
||||
loss: learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.lossFunction.config.value,
|
||||
metrics: [learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.metrics.config.value]
|
||||
}
|
||||
|
||||
tensorFlowModel.compile(compileArgs)
|
||||
}
|
||||
}
|
||||
|
||||
function finalize() {
|
||||
learningEngine = undefined
|
||||
learningSystem = undefined
|
||||
sessionParameters = undefined
|
||||
|
||||
chart = undefined
|
||||
exchange = undefined
|
||||
market = undefined
|
||||
|
||||
tensorFlowBackend = undefined
|
||||
tensorFlowAPI = undefined
|
||||
tensorFlowModel = undefined
|
||||
tensorFlowData = undefined
|
||||
|
||||
features = []
|
||||
labels = []
|
||||
}
|
||||
|
||||
function updateChart(pChart, pExchange, pMarket) {
|
||||
/*
|
||||
We need these 3 data structures to be a local objects
|
||||
accessible while evaluating conditions and formulas.
|
||||
*/
|
||||
chart = pChart
|
||||
exchange = pExchange
|
||||
market = pMarket
|
||||
}
|
||||
|
||||
function mantain() {
|
||||
|
||||
}
|
||||
|
||||
function reset() {
|
||||
}
|
||||
|
||||
function run(callbackFunction) {
|
||||
|
||||
let layersModel = learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.api.layersModel
|
||||
|
||||
/*
|
||||
Building the Features Tensor
|
||||
*/
|
||||
if (layersModel.inputLayer === undefined) {
|
||||
// TODO
|
||||
}
|
||||
if (layersModel.inputLayer.inputFeatures === undefined) {
|
||||
// TODO
|
||||
}
|
||||
learningSystem.evalFormulas(layersModel.inputLayer.inputFeatures, layersModel.inputLayer.inputFeatures.type)
|
||||
|
||||
for (let i = 0; i < layersModel.inputLayer.inputFeatures.dataFeatures.length; i++) {
|
||||
let dataFeature = layersModel.inputLayer.inputFeatures.dataFeatures[i]
|
||||
if (dataFeature.featureFormula === undefined) { continue }
|
||||
let featureValue = learningSystem.formulas.get(dataFeature.featureFormula.id)
|
||||
features.push(featureValue)
|
||||
}
|
||||
|
||||
/*
|
||||
Building the Labels Tensor
|
||||
*/
|
||||
if (layersModel.outputLayer === undefined) {
|
||||
// TODO
|
||||
}
|
||||
if (layersModel.outputLayer.outputLabels === undefined) {
|
||||
// TODO
|
||||
}
|
||||
learningSystem.evalFormulas(layersModel.outputLayer.outputLabels, layersModel.outputLayer.outputLabels.type)
|
||||
|
||||
for (let i = 0; i < layersModel.outputLayer.outputLabels.dataLabels.length; i++) {
|
||||
let dataLabel = layersModel.outputLayer.outputLabels.dataLabels[i]
|
||||
if (dataLabel.labelFormula === undefined) { continue }
|
||||
let labelValue = learningSystem.formulas.get(dataLabel.labelFormula.id)
|
||||
labels.push(labelValue)
|
||||
}
|
||||
|
||||
tensorFlowData = require("@tensorflow/tfjs-data")
|
||||
|
||||
let dataset = tensorFlowData.array([features, labels])
|
||||
|
||||
tensorFlowModel.fitDataset(dataset, { epochs: 5 }).then(info => {
|
||||
console.log('Accuracy', info.history.acc);
|
||||
|
||||
/*
|
||||
if all is good, return this...
|
||||
*/
|
||||
callbackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE)
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if something is bad, return this...
|
||||
*/
|
||||
//callbackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE)
|
||||
|
||||
}
|
||||
|
||||
function badDefinitionUnhandledException(err, message, node) {
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Learning Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
learningSystem.addError([node.id, message, docs])
|
||||
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> " + message);
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.name = " + node.name);
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.type = " + node.type);
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.config = " + JSON.stringify(node.config));
|
||||
if (err !== undefined) {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> err.stack = " + err.stack);
|
||||
}
|
||||
throw 'Error Already Recorded'
|
||||
}
|
||||
}
|
||||
Projects/TensorFlow/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/node_modules/.bin/detect-libc
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../detect-libc/bin/detect-libc.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../detect-libc/bin/detect-libc.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\detect-libc\bin\detect-libc.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../detect-libc/bin/detect-libc.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../detect-libc/bin/detect-libc.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../needle/bin/needle" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../needle/bin/needle" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\needle\bin\needle" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../needle/bin/needle" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../needle/bin/needle" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../node-pre-gyp/bin/node-pre-gyp" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../node-pre-gyp/bin/node-pre-gyp" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\node-pre-gyp\bin\node-pre-gyp" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../node-pre-gyp/bin/node-pre-gyp" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../node-pre-gyp/bin/node-pre-gyp" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../nopt/bin/nopt.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\nopt\bin\nopt.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../rc/cli.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../rc/cli.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\rc\cli.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../rc/cli.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../rc/cli.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../rimraf/bin.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../rimraf/bin.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\rimraf\bin.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../semver/bin/semver" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../semver/bin/semver" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\semver\bin\semver" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../semver/bin/semver" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../semver/bin/semver" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../@tensorflow/tfjs/dist/tools/custom_module/cli.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../@tensorflow/tfjs/dist/tools/custom_module/cli.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\@tensorflow\tfjs\dist\tools\custom_module\cli.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../@tensorflow/tfjs/dist/tools/custom_module/cli.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../@tensorflow/tfjs/dist/tools/custom_module/cli.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
Generated
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
# Usage
|
||||
|
||||
This package implements a JavaScript based CPU backend to TensorFlow.js.
|
||||
|
||||
## Importing the backend
|
||||
|
||||
Note: this backend is included by default in `@tensorflow/tfjs`.
|
||||
|
||||
### Via NPM
|
||||
|
||||
```js
|
||||
// Import @tensorflow/tfjs-core
|
||||
import * as tf from '@tensorflow/tfjs-core';
|
||||
// Adds the CPU backend to the global backend registry.
|
||||
import '@tensorflow/tfjs-backend-cpu';
|
||||
```
|
||||
|
||||
### Via a script tag
|
||||
|
||||
```html
|
||||
<!-- Import @tensorflow/tfjs-core -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
|
||||
|
||||
<!-- Adds the CPU backend to the global backend registry -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu"></script>
|
||||
```
|
||||
|
||||
You can also get ES2017 code using the following links
|
||||
|
||||
```html
|
||||
<!-- Import @tensorflow/tfjs-core -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core@2.0.0-rc.4/dist/tf-core.es2017.js"></script>
|
||||
|
||||
<!-- Adds the CPU backend to the global backend registry -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu@2.0.0-rc.4/dist/tf-backend-cpu.es2017.js"></script>
|
||||
```
|
||||
|
||||
Generated
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { backend_util, BackendTimingInfo, DataStorage, DataType, KernelBackend, Rank, Tensor, Tensor2D, TensorBuffer, TensorInfo } from '@tensorflow/tfjs-core';
|
||||
interface DataId {
|
||||
}
|
||||
export interface TensorData<D extends DataType> {
|
||||
values?: backend_util.BackendValues;
|
||||
dtype: D;
|
||||
complexTensorInfos?: {
|
||||
real: TensorInfo;
|
||||
imag: TensorInfo;
|
||||
};
|
||||
refCount: number;
|
||||
}
|
||||
export declare class MathBackendCPU extends KernelBackend {
|
||||
blockSize: number;
|
||||
data: DataStorage<TensorData<DataType>>;
|
||||
private firstUse;
|
||||
constructor();
|
||||
write(values: backend_util.BackendValues, shape: number[], dtype: DataType): DataId;
|
||||
/**
|
||||
* Create a data bucket in cpu backend.
|
||||
* @param shape Shape of the `TensorInfo`.
|
||||
* @param dtype DType of the `TensorInfo`.
|
||||
* @param values The value of the `TensorInfo` stored as a flattened array.
|
||||
*/
|
||||
makeTensorInfo(shape: number[], dtype: DataType, values?: backend_util.BackendValues | string[]): TensorInfo;
|
||||
/** Increase refCount of a `TensorData`. */
|
||||
incRef(dataId: DataId): void;
|
||||
/** Decrease refCount of a `TensorData`. */
|
||||
decRef(dataId: DataId): void;
|
||||
move(dataId: DataId, values: backend_util.BackendValues, shape: number[], dtype: DataType): void;
|
||||
numDataIds(): number;
|
||||
read(dataId: DataId): Promise<backend_util.BackendValues>;
|
||||
readSync(dataId: DataId): backend_util.BackendValues;
|
||||
bufferSync<R extends Rank>(t: TensorInfo): TensorBuffer<R>;
|
||||
makeOutput<T extends Tensor>(values: backend_util.BackendValues, shape: number[], dtype: DataType): T;
|
||||
disposeData(dataId: DataId): void;
|
||||
disposeIntermediateTensorInfo(tensorInfo: TensorInfo): void;
|
||||
time(f: () => void): Promise<BackendTimingInfo>;
|
||||
memory(): {
|
||||
unreliable: boolean;
|
||||
reasons: string[];
|
||||
};
|
||||
where(condition: Tensor): Tensor2D;
|
||||
dispose(): void;
|
||||
floatPrecision(): 16 | 32;
|
||||
/** Returns the smallest representable number. */
|
||||
epsilon(): number;
|
||||
}
|
||||
export {};
|
||||
Generated
Vendored
+161
@@ -0,0 +1,161 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { backend_util, buffer, DataStorage, engine, env, kernel_impls, KernelBackend, util } from '@tensorflow/tfjs-core';
|
||||
const whereImpl = kernel_impls.whereImpl;
|
||||
import { assertNotComplex } from './cpu_util';
|
||||
export class MathBackendCPU extends KernelBackend {
|
||||
constructor() {
|
||||
super();
|
||||
this.blockSize = 48;
|
||||
this.firstUse = true;
|
||||
this.data = new DataStorage(this, engine());
|
||||
}
|
||||
write(values, shape, dtype) {
|
||||
if (this.firstUse) {
|
||||
this.firstUse = false;
|
||||
if (env().get('IS_NODE')) {
|
||||
backend_util.warn('\n============================\n' +
|
||||
'Hi there 👋. Looks like you are running TensorFlow.js in ' +
|
||||
'Node.js. To speed things up dramatically, install our node ' +
|
||||
'backend, which binds to TensorFlow C++, by running ' +
|
||||
'npm i @tensorflow/tfjs-node, ' +
|
||||
'or npm i @tensorflow/tfjs-node-gpu if you have CUDA. ' +
|
||||
'Then call require(\'@tensorflow/tfjs-node\'); (-gpu ' +
|
||||
'suffix for CUDA) at the start of your program. ' +
|
||||
'Visit https://github.com/tensorflow/tfjs-node for more details.' +
|
||||
'\n============================');
|
||||
}
|
||||
}
|
||||
const dataId = {};
|
||||
this.data.set(dataId, { values, dtype, refCount: 1 });
|
||||
return dataId;
|
||||
}
|
||||
/**
|
||||
* Create a data bucket in cpu backend.
|
||||
* @param shape Shape of the `TensorInfo`.
|
||||
* @param dtype DType of the `TensorInfo`.
|
||||
* @param values The value of the `TensorInfo` stored as a flattened array.
|
||||
*/
|
||||
makeTensorInfo(shape, dtype, values) {
|
||||
let outId;
|
||||
if (dtype === 'string' && values != null && values.length > 0 &&
|
||||
util.isString(values[0])) {
|
||||
const encodedValues = values.map(d => util.encodeString(d));
|
||||
outId = this.write(encodedValues, shape, dtype);
|
||||
}
|
||||
else {
|
||||
outId = this.write(values, shape, dtype);
|
||||
}
|
||||
return { dataId: outId, shape, dtype };
|
||||
}
|
||||
/** Increase refCount of a `TensorData`. */
|
||||
incRef(dataId) {
|
||||
const tensorData = this.data.get(dataId);
|
||||
tensorData.refCount++;
|
||||
}
|
||||
/** Decrease refCount of a `TensorData`. */
|
||||
decRef(dataId) {
|
||||
if (this.data.has(dataId)) {
|
||||
const tensorData = this.data.get(dataId);
|
||||
tensorData.refCount--;
|
||||
}
|
||||
}
|
||||
move(dataId, values, shape, dtype) {
|
||||
this.data.set(dataId, { values, dtype, refCount: 1 });
|
||||
}
|
||||
numDataIds() {
|
||||
return this.data.numDataIds();
|
||||
}
|
||||
async read(dataId) {
|
||||
return this.readSync(dataId);
|
||||
}
|
||||
readSync(dataId) {
|
||||
const { dtype, complexTensorInfos } = this.data.get(dataId);
|
||||
if (dtype === 'complex64') {
|
||||
const realValues = this.readSync(complexTensorInfos.real.dataId);
|
||||
const imagValues = this.readSync(complexTensorInfos.imag.dataId);
|
||||
return backend_util.mergeRealAndImagArrays(realValues, imagValues);
|
||||
}
|
||||
return this.data.get(dataId).values;
|
||||
}
|
||||
bufferSync(t) {
|
||||
const data = this.readSync(t.dataId);
|
||||
let decodedData = data;
|
||||
if (t.dtype === 'string') {
|
||||
try {
|
||||
// Decode the bytes into string.
|
||||
decodedData = data.map(d => util.decodeString(d));
|
||||
}
|
||||
catch (_a) {
|
||||
throw new Error('Failed to decode encoded string bytes into utf-8');
|
||||
}
|
||||
}
|
||||
return buffer(t.shape, t.dtype, decodedData);
|
||||
}
|
||||
makeOutput(values, shape, dtype) {
|
||||
const dataId = this.write(values, shape, dtype);
|
||||
return engine().makeTensorFromDataId(dataId, shape, dtype, this);
|
||||
}
|
||||
disposeData(dataId) {
|
||||
if (this.data.has(dataId)) {
|
||||
const { complexTensorInfos } = this.data.get(dataId);
|
||||
if (complexTensorInfos != null) {
|
||||
this.disposeData(complexTensorInfos.real.dataId);
|
||||
this.disposeData(complexTensorInfos.imag.dataId);
|
||||
}
|
||||
this.data.delete(dataId);
|
||||
}
|
||||
}
|
||||
disposeIntermediateTensorInfo(tensorInfo) {
|
||||
const dataId = tensorInfo.dataId;
|
||||
if (this.data.has(dataId)) {
|
||||
const tensorData = this.data.get(dataId);
|
||||
tensorData.refCount--;
|
||||
if (tensorData.refCount < 1) {
|
||||
this.disposeData(dataId);
|
||||
}
|
||||
}
|
||||
}
|
||||
async time(f) {
|
||||
const start = util.now();
|
||||
f();
|
||||
const kernelMs = util.now() - start;
|
||||
return { kernelMs };
|
||||
}
|
||||
memory() {
|
||||
return {
|
||||
// Unreliable due to automatic gc. The numbers above are cumulative.
|
||||
unreliable: true,
|
||||
reasons: ['The reported memory is an upper bound. Due to automatic garbage ' +
|
||||
'collection, the true allocated memory may be less.']
|
||||
};
|
||||
}
|
||||
where(condition) {
|
||||
assertNotComplex([condition], 'where');
|
||||
const condVals = this.readSync(condition.dataId);
|
||||
return whereImpl(condition.shape, condVals);
|
||||
}
|
||||
dispose() { }
|
||||
floatPrecision() {
|
||||
return 32;
|
||||
}
|
||||
/** Returns the smallest representable number. */
|
||||
epsilon() {
|
||||
return super.epsilon();
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=backend_cpu.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"backend_cpu.js","sourceRoot":"","sources":["../src/backend_cpu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,YAAY,EAAqB,MAAM,EAAE,WAAW,EAAwB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAA0E,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAEzO,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAgB5C,MAAM,OAAO,cAAe,SAAQ,aAAa;IAM/C;QACE,KAAK,EAAE,CAAC;QANH,cAAS,GAAG,EAAE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licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import * as shared from './shared';
|
||||
export { MathBackendCPU } from './backend_cpu';
|
||||
export { version as version_cpu } from './version';
|
||||
export { shared };
|
||||
Generated
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
/*
|
||||
* base.ts contains all the exports from tfjs-backend-cpu
|
||||
* without auto-kernel registration
|
||||
*/
|
||||
import { registerBackend } from '@tensorflow/tfjs-core';
|
||||
import { MathBackendCPU } from './backend_cpu';
|
||||
import * as shared from './shared';
|
||||
export { MathBackendCPU } from './backend_cpu';
|
||||
export { version as version_cpu } from './version';
|
||||
export { shared };
|
||||
// Side effects for default initialization of MathBackendCPU
|
||||
registerBackend('cpu', () => new MathBackendCPU(), 1 /* priority */);
|
||||
//# sourceMappingURL=base.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base.js","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACH,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,WAAW,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,CAAC;AAEhB,4DAA4D;AAC5D,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC"}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { TensorInfo } from '@tensorflow/tfjs-core';
|
||||
export declare function assertNotComplex(tensor: TensorInfo | TensorInfo[], opName: string): void;
|
||||
Generated
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { util } from '@tensorflow/tfjs-core';
|
||||
export function assertNotComplex(tensor, opName) {
|
||||
if (!Array.isArray(tensor)) {
|
||||
tensor = [tensor];
|
||||
}
|
||||
tensor.forEach(t => {
|
||||
if (t != null) {
|
||||
util.assert(t.dtype !== 'complex64', () => `${opName} does not support complex64 tensors in the CPU backend.`);
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=cpu_util.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cpu_util.js","sourceRoot":"","sources":["../src/cpu_util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAa,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAEvD,MAAM,UAAU,gBAAgB,CAC5B,MAA+B,EAAE,MAAc;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC1B,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;KACnB;IACD,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACjB,IAAI,CAAC,IAAI,IAAI,EAAE;YACb,IAAI,CAAC,MAAM,CACP,CAAC,CAAC,KAAK,KAAK,WAAW,EACvB,GAAG,EAAE,CAAC,GACF,MAAM,yDAAyD,CAAC,CAAC;SAC1E;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
export * from './base';
|
||||
import './register_all_kernels';
|
||||
Generated
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
// All exports from this package should be in base.
|
||||
export * from './base';
|
||||
import './register_all_kernels';
|
||||
//# sourceMappingURL=index.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,mDAAmD;AACnD,cAAc,QAAQ,CAAC;AACvB,OAAO,wBAAwB,CAAC"}
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { KernelConfig, TypedArray } from '@tensorflow/tfjs-core';
|
||||
import { MathBackendCPU } from '../backend_cpu';
|
||||
export declare function simpleAbsImpl(vals: TypedArray): Float32Array;
|
||||
export declare const abs: (args: {
|
||||
inputs: Pick<import("@tensorflow/tfjs-core").NamedTensorInfoMap, "x">;
|
||||
backend: MathBackendCPU;
|
||||
}) => import("@tensorflow/tfjs-core").Tensor<import("@tensorflow/tfjs-core").Rank>;
|
||||
export declare const absConfig: KernelConfig;
|
||||
Generated
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { Abs, util } from '@tensorflow/tfjs-core';
|
||||
import { assertNotComplex } from '../cpu_util';
|
||||
export function simpleAbsImpl(vals) {
|
||||
const resultValues = new Float32Array(vals.length);
|
||||
for (let i = 0; i < vals.length; ++i) {
|
||||
resultValues[i] = Math.abs(vals[i]);
|
||||
}
|
||||
return resultValues;
|
||||
}
|
||||
export const abs = (args) => {
|
||||
const { x } = args.inputs;
|
||||
const cpuBackend = args.backend;
|
||||
assertNotComplex(x, 'abs');
|
||||
let resultValues = new Float32Array(util.sizeFromShape(x.shape));
|
||||
const values = cpuBackend.data.get(x.dataId).values;
|
||||
resultValues = simpleAbsImpl(values);
|
||||
return cpuBackend.makeOutput(resultValues, x.shape, 'float32');
|
||||
};
|
||||
export const absConfig = {
|
||||
kernelName: Abs,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: abs,
|
||||
};
|
||||
//# sourceMappingURL=Abs.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Abs.js","sourceRoot":"","sources":["../../src/kernels/Abs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,GAAG,EAAmD,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAGjG,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAE7C,MAAM,UAAU,aAAa,CAAC,IAAgB;IAC5C,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACpC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KACrC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,IAAkD,EAAE,EAAE;IACxE,MAAM,EAAC,CAAC,EAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACxB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC;IAEhC,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAE3B,IAAI,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAoB,CAAC;IAClE,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,UAAU,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,GAAuB;CACpC,CAAC"}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { KernelConfig } from '@tensorflow/tfjs-core';
|
||||
export declare const acos: import("@tensorflow/tfjs-core").KernelFunc;
|
||||
export declare const acosConfig: KernelConfig;
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { Acos } from '@tensorflow/tfjs-core';
|
||||
import { unaryKernelFunc } from '../utils/unary_utils';
|
||||
export const acos = unaryKernelFunc(Acos, (xi) => Math.acos(xi));
|
||||
export const acosConfig = {
|
||||
kernelName: Acos,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: acos,
|
||||
};
|
||||
//# sourceMappingURL=Acos.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Acos.js","sourceRoot":"","sources":["../../src/kernels/Acos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAe,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,IAAI;CACjB,CAAC"}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { KernelConfig } from '@tensorflow/tfjs-core';
|
||||
export declare const acosh: import("@tensorflow/tfjs-core").KernelFunc;
|
||||
export declare const acoshConfig: KernelConfig;
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { Acosh } from '@tensorflow/tfjs-core';
|
||||
import { unaryKernelFunc } from '../utils/unary_utils';
|
||||
export const acosh = unaryKernelFunc(Acosh, (xi) => Math.acosh(xi));
|
||||
export const acoshConfig = {
|
||||
kernelName: Acosh,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: acosh,
|
||||
};
|
||||
//# sourceMappingURL=Acosh.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Acosh.js","sourceRoot":"","sources":["../../src/kernels/Acosh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;CAClB,CAAC"}
|
||||
Generated
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { KernelConfig } from '@tensorflow/tfjs-core';
|
||||
export declare const addImpl: import("../shared").SimpleBinaryKernelImpl;
|
||||
export declare const addComplexImpl: import("../shared").ComplexBinaryKernelImpl;
|
||||
export declare const add: import("@tensorflow/tfjs-core").KernelFunc;
|
||||
export declare const addConfig: KernelConfig;
|
||||
Generated
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { Add } from '@tensorflow/tfjs-core';
|
||||
import { createSimpleBinaryKernelImpl } from '../utils/binary_impl';
|
||||
import { binaryKernelFunc, createComplexBinaryKernelImpl } from '../utils/binary_utils';
|
||||
export const addImpl = createSimpleBinaryKernelImpl(((a, b) => a + b));
|
||||
export const addComplexImpl = createComplexBinaryKernelImpl(((aReal, aImag, bReal, bImag) => {
|
||||
return { real: aReal + bReal, imag: aImag + bImag };
|
||||
}));
|
||||
export const add = binaryKernelFunc(Add, addImpl, addComplexImpl);
|
||||
export const addConfig = {
|
||||
kernelName: Add,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: add
|
||||
};
|
||||
//# sourceMappingURL=Add.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Add.js","sourceRoot":"","sources":["../../src/kernels/Add.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,GAAG,EAAe,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAC,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAE,6BAA6B,EAAC,MAAM,uBAAuB,CAAC;AAEtF,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,cAAc,GACvB,6BAA6B,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IAC5D,OAAO,EAAC,IAAI,EAAE,KAAK,GAAG,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,KAAK,EAAC,CAAC;AACpD,CAAC,CAAC,CAAC,CAAC;AAER,MAAM,CAAC,MAAM,GAAG,GAAG,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,GAAG;CAChB,CAAC"}
|
||||
Generated
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { AddNInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
|
||||
import { MathBackendCPU } from '../backend_cpu';
|
||||
export declare function addN(args: {
|
||||
inputs: AddNInputs;
|
||||
backend: MathBackendCPU;
|
||||
}): TensorInfo;
|
||||
export declare const addNConfig: KernelConfig;
|
||||
Generated
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { AddN, buffer } from '@tensorflow/tfjs-core';
|
||||
import { assertNotComplex } from '../cpu_util';
|
||||
export function addN(args) {
|
||||
const { inputs, backend } = args;
|
||||
const tensors = inputs;
|
||||
assertNotComplex(inputs, 'addN');
|
||||
const vals = tensors.map(t => backend.data.get(t.dataId).values);
|
||||
const outBuf = buffer(tensors[0].shape, tensors[0].dtype);
|
||||
const outVals = outBuf.values;
|
||||
for (let i = 0; i < tensors.length; i++) {
|
||||
const currVals = vals[i];
|
||||
for (let j = 0; j < outVals.length; j++) {
|
||||
outVals[j] += currVals[j];
|
||||
}
|
||||
}
|
||||
return backend.makeTensorInfo(outBuf.shape, outBuf.dtype, outBuf.values);
|
||||
}
|
||||
export const addNConfig = {
|
||||
kernelName: AddN,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: addN
|
||||
};
|
||||
//# sourceMappingURL=AddN.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AddN.js","sourceRoot":"","sources":["../../src/kernels/AddN.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAc,MAAM,EAA2D,MAAM,uBAAuB,CAAC;AAGzH,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAE7C,MAAM,UAAU,IAAI,CAAC,IAAmD;IAEtE,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC;IAC/B,MAAM,OAAO,GAAG,MAAkB,CAAC;IAEnC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC,MAAM,IAAI,GACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAoB,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAkB,CAAC,CAAC;IACvE,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;SAC3B;KACF;IAED,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,IAAwB;CACrC,CAAC"}
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { AllAttrs, AllInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
|
||||
import { MathBackendCPU } from '../backend_cpu';
|
||||
export declare function all(args: {
|
||||
inputs: AllInputs;
|
||||
backend: MathBackendCPU;
|
||||
attrs: AllAttrs;
|
||||
}): TensorInfo;
|
||||
export declare const allConfig: KernelConfig;
|
||||
Generated
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { All, backend_util, util } from '@tensorflow/tfjs-core';
|
||||
import { assertNotComplex } from '../cpu_util';
|
||||
import { reshape } from './Reshape';
|
||||
import { transpose } from './Transpose';
|
||||
export function all(args) {
|
||||
const { inputs, backend, attrs } = args;
|
||||
const { x } = inputs;
|
||||
const { axis, keepDims } = attrs;
|
||||
assertNotComplex(x, 'all');
|
||||
const origAxes = util.parseAxisParam(axis, x.shape);
|
||||
let axes = origAxes;
|
||||
const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);
|
||||
let $x = x;
|
||||
if (permutedAxes != null) {
|
||||
$x = transpose({ inputs: { x }, backend, attrs: { perm: permutedAxes } });
|
||||
axes = backend_util.getInnerMostAxes(axes.length, x.shape.length);
|
||||
}
|
||||
backend_util.assertAxesAreInnerMostDims('all', axes, $x.shape.length);
|
||||
const [outShape, reduceShape] = backend_util.computeOutAndReduceShapes($x.shape, axes);
|
||||
const reduceSize = util.sizeFromShape(reduceShape);
|
||||
const vals = util.makeZerosTypedArray(util.sizeFromShape(outShape), $x.dtype);
|
||||
const aVals = backend.data.get($x.dataId).values;
|
||||
for (let i = 0; i < vals.length; ++i) {
|
||||
const offset = i * reduceSize;
|
||||
let all = aVals[offset];
|
||||
for (let j = 0; j < reduceSize; ++j) {
|
||||
const value = aVals[offset + j];
|
||||
all = all && value;
|
||||
}
|
||||
vals[i] = all;
|
||||
}
|
||||
if (permutedAxes != null) {
|
||||
backend.disposeIntermediateTensorInfo($x);
|
||||
}
|
||||
const result = backend.makeTensorInfo(outShape, $x.dtype, vals);
|
||||
if (keepDims) {
|
||||
const expandedShape = backend_util.expandShapeToKeepDim(outShape, origAxes);
|
||||
const reshapedResult = reshape({ inputs: { x: result }, backend, attrs: { shape: expandedShape } });
|
||||
backend.disposeIntermediateTensorInfo(result);
|
||||
return reshapedResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export const allConfig = {
|
||||
kernelName: All,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: all
|
||||
};
|
||||
//# sourceMappingURL=All.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"All.js","sourceRoot":"","sources":["../../src/kernels/All.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,GAAG,EAAuB,YAAY,EAAoD,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAGrI,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,UAAU,GAAG,CACf,IAAmE;IAErE,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAC,CAAC,EAAC,GAAG,MAAM,CAAC;IACnB,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAC,GAAG,KAAK,CAAC;IAE/B,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAE3B,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,MAAM,YAAY,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3E,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,IAAI,YAAY,IAAI,IAAI,EAAE;QACxB,EAAE,GAAG,SAAS,CAAC,EAAC,MAAM,EAAE,EAAC,CAAC,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAC,I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AG,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEhE,IAAI,QAAQ,EAAE;QACZ,MAAM,aAAa,GAAG,YAAY,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC5E,MAAM,cAAc,GAChB,OAAO,CAAC,EAAC,MAAM,EAAE,EAAC,CAAC,EAAE,MAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAC,KAAK,EAAE,aAAa,EAAC,EAAC,CAAC,CAAC;QAE3E,OAAO,CAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC;QAE9C,OAAO,cAAc,CAAC;KACvB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,GAAuB;CACpC,CAAC"}
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { AnyAttrs, AnyInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
|
||||
import { MathBackendCPU } from '../backend_cpu';
|
||||
export declare function any(args: {
|
||||
inputs: AnyInputs;
|
||||
backend: MathBackendCPU;
|
||||
attrs: AnyAttrs;
|
||||
}): TensorInfo;
|
||||
export declare const anyConfig: KernelConfig;
|
||||
Generated
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { Any, backend_util, util } from '@tensorflow/tfjs-core';
|
||||
import { assertNotComplex } from '../cpu_util';
|
||||
import { reshape } from './Reshape';
|
||||
import { transpose } from './Transpose';
|
||||
export function any(args) {
|
||||
const { inputs, backend, attrs } = args;
|
||||
const { x } = inputs;
|
||||
const { axis, keepDims } = attrs;
|
||||
assertNotComplex(x, 'any');
|
||||
const origAxes = util.parseAxisParam(axis, x.shape);
|
||||
let axes = origAxes;
|
||||
const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);
|
||||
let $x = x;
|
||||
if (permutedAxes != null) {
|
||||
$x = transpose({ inputs: { x }, backend, attrs: { perm: permutedAxes } });
|
||||
axes = backend_util.getInnerMostAxes(axes.length, x.shape.length);
|
||||
}
|
||||
backend_util.assertAxesAreInnerMostDims('any', axes, $x.shape.length);
|
||||
const [outShape, reduceShape] = backend_util.computeOutAndReduceShapes($x.shape, axes);
|
||||
const reduceSize = util.sizeFromShape(reduceShape);
|
||||
const vals = util.makeZerosTypedArray(util.sizeFromShape(outShape), $x.dtype);
|
||||
const aVals = backend.data.get($x.dataId).values;
|
||||
for (let i = 0; i < vals.length; ++i) {
|
||||
const offset = i * reduceSize;
|
||||
let anyVal = aVals[offset];
|
||||
for (let j = 0; j < reduceSize; ++j) {
|
||||
const value = aVals[offset + j];
|
||||
anyVal = anyVal || value;
|
||||
}
|
||||
vals[i] = anyVal;
|
||||
}
|
||||
if (permutedAxes != null) {
|
||||
backend.disposeIntermediateTensorInfo($x);
|
||||
}
|
||||
const result = backend.makeTensorInfo(outShape, $x.dtype, vals);
|
||||
if (keepDims) {
|
||||
const expandedShape = backend_util.expandShapeToKeepDim(outShape, origAxes);
|
||||
const reshapedResult = reshape({ inputs: { x: result }, backend, attrs: { shape: expandedShape } });
|
||||
backend.disposeIntermediateTensorInfo(result);
|
||||
return reshapedResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export const anyConfig = {
|
||||
kernelName: Any,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: any
|
||||
};
|
||||
//# sourceMappingURL=Any.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Any.js","sourceRoot":"","sources":["../../src/kernels/Any.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,GAAG,EAAuB,YAAY,EAAoD,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAGrI,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,UAAU,GAAG,CACf,IAAmE;IAErE,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAC,CAAC,EAAC,GAAG,MAAM,CAAC;IACnB,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAC,GAAG,KAAK,CAAC;IAE/B,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAE3B,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,IAAI,GAAG,QAA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,CAAC,EAAE;YACnC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAChC,MAAM,GAAG,MAAM,IAAI,KAAK,CAAC;SAC1B;QACD,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;KAClB;IAED,IAAI,YAAY,IAAI,IAAI,EAAE;QACxB,OAAO,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;KAC3C;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEhE,IAAI,QAAQ,EAAE;QACZ,MAAM,aAAa,GAAG,YAAY,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC5E,MAAM,cAAc,GAChB,OAAO,CAAC,EAAC,MAAM,EAAE,EAAC,CAAC,EAAE,MAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAC,KAAK,EAAE,aAAa,EAAC,EAAC,CAAC,CAAC;QAE3E,OAAO,CAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC;QAE9C,OAAO,cAAc,CAAC;KACvB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,GAAuB;CACpC,CAAC"}
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { ArgMaxAttrs, ArgMaxInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
|
||||
import { MathBackendCPU } from '../backend_cpu';
|
||||
export declare function argMax(args: {
|
||||
inputs: ArgMaxInputs;
|
||||
backend: MathBackendCPU;
|
||||
attrs: ArgMaxAttrs;
|
||||
}): TensorInfo;
|
||||
export declare const argMaxConfig: KernelConfig;
|
||||
Generated
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { ArgMax, backend_util, util } from '@tensorflow/tfjs-core';
|
||||
import { assertNotComplex } from '../cpu_util';
|
||||
import { transpose } from './Transpose';
|
||||
export function argMax(args) {
|
||||
const { inputs, backend, attrs } = args;
|
||||
const { x } = inputs;
|
||||
const { axis } = attrs;
|
||||
assertNotComplex(x, 'argMax');
|
||||
let axes = util.parseAxisParam(axis, x.shape);
|
||||
const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);
|
||||
let $x = x;
|
||||
const intermediateTensorInfos = [];
|
||||
if (permutedAxes != null) {
|
||||
$x = transpose({ inputs: { x }, backend, attrs: { perm: permutedAxes } });
|
||||
intermediateTensorInfos.push($x);
|
||||
axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);
|
||||
}
|
||||
axes = [axes[0]];
|
||||
backend_util.assertAxesAreInnerMostDims('argMax', axes, $x.shape.length);
|
||||
const [outShape, reduceShape] = backend_util.computeOutAndReduceShapes($x.shape, axes);
|
||||
const outSize = util.sizeFromShape(outShape);
|
||||
const vals = util.makeZerosTypedArray(outSize, 'int32');
|
||||
const reduceSize = util.sizeFromShape(reduceShape);
|
||||
const aVals = backend.data.get($x.dataId).values;
|
||||
for (let i = 0; i < vals.length; ++i) {
|
||||
const offset = i * reduceSize;
|
||||
let max = aVals[offset];
|
||||
let maxIndex = 0;
|
||||
for (let j = 0; j < reduceSize; ++j) {
|
||||
const value = aVals[offset + j];
|
||||
if (value > max) {
|
||||
max = value;
|
||||
maxIndex = j;
|
||||
}
|
||||
}
|
||||
vals[i] = maxIndex;
|
||||
}
|
||||
intermediateTensorInfos.forEach(t => backend.disposeIntermediateTensorInfo(t));
|
||||
return backend.makeTensorInfo(outShape, 'int32', vals);
|
||||
}
|
||||
export const argMaxConfig = {
|
||||
kernelName: ArgMax,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: argMax
|
||||
};
|
||||
//# sourceMappingURL=ArgMax.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ArgMax.js","sourceRoot":"","sources":["../../src/kernels/ArgMax.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,MAAM,EAA6B,YAAY,EAAoD,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAG9I,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,UAAU,MAAM,CAClB,IAAyE;IAE3E,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAC,CAAC,EAAC,GAAG,MAAM,CAAC;IACnB,MAAM,EAAC,IAAI,EAAC,GAAG,KAAK,CAAC;IAErB,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MAAM,CAAC,CAAC,MAAoB,CAAC;IAC/D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACpC,MAAM,MAAM,GAAG,CAAC,GAAG,UAAU,CAAC;QAC9B,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QACxB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,EAAE,CAAC,EAAE;YACnC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAChC,IAAI,KAAK,GAAG,GAAG,EAAE;gBACf,GAAG,GAAG,KAAK,CAAC;gBACZ,QAAQ,GAAG,CAAC,CAAC;aACd;SACF;QACD,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;KACpB;IAED,uBAAuB,CAAC,OAAO,CAC3B,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnD,OAAO,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,MAA0B;CACvC,CAAC"}
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { ArgMinAttrs, ArgMinInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
|
||||
import { MathBackendCPU } from '../backend_cpu';
|
||||
export declare function argMin(args: {
|
||||
inputs: ArgMinInputs;
|
||||
backend: MathBackendCPU;
|
||||
attrs: ArgMinAttrs;
|
||||
}): TensorInfo;
|
||||
export declare const argMinConfig: KernelConfig;
|
||||
Generated
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { ArgMin, backend_util, util } from '@tensorflow/tfjs-core';
|
||||
import { assertNotComplex } from '../cpu_util';
|
||||
import { transpose } from './Transpose';
|
||||
export function argMin(args) {
|
||||
const { inputs, backend, attrs } = args;
|
||||
const { x } = inputs;
|
||||
const { axis } = attrs;
|
||||
assertNotComplex(x, 'argMin');
|
||||
let axes = util.parseAxisParam(axis, x.shape);
|
||||
const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);
|
||||
let $x = x;
|
||||
const intermediateTensorInfos = [];
|
||||
if (permutedAxes != null) {
|
||||
$x = transpose({ inputs: { x }, backend, attrs: { perm: permutedAxes } });
|
||||
intermediateTensorInfos.push($x);
|
||||
axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);
|
||||
}
|
||||
axes = [axes[0]];
|
||||
backend_util.assertAxesAreInnerMostDims('argMin', axes, $x.shape.length);
|
||||
const [outShape, reduceShape] = backend_util.computeOutAndReduceShapes($x.shape, axes);
|
||||
const outSize = util.sizeFromShape(outShape);
|
||||
const vals = util.makeZerosTypedArray(outSize, 'int32');
|
||||
const reduceSize = util.sizeFromShape(reduceShape);
|
||||
const aVals = backend.data.get($x.dataId).values;
|
||||
for (let i = 0; i < vals.length; ++i) {
|
||||
const offset = i * reduceSize;
|
||||
let min = aVals[offset];
|
||||
let minIndex = 0;
|
||||
for (let j = 0; j < reduceSize; ++j) {
|
||||
const value = aVals[offset + j];
|
||||
if (value < min) {
|
||||
min = value;
|
||||
minIndex = j;
|
||||
}
|
||||
}
|
||||
vals[i] = minIndex;
|
||||
}
|
||||
intermediateTensorInfos.forEach(t => backend.disposeIntermediateTensorInfo(t));
|
||||
return backend.makeTensorInfo(outShape, 'int32', vals);
|
||||
}
|
||||
export const argMinConfig = {
|
||||
kernelName: ArgMin,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: argMin
|
||||
};
|
||||
//# sourceMappingURL=ArgMin.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ArgMin.js","sourceRoot":"","sources":["../../src/kernels/ArgMin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,MAAM,EAA6B,YAAY,EAAoD,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAG9I,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,UAAU,MAAM,CAClB,IAAyE;IAE3E,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAC,CAAC,EAAC,GAAG,MAAM,CAAC;IACnB,MAAM,EAAC,IAAI,EAAC,GAAG,KAAK,CAAC;I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AAC,MAAM,CAAC,CAAC,MAAoB,CAAC;IAC/D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACpC,MAAM,MAAM,GAAG,CAAC,GAAG,UAAU,CAAC;QAC9B,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QACxB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,EAAE,CAAC,EAAE;YACnC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAChC,IAAI,KAAK,GAAG,GAAG,EAAE;gBACf,GAAG,GAAG,KAAK,CAAC;gBACZ,QAAQ,GAAG,CAAC,CAAC;aACd;SACF;QACD,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;KACpB;IAED,uBAAuB,CAAC,OAAO,CAC3B,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnD,OAAO,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,MAA0B;CACvC,CAAC"}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { KernelConfig } from '@tensorflow/tfjs-core';
|
||||
export declare const asin: import("@tensorflow/tfjs-core").KernelFunc;
|
||||
export declare const asinConfig: KernelConfig;
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { Asin } from '@tensorflow/tfjs-core';
|
||||
import { unaryKernelFunc } from '../utils/unary_utils';
|
||||
export const asin = unaryKernelFunc(Asin, (xi) => Math.asin(xi));
|
||||
export const asinConfig = {
|
||||
kernelName: Asin,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: asin,
|
||||
};
|
||||
//# sourceMappingURL=Asin.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Asin.js","sourceRoot":"","sources":["../../src/kernels/Asin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAe,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,IAAI;CACjB,CAAC"}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { KernelConfig } from '@tensorflow/tfjs-core';
|
||||
export declare const asinh: import("@tensorflow/tfjs-core").KernelFunc;
|
||||
export declare const asinhConfig: KernelConfig;
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { Asinh } from '@tensorflow/tfjs-core';
|
||||
import { unaryKernelFunc } from '../utils/unary_utils';
|
||||
export const asinh = unaryKernelFunc(Asinh, (xi) => Math.asinh(xi));
|
||||
export const asinhConfig = {
|
||||
kernelName: Asinh,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: asinh,
|
||||
};
|
||||
//# sourceMappingURL=Asinh.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Asinh.js","sourceRoot":"","sources":["../../src/kernels/Asinh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;CAClB,CAAC"}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { KernelConfig } from '@tensorflow/tfjs-core';
|
||||
export declare const atan: import("@tensorflow/tfjs-core").KernelFunc;
|
||||
export declare const atanConfig: KernelConfig;
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { Atan } from '@tensorflow/tfjs-core';
|
||||
import { unaryKernelFunc } from '../utils/unary_utils';
|
||||
export const atan = unaryKernelFunc(Atan, (xi) => Math.atan(xi));
|
||||
export const atanConfig = {
|
||||
kernelName: Atan,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: atan,
|
||||
};
|
||||
//# sourceMappingURL=Atan.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Atan.js","sourceRoot":"","sources":["../../src/kernels/Atan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAe,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,IAAI;CACjB,CAAC"}
|
||||
Generated
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { KernelConfig } from '@tensorflow/tfjs-core';
|
||||
export declare const atan2Impl: import("../shared").SimpleBinaryKernelImpl;
|
||||
export declare const atan2: import("@tensorflow/tfjs-core").KernelFunc;
|
||||
export declare const atan2Config: KernelConfig;
|
||||
Generated
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { Atan2 } from '@tensorflow/tfjs-core';
|
||||
import { createSimpleBinaryKernelImpl } from '../utils/binary_impl';
|
||||
import { binaryKernelFunc } from '../utils/binary_utils';
|
||||
export const atan2Impl = createSimpleBinaryKernelImpl((aValue, bValue) => Math.atan2(aValue, bValue));
|
||||
export const atan2 = binaryKernelFunc(Atan2, atan2Impl);
|
||||
export const atan2Config = {
|
||||
kernelName: Atan2,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: atan2,
|
||||
};
|
||||
//# sourceMappingURL=Atan2.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Atan2.js","sourceRoot":"","sources":["../../src/kernels/Atan2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAC,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG,4BAA4B,CACjD,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;CAClB,CAAC"}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { KernelConfig } from '@tensorflow/tfjs-core';
|
||||
export declare const atanh: import("@tensorflow/tfjs-core").KernelFunc;
|
||||
export declare const atanhConfig: KernelConfig;
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { Atanh } from '@tensorflow/tfjs-core';
|
||||
import { unaryKernelFunc } from '../utils/unary_utils';
|
||||
export const atanh = unaryKernelFunc(Atanh, (xi) => Math.atanh(xi));
|
||||
export const atanhConfig = {
|
||||
kernelName: Atanh,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: atanh,
|
||||
};
|
||||
//# sourceMappingURL=Atanh.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Atanh.js","sourceRoot":"","sources":["../../src/kernels/Atanh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;CAClB,CAAC"}
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { AvgPoolAttrs, AvgPoolInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
|
||||
import { MathBackendCPU } from '../backend_cpu';
|
||||
export declare function avgPool(args: {
|
||||
inputs: AvgPoolInputs;
|
||||
backend: MathBackendCPU;
|
||||
attrs: AvgPoolAttrs;
|
||||
}): TensorInfo;
|
||||
export declare const avgPoolConfig: KernelConfig;
|
||||
Generated
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { AvgPool, backend_util, util } from '@tensorflow/tfjs-core';
|
||||
import { assertNotComplex } from '../cpu_util';
|
||||
import { pool } from '../utils/pool_utils';
|
||||
import { identity } from './Identity';
|
||||
export function avgPool(args) {
|
||||
const { inputs, backend, attrs } = args;
|
||||
const { x } = inputs;
|
||||
assertNotComplex(x, 'avgPool');
|
||||
const { filterSize, strides, pad, dimRoundingMode } = attrs;
|
||||
const dilations = 1;
|
||||
util.assert(backend_util.eitherStridesOrDilationsAreOne(strides, dilations), () => 'Error in avgPool: Either strides or dilations must be 1. ' +
|
||||
`Got strides ${strides} and dilations '${dilations}'`);
|
||||
const convInfo = backend_util.computePool2DInfo(x.shape, filterSize, strides, dilations, pad, dimRoundingMode);
|
||||
let res;
|
||||
if (convInfo.filterWidth === 1 && convInfo.filterHeight === 1 &&
|
||||
util.arraysEqual(convInfo.inShape, convInfo.outShape)) {
|
||||
res = identity({ inputs: { x }, backend });
|
||||
}
|
||||
else {
|
||||
const xValues = backend.data.get(x.dataId).values;
|
||||
const strides = util.computeStrides(x.shape);
|
||||
const buffer = pool(xValues, x.shape, x.dtype, strides, convInfo, 'avg');
|
||||
res = backend.makeTensorInfo(convInfo.outShape, x.dtype, buffer.values);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
export const avgPoolConfig = {
|
||||
kernelName: AvgPool,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: avgPool
|
||||
};
|
||||
//# sourceMappingURL=AvgPool.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AvgPool.js","sourceRoot":"","sources":["../../src/kernels/AvgPool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAC,OAAO,EAA+B,YAAY,EAAoD,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAGjJ,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,UAAU,OAAO,CACnB,IACyE;IAE3E,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAC,CAAC,EAAC,GAAG,MAAM,CAAC;IACnB,gBAAgB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC/B,MAAM,EAAC,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAC,GAAG,KAAK,CAAC;IAC1D,MAAM,SAAS,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C,CAAC"}
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { AvgPool3DAttrs, AvgPool3DInputs, KernelConfig, TensorInfo } from '@tensorflow/tfjs-core';
|
||||
import { MathBackendCPU } from '../backend_cpu';
|
||||
export declare function avgPool3D(args: {
|
||||
inputs: AvgPool3DInputs;
|
||||
backend: MathBackendCPU;
|
||||
attrs: AvgPool3DAttrs;
|
||||
}): TensorInfo;
|
||||
export declare const avgPool3DConfig: KernelConfig;
|
||||
Generated
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { AvgPool3D, backend_util, util } from '@tensorflow/tfjs-core';
|
||||
import { assertNotComplex } from '../cpu_util';
|
||||
import { pool3d } from '../utils/pool_utils';
|
||||
export function avgPool3D(args) {
|
||||
const { inputs, backend, attrs } = args;
|
||||
const { x } = inputs;
|
||||
const { filterSize, strides, pad, dimRoundingMode, dataFormat } = attrs;
|
||||
assertNotComplex(x, 'avgPool3d');
|
||||
const convInfo = backend_util.computePool3DInfo(x.shape, filterSize, strides, 1 /* dilations */, pad, dimRoundingMode, dataFormat);
|
||||
const xValues = backend.data.get(x.dataId).values;
|
||||
const outBuf = pool3d(xValues, x.shape, x.dtype, util.computeStrides(x.shape), convInfo, 'avg');
|
||||
return backend.makeTensorInfo(outBuf.shape, 'float32', outBuf.values);
|
||||
}
|
||||
export const avgPool3DConfig = {
|
||||
kernelName: AvgPool3D,
|
||||
backendName: 'cpu',
|
||||
kernelFunc: avgPool3D
|
||||
};
|
||||
//# sourceMappingURL=AvgPool3D.js.map
|
||||
Loaded 100 of 9159 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user