@hoff97/tensor-js
Version:
PyTorch like deep learning inferrence library
31 lines • 1.46 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { OnnxNode } from '../../node';
export class BinaryNode extends OnnxNode {
constructor(attributes, inputs, outputs, constants, onnxVersion, name, mode) {
super(attributes, inputs, outputs, constants, onnxVersion, mode);
this.name = name;
}
forward(inputs) {
return __awaiter(this, void 0, void 0, function* () {
if (this.onnxVersion < 13 && this.onnxVersion >= 7) {
const a = inputs[0];
const b = inputs[1];
return [this.compute(a, b)];
}
throw new Error(`${this.name} not implemented for onnx version ${this.onnxVersion}`);
});
}
getType() {
return this.name;
}
delete() { }
}
//# sourceMappingURL=binaryNode.js.map