Skip to content

Commit b15d767

Browse files
fantessileht
authored andcommitted
fix(torch/native): prevent loading weights before instanciating native model
1 parent 77a016b commit b15d767

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backends/torch/torchlib.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ namespace dd
196196

197197
void TorchModule::native_model_load(const TorchModel &tmodel)
198198
{
199-
if (!tmodel._native.empty())
199+
if (!tmodel._native.empty()
200+
&& _native != nullptr) //_native has to be instanciated before loading
200201
{
201202
_logger->info("loading " + tmodel._native);
202203
try

0 commit comments

Comments
 (0)