Skip to content

Commit

Permalink
Clone the module on TorchForceImpl initialization to avoid several (#116
Browse files Browse the repository at this point in the history
)

contexts sharing the same model
  • Loading branch information
RaulPPelaez authored Sep 5, 2023
1 parent e9f2ae2 commit 74798bc
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 74798bc

Please sign in to comment.