Files
wehub-resource-sync 7254f7b4d1
Build / Build (macos-latest) (push) Has been cancelled
Build / Build (ubuntu-latest) (push) Has been cancelled
Build / Build (windows-latest) (push) Has been cancelled
Build / Analyze (javascript) (push) Has been cancelled
Build / Analyze (python) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:37:45 +08:00

47 lines
1.0 KiB
JavaScript

const imgdnn = {};
imgdnn.ModelFactory = class {
async match(context) {
const stream = context.stream;
const signature = [0x49, 0x4d, 0x47, 0x44, 0x4e, 0x4e]; // IMGDNN
if (stream && stream.length >= signature.length && stream.peek(6).every((value, index) => value === signature[index])) {
return 'imgdnn';
}
return null;
}
open(/* context */) {
throw new imgdnn.Error('Invalid file content. File contains undocumented IMGDNN data.');
}
};
imgdnn.Model = class {
constructor(metadata, model) {
this.format = 'IMGDNN';
this.modules = [new imgdnn.Graph(metadata, model)];
}
};
imgdnn.Graph = class {
constructor(/* metadata, model */) {
this.inputs = [];
this.outputs = [];
this.nodes = [];
}
};
imgdnn.Error = class extends Error {
constructor(message) {
super(message);
this.name = 'Error loading IMGDNN model.';
}
};
export const ModelFactory = imgdnn.ModelFactory;