Skip to content

Commit

Permalink
Merge pull request #131 from jdenholm/dev
Browse files Browse the repository at this point in the history
v0.12.0
  • Loading branch information
jdenholm authored Sep 29, 2024
2 parents 41df694 + 3f28f60 commit b8e6829
Show file tree
Hide file tree
Showing 35 changed files with 1,780 additions and 244 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## Version0.11.1
## Version 0.12.0
- Added dropout option to all of the 2d conv blocks.
- Added dropout to ``UNet``, ``AutoEncoder2d`` and ``VAE2d``.

## Version 0.11.1
- Updated the ``UNet``'s docstring.

## Version 0.11.0
Expand Down
179 changes: 128 additions & 51 deletions demos/autoencoder-demo.ipynb

Large diffs are not rendered by default.

164 changes: 95 additions & 69 deletions demos/unet_semantic_segmentation_demo.ipynb

Large diffs are not rendered by default.

149 changes: 125 additions & 24 deletions demos/variational_autoencoder_demo.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "torch_tools"
version = "0.11.1"
version = "0.12.0"
description = "PyTorch and other tools"
authors = [
{ name="Jim Denholm", email="j.denholm.2017@gmail.com" },
Expand Down
2 changes: 2 additions & 0 deletions src/torch_tools/datasets/_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Main dataset object for `torch_tools`."""

from typing import Sequence, Union, Optional, Tuple
from pathlib import Path

Expand All @@ -15,6 +16,7 @@


# pylint: disable=too-many-arguments, too-few-public-methods
# pylint: disable=too-many-positional-arguments


class DataSet(_BaseDataset):
Expand Down
4 changes: 3 additions & 1 deletion src/torch_tools/datasets/_shapes_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Synthetic dataset object."""

from typing import Tuple, Optional, Dict, Callable, List

from torch import from_numpy, Tensor # pylint: disable=no-name-in-module
Expand Down Expand Up @@ -56,7 +57,8 @@ class ShapesDataset(Dataset):
"""

def __init__( # pylint: disable=too-many-arguments
# pylint: disable=too-many-positional-arguments,too-many-arguments
def __init__(
self,
spot_prob: float = 0.5,
square_prob: float = 0.5,
Expand Down
9 changes: 8 additions & 1 deletion src/torch_tools/models/_autoencoder_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
process_boolean_arg,
process_2d_kernel_size,
process_2d_block_style_arg,
process_dropout_prob,
)

# pylint:disable=too-many-arguments
# pylint:disable=too-many-arguments, too-many-positional-arguments


class AutoEncoder2d(Module):
Expand Down Expand Up @@ -47,6 +48,9 @@ class AutoEncoder2d(Module):
block_style : str, optional
Style of convolutional blocks to use in the encoding and decoding
blocks. Use either ``"double_conv"`` or ``"conv_res"``.
dropout : float, optional
The dropout probability to apply at the output of the convolutional
blocks.
Notes
Expand Down Expand Up @@ -97,6 +101,7 @@ def __init__(
bilinear: bool = False,
kernel_size: int = 3,
block_style: str = "double_conv",
dropout: float = 0.25,
):
"""Build ``EncoderDecoder2d``."""
super().__init__()
Expand All @@ -109,6 +114,7 @@ def __init__(
process_negative_slope_arg(lr_slope),
process_2d_kernel_size(kernel_size),
block_style=process_2d_block_style_arg(block_style),
dropout=process_dropout_prob(dropout),
)

self.decoder = Decoder2d(
Expand All @@ -119,6 +125,7 @@ def __init__(
process_negative_slope_arg(lr_slope),
process_2d_kernel_size(kernel_size),
block_style=process_2d_block_style_arg(block_style),
dropout=process_dropout_prob(dropout),
)

def forward(
Expand Down
3 changes: 2 additions & 1 deletion src/torch_tools/models/_blocks_1d.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""One dimensional neural network blocks."""

from typing import List

from torch.nn import Module, Sequential, Linear, BatchNorm1d, Dropout
Expand All @@ -9,7 +10,7 @@
from torch_tools.models._argument_processing import process_dropout_prob
from torch_tools.models._argument_processing import process_negative_slope_arg

# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments, too-many-positional-arguments


class DenseBlock(Sequential):
Expand Down
Loading

0 comments on commit b8e6829

Please sign in to comment.