Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion craft/craft_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ def fit(self, inputs: np.ndarray):
strides = int(self.patch_size * 0.80)

patches = torch.nn.functional.unfold(inputs, kernel_size=self.patch_size, stride=strides)
patches = patches.transpose(1, 2).contiguous().view(-1, 3, self.patch_size, self.patch_size)

#Add num_channels to use black and white images
num_channels = inputs.shape[1]
patches = patches.transpose(1, 2).contiguous().view(-1, num_channels, self.patch_size, self.patch_size)

# encode the patches and obtain the activations
activations = _batch_inference(self.input_to_latent, patches, self.batch_size, image_size,
Expand Down