clamp initial timestamp

pull/73/head
Timothy Kautz 1 year ago
parent 685da66efc
commit 3c30af52ee

@ -22,7 +22,7 @@ public struct AlphasCumprodCalculation {
strength: Float
) {
let tEnc = Int(strength * Float(steps))
let initTimestep = timesteps - timesteps / steps * (steps - tEnc) + 1
let initTimestep = min(max(0, timesteps - timesteps / steps * (steps - tEnc) + 1), timesteps - 1)
self.sqrtAlphasCumprod = alphasCumprod[initTimestep].squareRoot()
self.sqrtOneMinusAlphasCumprod = (1 - alphasCumprod[initTimestep]).squareRoot()
}

@ -66,7 +66,6 @@ public struct Encoder {
else {
throw Error.latentOutputNotValid
}
print("output.shape: \(output.shape)")
return MLShapedArray(output)
}

Loading…
Cancel
Save