Giter VIP home page Giter VIP logo

Comments (6)

bolin12 avatar bolin12 commented on May 30, 2024

and same other problems in trainSketchModule.py

from shapematchinggan.

bolin12 avatar bolin12 commented on May 30, 2024

class myBlur(nn.Module):
def init(self, kernel_size=121, channels=3):
super(myBlur, self).init()
self.kernel_size=kernel_size
self.channels = channels
self.GF = nn.Conv2d(in_channels=channels, out_channels=channels,
kernel_size=kernel_size, groups=channels, bias=False)
x_cord = torch.arange(self.kernel_size+0.)
x_grid = x_cord.repeat(self.kernel_size).view(self.kernel_size, self.kernel_size)
y_grid = x_grid.t()
self.xy_grid = torch.stack([x_grid, y_grid], dim=-1)
self.mean = (self.kernel_size - 1)/2 ###this may become float and cause pad error
self.diff = -torch.sum((self.xy_grid - self.mean)**2., dim=-1)
self.gaussian_filter = nn.Conv2d(in_channels=self.channels, out_channels=self.channels,
kernel_size=self.kernel_size, groups=self.channels, bias=False)

    self.gaussian_filter.weight.requires_grad = False

from shapematchinggan.

williamyang1991 avatar williamyang1991 commented on May 30, 2024

The float bugs have been fixed.
It seems that your default data type is float?
In my case, the result of integer / integer is sill an integer.
e.g. (self.kernel_size - 1)/2 and trainnum/batchsize*batchsize
So there is no type error reported in the orginal code on my computer.

from shapematchinggan.

bolin12 avatar bolin12 commented on May 30, 2024

看来是我的问题。 不过都是python3 ,为什么我的整数相除会变成浮点?

from shapematchinggan.

williamyang1991 avatar williamyang1991 commented on May 30, 2024

It seems that I find the reason.
My code is implemented under python2, where integer / integer yields integer.
And in python3, integer / integer produces float.

from shapematchinggan.

bolin12 avatar bolin12 commented on May 30, 2024

so haven't you thought about making a python3 version?

from shapematchinggan.

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.