Skip to content

Commit 74798bc

Browse files
authored
Clone the module on TorchForceImpl initialization to avoid several (#116)
contexts sharing the same model
1 parent e9f2ae2 commit 74798bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

openmmapi/src/TorchForceImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ TorchForceImpl::~TorchForceImpl() {
4646
}
4747

4848
void TorchForceImpl::initialize(ContextImpl& context) {
49-
auto module = owner.getModule();
49+
auto module = owner.getModule().clone();
5050
// Create the kernel.
5151
kernel = context.getPlatform().createKernel(CalcTorchForceKernel::Name(), context);
5252
kernel.getAs<CalcTorchForceKernel>().initialize(context.getSystem(), owner, module);

0 commit comments

Comments
 (0)