Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update encoders.py #72

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
17 changes: 12 additions & 5 deletions steganogan/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

import torch
from torch import nn
import torch.onnx
from torchvision.ops.deform_conv import DeformConv2d

input = torch.rand(4, 3, 10, 10)
kh, kw = 3, 3
weight = torch.rand(5, 3, kh, kw)
offset = torch.rand(4, 2 * kh * kw, 8, 8)
mask = torch.rand(4, kh * kw, 8, 8)

class BasicEncoder(nn.Module):
"""
Expand All @@ -16,11 +23,11 @@ class BasicEncoder(nn.Module):
add_image = False

def _conv2d(self, in_channels, out_channels):
return nn.Conv2d(
in_channels=in_channels,
out_channels=out_channels,
kernel_size=3,
padding=1
return DeformConv2d(
input=input,
offset,
weight,
mask
)

def _build_models(self):
Expand Down