Deallocates a TorchScript model
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(torch_model), | intent(inout) | :: | model |
Torch Model to deallocate |
subroutine torch_model_delete(model) use, intrinsic :: iso_c_binding, only : c_associated, c_null_ptr type(torch_model), intent(inout) :: model !! Torch Model to deallocate interface subroutine torch_jit_model_delete_c(model_c) & bind(c, name = 'torch_jit_module_delete') use, intrinsic :: iso_c_binding, only : c_ptr implicit none type(c_ptr), value, intent(in) :: model_c end subroutine torch_jit_model_delete_c end interface ! Call the destructor, if it hasn't already been called if (c_associated(model%p)) then call torch_jit_model_delete_c(model%p) model%p = c_null_ptr end if end subroutine torch_model_delete