Skip to content

Commit

Permalink
Clone the module on TorchForceImpl initialization to avoid several
Browse files Browse the repository at this point in the history
contexts sharing the same model
  • Loading branch information
RaulPPelaez committed Sep 4, 2023
1 parent e9f2ae2 commit afb1d8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion openmmapi/src/TorchForceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TorchForceImpl::~TorchForceImpl() {
}

void TorchForceImpl::initialize(ContextImpl& context) {
auto module = owner.getModule();
auto module = owner.getModule().clone();
// Create the kernel.
kernel = context.getPlatform().createKernel(CalcTorchForceKernel::Name(), context);
kernel.getAs<CalcTorchForceKernel>().initialize(context.getSystem(), owner, module);
Expand Down

0 comments on commit afb1d8c

Please sign in to comment.