multimodalart HF Staff commited on
Commit
75889bd
·
verified ·
1 Parent(s): b1625c2

Upload diffcve/modules/diffusion/utils.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. diffcve/modules/diffusion/utils.py +4 -1
diffcve/modules/diffusion/utils.py CHANGED
@@ -123,7 +123,10 @@ class SpatialTemporalConv(nn.Module):
123
 
124
  def forward(self, inp, t=None):
125
  bt, c, h, w = inp.shape
126
- b = bt // t if t else bt // self.num_frames
 
 
 
127
  ori = inp
128
  inp = from_4d_to_5d(inp, b, c, t, h, w)
129
  res = self.temporal_conv(inp)
 
123
 
124
  def forward(self, inp, t=None):
125
  bt, c, h, w = inp.shape
126
+ # einops >= 0.4 raises when an explicit axis length is None (the authors'
127
+ # einops 0.3.0 inferred it from the shape); use the effective frame count.
128
+ t = t or self.num_frames
129
+ b = bt // t
130
  ori = inp
131
  inp = from_4d_to_5d(inp, b, c, t, h, w)
132
  res = self.temporal_conv(inp)