clamp initial timestamp

pull/116/head
Timothy Kautz 3 years ago
parent e7eb953d7b
commit ba7b5fa9cb

@ -22,7 +22,7 @@ public struct AlphasCumprodCalculation {
strength: Float strength: Float
) { ) {
let tEnc = Int(strength * Float(steps)) 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.sqrtAlphasCumprod = alphasCumprod[initTimestep].squareRoot()
self.sqrtOneMinusAlphasCumprod = (1 - alphasCumprod[initTimestep]).squareRoot() self.sqrtOneMinusAlphasCumprod = (1 - alphasCumprod[initTimestep]).squareRoot()
} }

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

Loading…
Cancel
Save