-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from neuro-ml/develop
Develop
- Loading branch information
Showing
16 changed files
with
215 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ docs/_build/ | |
.ipynb_checkpoints/ | ||
.pytest_cache/ | ||
*.egg-info/ | ||
.asv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"version": 1, | ||
"project": "deep_pipe", | ||
"project_url": "https://github.com/neuro-ml/deep_pipe", | ||
"repo": ".", | ||
"branches": ["master", "develop"], | ||
"dvcs": "git", | ||
"environment_type": "conda", | ||
"show_commit_url": "https://github.com/neuro-ml/deep_pipe/commit", | ||
"pythons": ["3.10"], | ||
"conda_channels": ["defaults", "conda-forge"], | ||
"matrix": { | ||
"req": { | ||
"pip+imops": ["0.8.3"] | ||
} | ||
}, | ||
"env_dir": ".asv/env", | ||
"results_dir": ".asv/results", | ||
"html_dir": ".asv/html", | ||
"build_cache_size": 2 | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import numpy as np | ||
import torch | ||
from torch import nn | ||
|
||
from dpipe.predict import patches_grid | ||
from dpipe.torch.model import inference_step | ||
|
||
|
||
class IdentityWithParams(nn.Conv3d): | ||
"""Needed for determining device""" | ||
def forward(self, x): | ||
return x | ||
|
||
|
||
class TimeSuite: | ||
params = (('float16', 'float32', 'float64'),) | ||
param_names = ('dtype',) | ||
timeout = 300 | ||
|
||
def setup(self, dtype): | ||
self.inp = np.random.randn(512, 512, 512).astype(dtype) | ||
self.predict = patches_grid(200, 100, axis=-1)(lambda x: x) | ||
|
||
def time_patches_grid(self, dtype): | ||
self.predict(self.inp) | ||
|
||
def peakmem_patches_grid(self, dtype): | ||
self.predict(self.inp) | ||
|
||
|
||
class TimeTorchSuite: | ||
params = ((False, True),) | ||
param_names = ('amp',) | ||
|
||
def setup(self, amp): | ||
self.inp = np.random.randn(512, 512, 512).astype('float32') | ||
|
||
try: | ||
inference_step(self.inp[None, None], architecture=IdentityWithParams(1, 1, kernel_size=3), in_dtype=torch.float32) | ||
self.predict = patches_grid(200, 100, axis=-1)( | ||
lambda x: inference_step( | ||
x[None, None], | ||
architecture=IdentityWithParams(1, 1, kernel_size=3), | ||
amp=amp, out_dtype=torch.float32, | ||
)[0][0] | ||
) | ||
except TypeError: | ||
self.predict = patches_grid(200, 100, axis=-1)( | ||
lambda x: inference_step( | ||
x[None, None], | ||
architecture=IdentityWithParams(1, 1, kernel_size=3), | ||
amp=amp, | ||
).astype('float32', copy=False)[0][0] | ||
) | ||
|
||
def time_patches_grid(self, amp): | ||
self.predict(self.inp) | ||
|
||
def peakmem_patches_grid(self, amp): | ||
self.predict(self.inp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.2.7' | ||
__version__ = '0.2.8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.