diff --git a/source/python.js b/source/python.js index 328d67862a..5beb00587b 100644 --- a/source/python.js +++ b/source/python.js @@ -1651,7 +1651,7 @@ python.Execution = class { const datetime = this.register('datetime'); this.register('gensim'); this.register('io'); - this.register('joblib'); + const joblib = this.register('joblib'); const functools = this.register('functools'); this.registerType('functools.partial', class {}); const keras = this.register('keras'); @@ -1667,6 +1667,7 @@ python.Execution = class { this.register('pandas._libs.internals'); const pickle = this.register('pickle'); const sklearn = this.register('sklearn'); + this.register('sklearn.externals.joblib.numpy_pickle'); const torch = this.register('torch'); const torchvision = this.register('torchvision'); this.register('torch.storage'); @@ -2074,6 +2075,20 @@ python.Execution = class { return execution.invoke(this.subclass, [this.shape, this.dtype, this.data]); } }); + this.registerType('joblib.numpy_pickle.NDArrayWrapper', class { + constructor(/* subtype, shape, dtype */) { + } + __setstate__(state) { + this.subclass = state.subclass; + this.filename = state.state; + this.allow_mmap = state.allow_mmap; + } + __read__(/* unpickler */) { + return this; // return execution.invoke(this.subclass, [ this.shape, this.dtype, this.data ]); + } + }); + sklearn.externals.joblib.numpy_pickle.NDArrayWrapper = joblib.numpy_pickle.NDArrayWrapper; + sklearn.externals.joblib.numpy_pickle.NumpyArrayWrapper = joblib.numpy_pickle.NumpyArrayWrapper; this.registerType('keras.engine.sequential.Sequential', class {}); this.registerType('lasagne.layers.conv.Conv2DLayer', class {}); this.registerType('lasagne.layers.dense.DenseLayer', class {}); @@ -2580,37 +2595,6 @@ python.Execution = class { this.registerType('sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis', class {}); this.registerType('sklearn.dummy.DummyClassifier', class {}); this.registerType('sklearn.dummy.DummyRegressor', class {}); - this.registerType('sklearn.externals.joblib.numpy_pickle.NumpyArrayWrapper', class { - constructor(/* subtype, shape, dtype */) { - } - __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(); - } - 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]); - } - }); - this.registerType('sklearn.externals.joblib.numpy_pickle.NDArrayWrapper', class { - constructor(/* subtype, shape, dtype */) { - } - __setstate__(state) { - this.subclass = state.subclass; - this.filename = state.state; - this.allow_mmap = state.allow_mmap; - } - __read__(/* unpickler */) { - return this; // return execution.invoke(this.subclass, [ this.shape, this.dtype, this.data ]); - } - }); this.registerType('sklearn.ensemble._bagging.BaggingClassifier', class {}); this.registerType('sklearn.ensemble._bagging.BaggingRegressor', class {}); this.registerType('sklearn.ensemble._forest.RandomForestClassifier', class {}); @@ -4550,7 +4534,9 @@ python.Execution = class { this.registerType('torchvision.models.detection.rpn.RPNHead', class {}); this.registerType('torchvision.models.detection.ssd.SSD', class {}); this.registerType('torchvision.models.detection.ssd.SSDClassificationHead', class {}); + this.registerType('torchvision.models.detection.ssd.SSDHead', class {}); this.registerType('torchvision.models.detection.ssd.SSDFeatureExtractorVGG', class {}); + this.registerType('torchvision.models.detection.ssd.SSDRegressionHead', class {}); this.registerType('torchvision.models.detection.ssdlite.SSDLiteClassificationHead', class {}); this.registerType('torchvision.models.detection.ssdlite.SSDLiteFeatureExtractorMobileNet', class {}); this.registerType('torchvision.models.detection.ssdlite.SSDLiteHead', class {});