Skip to content

Commit

Permalink
Update python.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Mar 21, 2024
1 parent 26e138d commit fbcd2ae
Showing 1 changed file with 18 additions and 32 deletions.
50 changes: 18 additions & 32 deletions source/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand Down Expand Up @@ -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 {});
Expand Down Expand Up @@ -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 {});
Expand Down Expand Up @@ -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 {});
Expand Down

0 comments on commit fbcd2ae

Please sign in to comment.