From eeae4d402df0052ea895e21c4ccf7f273f8efbf4 Mon Sep 17 00:00:00 2001 From: Lutz Roeder Date: Mon, 1 Jul 2024 06:58:09 -0700 Subject: [PATCH] Add XGBoost test file (#1309) --- source/python.js | 14 +++++++------- test/models.json | 7 +++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/source/python.js b/source/python.js index 5036491df4..268ecdd529 100644 --- a/source/python.js +++ b/source/python.js @@ -2096,17 +2096,17 @@ python.Execution = class { }); this.registerType('joblib.numpy_pickle.NumpyArrayWrapper', class { - __setstate__(state) { - this.subclass = state.subclass; - this.dtype = state.dtype; - this.shape = state.shape; - this.order = state.order; - this.allow_mmap = state.allow_mmap; - } __read__(unpickler) { if (this.dtype.__name__ === 'object') { return unpickler.load(); } + if (this.numpy_array_alignment_bytes) { + const [size] = unpickler.read(1); + unpickler.read(size); + } + if (this.order === 'F') { + throw new python.Error('Fortran order not implemented.'); + } const size = this.dtype.itemsize * this.shape.reduce((a, b) => a * b, 1); this.data = unpickler.read(size); return execution.invoke(this.subclass, [this.shape, this.dtype, this.data]); diff --git a/test/models.json b/test/models.json index 77e173e3ea..28eef7fbe1 100644 --- a/test/models.json +++ b/test/models.json @@ -6409,6 +6409,13 @@ "format": "scikit-learn v0.24.0rc1", "link": "https://github.com/lutzroeder/netron/issues/182" }, + { + "type": "sklearn", + "target": "numpy_array_alignment_bytes.pkl", + "source": "https://github.com/user-attachments/files/16054844/numpy_array_alignment_bytes.pkl.zip[numpy_array_alignment_bytes.pkl]", + "format": "scikit-learn", + "link": "https://github.com/lutzroeder/netron/issues/182" + }, { "type": "sklearn", "target": "phoenix_ml_classifier.pkl",