-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to script the forward pass? #96
Comments
Thanks for reporting! @francescamanni1989 Could you provide the code snippet that reproduces the runtime error. |
Hi, the code part in gradient_boosting.py is in the argsvar part, when boosting is performed: My error comes, when trying to script the model: model = model_ensemble where model_ensemble could be: model_ensemble = GradientBoostingClassifier( |
It looks like the package does not support |
Exactly! |
Also, the function sum is not scriptable, but this could be by-passed using @torch.jit.ignore() |
My suggestion for the indexed variable is to use a for loop instead. |
Hu everyone,
I am trying to script the ensemble, however, argsvar cannot be used with torchscript
torch.jit.frontend.NotSupportedError: Compiled functions can't take variable number of arguments or use keyword-only arguments with defaults:
File ".....\lib\site-packages\torchensemble\soft_gradient_boosting.py", line 390
"classifier_forward",
)
def forward(self, *x):
~~ <--- HERE
output = [estimator(*x) for estimator in self.estimators_]
output = op.sum_with_multiplicative(output, self.shrinkage_rate)
do you have any idea on how to handle it?
The text was updated successfully, but these errors were encountered: