Comments (4)
I think the accidental broadcast is happening here (code is messy b/c I added my own annotations, but it's inside of ResidualBlock
):
batch_size = 1
# First convolution layer
h = self.conv1(self.act1(self.norm1(x)))
time_emb = self.time_emb(t)
assert t.shape == (batch_size, self.time_channels)
assert time_emb.shape == (batch_size, self.out_channels)
time_emb = time_emb[:, :, None, None]
assert time_emb.shape == (batch_size, self.out_channels, 1, 1)
# This looks like:
# [ [[a]], [[b]], [[c]], [[d]], [[e]], [[f]] ]
# when self.out_channels = 6
from aiaiart.
In general, you'd have a separate random t for each image (so it would be shape [batch_size]). But for the demo and during sampling it's the same t for the whole batch, so it's convenient to also accept a single value. An alternative would be to force the right shape (as you're doing with the assert) and tweak the sampling code to pass in t as a tensor of shape [batch_size] instead of [1].
During training, t has the shape described:
t = torch.randint(0, n_steps, (batch_size,), dtype=torch.long).cuda()
from aiaiart.
(I could be mistaken on this, will take a look at the code in more depth when I have a bit more time)
from aiaiart.
Got it! This make sense. You allow the NN to accept a single value of t
, which makes the assumption that all images are at the same timestep. This makes it more convenient to use. Sounds good!
No need to look through the code, don't want to waste your time!
from aiaiart.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiaiart.