Update modeling_super_linear.py
Browse files593 unmodified lines594595596597598599600601602603604605606607608609610611612613593 unmodified linesdef upsample_interpolate(self, x,scale_factor, target_len: int = 512):# Add channel dimension if input is 2Dif len(x.shape) == 2:x = x.unsqueeze(1) # [B, 1, L]upsample = interpolate(x,size =target_len,mode='linear') # [B, C, new_L]# Take last 500 timesteps and rearrange to [B, L, C]if target_len < 512:upsample = upsample.permute(0, 2, 1)else:upsample = upsample.permute(0, 2, 1)# If input was 2D, remove the channel dimensionif x.shape[1] == 1:upsample = upsample.squeeze(-1)upsample = upsample.float()593 unmodified lines594595596597598599600601602603604605606607608593 unmodified linesdef upsample_interpolate(self, x,scale_factor, target_len: int = 512):# Add channel dimension if input is 2Dsize = len(x.shape)if size == 2:x = x.unsqueeze(1) # [B, 1, L]upsample = = F.interpolate(x, size=target_len, mode='linear', align_corners=False)# If input was 2D, remove the channel dimensionif size == 2:upsample = upsample.squeeze(-1)upsample = upsample.float()
modeling_super_linear.py+4-9