Coder Social home page Coder Social logo

Comments (4)

wavefrontshaping avatar wavefrontshaping commented on July 24, 2024

Hi,
Can you please provide a minimal example to reproduce the error?
Thx

from complexpytorch.

Dub21 avatar Dub21 commented on July 24, 2024

class ComplexNet_Unet(nn.Module):

def __init__(self):
    super(ComplexNet_Unet, self).__init__()
    self.conv1 = ComplexConv2d(1, 8, 5, 2, 2)
    
    self.conv2= ConvTranspose2d(8, 1, 1,1)
   
def forward(self,x):
    x = self.conv1(x)
    x = self.conv2(x)

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = ComplexNet_Unet().to(device)
optimizer = torch.optim.SGD(model.parameters(), lr=0.01, momentum=0.9)

loss = nn.L1Loss()

def train(model, device, data,target, optimizer, epochs):
model.train()
for epoch in range(epochs):

    #data = torch.complex(torch.DoubleTensor(np.real(X)),torch.DoubleTensor(np.imag(X)))
    #target = torch.complex(torch.DoubleTensor(np.real(y)),torch.DoubleTensor(np.imag(y)))

    #data, target = data2.to(device).type(torch.complex64), target2.to(device)
    optimizer.zero_grad()
    output = model(data)
    print(output.shape)
    value = loss(output, target)
    print(value)
    value.backward()
    optimizer.step()
    if batch_idx % 100 == 0:
        print('Train Epoch: {:3} [{:6}/{:6} ({:3.0f}%)]\tLoss: {:.6f}'.format(
            epoch,
            batch_idx * len(data), 
            len(train_loader.dataset),
            100. * batch_idx / len(train_loader), 
            loss.item())
        )

Run training on 50 epochs

for epoch in range(1):
train(model, device, data, target, optimizer, 500)

from complexpytorch.

wavefrontshaping avatar wavefrontshaping commented on July 24, 2024

That is not so minimal...

from complexpytorch.

wavefrontshaping avatar wavefrontshaping commented on July 24, 2024

Before testing anything, I see that you use the native ConvTranspose2d instead of the complex counterpart ComplexConvTranspose2d from complexPyTorch. Is that on purpose?

from complexpytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.