deeplearning4jUiAssets.js.samediff.flatbuffers-utils.js Maven / Gradle / Ivy
The newest version!
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * See the NOTICE file distributed with this work for additional
* * information regarding copyright ownership.
* * 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.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
function extractHeaders(/*Uint8Array*/ bytes, offset){
var header1a = bytes.slice(offset+0,offset+4);
var header1b = bytes.slice(offset+4,offset+8);
var headerLength = byteArrayToInt(header1a);
var contentLength = byteArrayToInt(header1b);
return [headerLength, contentLength];
}
function byteArrayToInt(byteArray) {
var value = 0;
for ( var i = 0; i < byteArray.length; i++) {
value = (value * 256) + byteArray[i];
}
return value;
}
function decodeStaticInfo(headerContentBytes, bufferContentBytes){
var headerBuffer = new flatbuffers.ByteBuffer(headerContentBytes);
var contentBuffer = new flatbuffers.ByteBuffer(bufferContentBytes);
var header = nd4j.graph.UIStaticInfoRecord.getRootAsUIStaticInfoRecord(headerBuffer);
var infoType = header.infoType();
switch(infoType){
case nd4j.graph.UIInfoType.GRAPH_STRUCTURE:
var graphStructure = nd4j.graph.UIGraphStructure.getRootAsUIGraphStructure(contentBuffer);
return ["graph", graphStructure];
case nd4j.graph.UIInfoType.SYTEM_INFO:
var info = nd4j.graph.UISystemInfo.getRootAsUISystemInfo(contentBuffer);
return ["systeminfo", info];
case nd4j.graph.UIInfoType.START_EVENTS:
return ["startevents", null];
default:
console.log("Unknown static information type: " + infoType);
return null;
}
}
//Return graph inputs as a String[]
function uiGraphGetInputs(/*UIGraphStructure*/ graph){
var inLength = graph.inputsLength();
var inputs = [];
for( var i=0; i
© 2015 - 2024 Weber Informatics LLC | Privacy Policy