Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hyunji
/
A-Performance-Evaluation-of-CNN-for-Brain-Age-Prediction-Using-Structural-MRI-Data
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Hyunji
2021-12-20 03:48:32 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dd7a30b3163fb09355baebf00e19cbfd8815c124
dd7a30b3
1 parent
81d597ef
internally replaced utils
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
3DCNN_VGGNet_2DResNet/_internally_replaced_utils.py
3DCNN_VGGNet_2DResNet/_internally_replaced_utils.py
0 → 100644
View file @
dd7a30b
import
importlib.machinery
import
os
def
_download_file_from_remote_location
(
fpath
:
str
,
url
:
str
)
->
None
:
pass
def
_is_remote_location_available
()
->
bool
:
return
False
try
:
from
torch.hub
import
load_state_dict_from_url
# noqa: 401
except
ImportError
:
from
torch.utils.model_zoo
import
load_url
as
load_state_dict_from_url
# noqa: 401
def
_get_extension_path
(
lib_name
):
lib_dir
=
os
.
path
.
dirname
(
__file__
)
if
os
.
name
==
"nt"
:
# Register the main torchvision library location on the default DLL path
import
ctypes
import
sys
kernel32
=
ctypes
.
WinDLL
(
"kernel32.dll"
,
use_last_error
=
True
)
with_load_library_flags
=
hasattr
(
kernel32
,
"AddDllDirectory"
)
prev_error_mode
=
kernel32
.
SetErrorMode
(
0x0001
)
if
with_load_library_flags
:
kernel32
.
AddDllDirectory
.
restype
=
ctypes
.
c_void_p
if
sys
.
version_info
>=
(
3
,
8
):
os
.
add_dll_directory
(
lib_dir
)
elif
with_load_library_flags
:
res
=
kernel32
.
AddDllDirectory
(
lib_dir
)
if
res
is
None
:
err
=
ctypes
.
WinError
(
ctypes
.
get_last_error
())
err
.
strerror
+=
f
' Error adding "{lib_dir}" to the DLL directories.'
raise
err
kernel32
.
SetErrorMode
(
prev_error_mode
)
loader_details
=
(
importlib
.
machinery
.
ExtensionFileLoader
,
importlib
.
machinery
.
EXTENSION_SUFFIXES
)
extfinder
=
importlib
.
machinery
.
FileFinder
(
lib_dir
,
loader_details
)
ext_specs
=
extfinder
.
find_spec
(
lib_name
)
if
ext_specs
is
None
:
raise
ImportError
return
ext_specs
.
origin
\ No newline at end of file
Please
register
or
login
to post a comment