Skip to content

Commit

Permalink
modified: dsm/dsm_api.py
Browse files Browse the repository at this point in the history
	modified:   dsm/dsm_torch.py
	modified:   examples/conv_example.ipynb
	modified:   dsm/utilities.py
	modified:   examples/conv_example.ipynb
	modified:   examples/pbc_final_experiment.ipynb
  • Loading branch information
chiragnagpal committed Jan 2, 2021
1 parent 92de282 commit a33b743
Show file tree
Hide file tree
Showing 3 changed files with 407 additions and 41 deletions.
2 changes: 1 addition & 1 deletion dsm/dsm_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def __init__(self, k=3, layers=None, hidden=None,
distribution='Weibull', temp=1000., discount=1.0, typ='ConvNet'):
super(DeepConvolutionalSurvivalMachines, self).__init__(k=k,
distribution=distribution,
temp=temp,
temp=temp,
discount=discount)
self.hidden = hidden
self.typ = typ
Expand Down
35 changes: 22 additions & 13 deletions dsm/dsm_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
__pdoc__ = {}

for clsn in ['DeepSurvivalMachinesTorch',
'DeepRecurrentSurvivalMachinesTorch']:
'DeepRecurrentSurvivalMachinesTorch',
'DeepConvolutionalSurvivalMachines']:
for membr in ['training', 'dump_patches']:

__pdoc__[clsn+'.'+membr] = False
Expand Down Expand Up @@ -370,19 +371,27 @@ def create_conv_representation(inputdim, hidden, typ='ConvNet'):
linear_dim = ((((inputdim-2) // 2) - 2) // 2) ** 2
linear_dim *= 16
embedding = nn.Sequential(
nn.Conv2d(1, 6, 3),
nn.ReLU(),
nn.MaxPool2d(2, 2),
nn.Conv2d(6, 16, 3),
nn.ReLU(),
nn.MaxPool2d(2, 2),
nn.Flatten(),
nn.Linear(linear_dim, 120),
nn.ReLU(),
nn.Linear(120, 84),
nn.ReLU(),
nn.Linear(84, hidden)
nn.Conv2d(1, 6, 3),
nn.ReLU6(),
nn.MaxPool2d(2, 2),
nn.Conv2d(6, 16, 3),
nn.ReLU6(),
nn.MaxPool2d(2, 2),
nn.Flatten(),
nn.Linear(linear_dim, hidden),
nn.ReLU6()
)

# if typ == 'SimpleConvNet':
# inputdim = np.squeeze(inputdim)

# layers.Conv2D(32, kernel_size=(3, 3), activation="relu"),
# layers.MaxPooling2D(pool_size=(2, 2)),
# layers.Conv2D(64, kernel_size=(3, 3), activation="relu"),
# layers.MaxPooling2D(pool_size=(2, 2)),
# layers.Flatten(),


return embedding

class DeepConvolutionalSurvivalMachinesTorch(nn.Module):
Expand Down
Loading

0 comments on commit a33b743

Please sign in to comment.