467 lines
12 KiB
JavaScript
467 lines
12 KiB
JavaScript
/*
|
|
* ******************************************************************************
|
|
* *
|
|
* *
|
|
* * 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
|
|
* *****************************************************************************
|
|
*/
|
|
|
|
/**
|
|
* @const
|
|
* @namespace
|
|
*/
|
|
var nd4j = nd4j || {};
|
|
|
|
/**
|
|
* @const
|
|
* @namespace
|
|
*/
|
|
nd4j.graph = nd4j.graph || {};
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
nd4j.graph.FlatProperties = function() {
|
|
/**
|
|
* @type {flatbuffers.ByteBuffer}
|
|
*/
|
|
this.bb = null;
|
|
|
|
/**
|
|
* @type {number}
|
|
*/
|
|
this.bb_pos = 0;
|
|
};
|
|
|
|
/**
|
|
* @param {number} i
|
|
* @param {flatbuffers.ByteBuffer} bb
|
|
* @returns {nd4j.graph.FlatProperties}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.__init = function(i, bb) {
|
|
this.bb_pos = i;
|
|
this.bb = bb;
|
|
return this;
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.ByteBuffer} bb
|
|
* @param {nd4j.graph.FlatProperties=} obj
|
|
* @returns {nd4j.graph.FlatProperties}
|
|
*/
|
|
nd4j.graph.FlatProperties.getRootAsFlatProperties = function(bb, obj) {
|
|
return (obj || new nd4j.graph.FlatProperties).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Encoding=} optionalEncoding
|
|
* @returns {string|Uint8Array|null}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.name = function(optionalEncoding) {
|
|
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
};
|
|
|
|
/**
|
|
* @param {number} index
|
|
* @returns {number}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.i = function(index) {
|
|
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
return offset ? this.bb.readInt32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
|
|
};
|
|
|
|
/**
|
|
* @returns {number}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.iLength = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
};
|
|
|
|
/**
|
|
* @returns {Int32Array}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.iArray = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
return offset ? new Int32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
|
};
|
|
|
|
/**
|
|
* @param {number} index
|
|
* @returns {flatbuffers.Long}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.l = function(index) {
|
|
var offset = this.bb.__offset(this.bb_pos, 8);
|
|
return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : this.bb.createLong(0, 0);
|
|
};
|
|
|
|
/**
|
|
* @returns {number}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.lLength = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 8);
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
};
|
|
|
|
/**
|
|
* @param {number} index
|
|
* @returns {number}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.d = function(index) {
|
|
var offset = this.bb.__offset(this.bb_pos, 10);
|
|
return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
|
|
};
|
|
|
|
/**
|
|
* @returns {number}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.dLength = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 10);
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
};
|
|
|
|
/**
|
|
* @returns {Float64Array}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.dArray = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 10);
|
|
return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
|
};
|
|
|
|
/**
|
|
* @param {number} index
|
|
* @param {nd4j.graph.FlatArray=} obj
|
|
* @returns {nd4j.graph.FlatArray}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.a = function(index, obj) {
|
|
var offset = this.bb.__offset(this.bb_pos, 12);
|
|
return offset ? (obj || new nd4j.graph.FlatArray).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
|
|
};
|
|
|
|
/**
|
|
* @returns {number}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.aLength = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 12);
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
};
|
|
|
|
/**
|
|
* @param {number} index
|
|
* @returns {boolean}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.b = function(index) {
|
|
var offset = this.bb.__offset(this.bb_pos, 14);
|
|
return offset ? !!this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : false;
|
|
};
|
|
|
|
/**
|
|
* @returns {number}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.bLength = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 14);
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
};
|
|
|
|
/**
|
|
* @returns {Int8Array}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.bArray = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 14);
|
|
return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
|
};
|
|
|
|
/**
|
|
* @param {number} index
|
|
* @param {flatbuffers.Encoding=} optionalEncoding
|
|
* @returns {string|Uint8Array}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.s = function(index, optionalEncoding) {
|
|
var offset = this.bb.__offset(this.bb_pos, 16);
|
|
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
|
|
};
|
|
|
|
/**
|
|
* @returns {number}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.sLength = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 16);
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
};
|
|
|
|
/**
|
|
* @param {number} index
|
|
* @returns {number}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.shape = function(index) {
|
|
var offset = this.bb.__offset(this.bb_pos, 18);
|
|
return offset ? this.bb.readInt32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
|
|
};
|
|
|
|
/**
|
|
* @returns {number}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.shapeLength = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 18);
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
};
|
|
|
|
/**
|
|
* @returns {Int32Array}
|
|
*/
|
|
nd4j.graph.FlatProperties.prototype.shapeArray = function() {
|
|
var offset = this.bb.__offset(this.bb_pos, 18);
|
|
return offset ? new Int32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
*/
|
|
nd4j.graph.FlatProperties.startFlatProperties = function(builder) {
|
|
builder.startObject(8);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {flatbuffers.Offset} nameOffset
|
|
*/
|
|
nd4j.graph.FlatProperties.addName = function(builder, nameOffset) {
|
|
builder.addFieldOffset(0, nameOffset, 0);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {flatbuffers.Offset} iOffset
|
|
*/
|
|
nd4j.graph.FlatProperties.addI = function(builder, iOffset) {
|
|
builder.addFieldOffset(1, iOffset, 0);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {Array.<number>} data
|
|
* @returns {flatbuffers.Offset}
|
|
*/
|
|
nd4j.graph.FlatProperties.createIVector = function(builder, data) {
|
|
builder.startVector(4, data.length, 4);
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
builder.addInt32(data[i]);
|
|
}
|
|
return builder.endVector();
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {number} numElems
|
|
*/
|
|
nd4j.graph.FlatProperties.startIVector = function(builder, numElems) {
|
|
builder.startVector(4, numElems, 4);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {flatbuffers.Offset} lOffset
|
|
*/
|
|
nd4j.graph.FlatProperties.addL = function(builder, lOffset) {
|
|
builder.addFieldOffset(2, lOffset, 0);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {Array.<flatbuffers.Long>} data
|
|
* @returns {flatbuffers.Offset}
|
|
*/
|
|
nd4j.graph.FlatProperties.createLVector = function(builder, data) {
|
|
builder.startVector(8, data.length, 8);
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
builder.addInt64(data[i]);
|
|
}
|
|
return builder.endVector();
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {number} numElems
|
|
*/
|
|
nd4j.graph.FlatProperties.startLVector = function(builder, numElems) {
|
|
builder.startVector(8, numElems, 8);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {flatbuffers.Offset} dOffset
|
|
*/
|
|
nd4j.graph.FlatProperties.addD = function(builder, dOffset) {
|
|
builder.addFieldOffset(3, dOffset, 0);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {Array.<number>} data
|
|
* @returns {flatbuffers.Offset}
|
|
*/
|
|
nd4j.graph.FlatProperties.createDVector = function(builder, data) {
|
|
builder.startVector(8, data.length, 8);
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
builder.addFloat64(data[i]);
|
|
}
|
|
return builder.endVector();
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {number} numElems
|
|
*/
|
|
nd4j.graph.FlatProperties.startDVector = function(builder, numElems) {
|
|
builder.startVector(8, numElems, 8);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {flatbuffers.Offset} aOffset
|
|
*/
|
|
nd4j.graph.FlatProperties.addA = function(builder, aOffset) {
|
|
builder.addFieldOffset(4, aOffset, 0);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {Array.<flatbuffers.Offset>} data
|
|
* @returns {flatbuffers.Offset}
|
|
*/
|
|
nd4j.graph.FlatProperties.createAVector = function(builder, data) {
|
|
builder.startVector(4, data.length, 4);
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
builder.addOffset(data[i]);
|
|
}
|
|
return builder.endVector();
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {number} numElems
|
|
*/
|
|
nd4j.graph.FlatProperties.startAVector = function(builder, numElems) {
|
|
builder.startVector(4, numElems, 4);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {flatbuffers.Offset} bOffset
|
|
*/
|
|
nd4j.graph.FlatProperties.addB = function(builder, bOffset) {
|
|
builder.addFieldOffset(5, bOffset, 0);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {Array.<boolean>} data
|
|
* @returns {flatbuffers.Offset}
|
|
*/
|
|
nd4j.graph.FlatProperties.createBVector = function(builder, data) {
|
|
builder.startVector(1, data.length, 1);
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
builder.addInt8(+data[i]);
|
|
}
|
|
return builder.endVector();
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {number} numElems
|
|
*/
|
|
nd4j.graph.FlatProperties.startBVector = function(builder, numElems) {
|
|
builder.startVector(1, numElems, 1);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {flatbuffers.Offset} sOffset
|
|
*/
|
|
nd4j.graph.FlatProperties.addS = function(builder, sOffset) {
|
|
builder.addFieldOffset(6, sOffset, 0);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {Array.<flatbuffers.Offset>} data
|
|
* @returns {flatbuffers.Offset}
|
|
*/
|
|
nd4j.graph.FlatProperties.createSVector = function(builder, data) {
|
|
builder.startVector(4, data.length, 4);
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
builder.addOffset(data[i]);
|
|
}
|
|
return builder.endVector();
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {number} numElems
|
|
*/
|
|
nd4j.graph.FlatProperties.startSVector = function(builder, numElems) {
|
|
builder.startVector(4, numElems, 4);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {flatbuffers.Offset} shapeOffset
|
|
*/
|
|
nd4j.graph.FlatProperties.addShape = function(builder, shapeOffset) {
|
|
builder.addFieldOffset(7, shapeOffset, 0);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {Array.<number>} data
|
|
* @returns {flatbuffers.Offset}
|
|
*/
|
|
nd4j.graph.FlatProperties.createShapeVector = function(builder, data) {
|
|
builder.startVector(4, data.length, 4);
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
builder.addInt32(data[i]);
|
|
}
|
|
return builder.endVector();
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {number} numElems
|
|
*/
|
|
nd4j.graph.FlatProperties.startShapeVector = function(builder, numElems) {
|
|
builder.startVector(4, numElems, 4);
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @returns {flatbuffers.Offset}
|
|
*/
|
|
nd4j.graph.FlatProperties.endFlatProperties = function(builder) {
|
|
var offset = builder.endObject();
|
|
return offset;
|
|
};
|
|
|
|
/**
|
|
* @param {flatbuffers.Builder} builder
|
|
* @param {flatbuffers.Offset} offset
|
|
*/
|
|
nd4j.graph.FlatProperties.finishFlatPropertiesBuffer = function(builder, offset) {
|
|
builder.finish(offset);
|
|
};
|
|
|
|
// Exports for Node.js and RequireJS
|
|
this.nd4j = nd4j;
|