TL;DR: Use var
for properties in struct
as long as it serves as a nominal tuple. In most cases, there is no obvious benefit to using let
for struct
properties.
Let's start with a simple example:
struct MyStruct {
// | |
// Tuple.swift | |
// Tuple | |
// | |
// Created by Yoshimasa Niwa on 8/8/25. | |
// | |
public struct Tuple<each T: Equatable>: Equatable { | |
public static func == (lhs: Tuple<repeat each T>, rhs: Tuple<repeat each T>) -> Bool { | |
var result = true |
#!/bin/bash | |
# Congratulations! You found the easter egg! ❤️ | |
# おめでとうございます!隠されたサプライズを見つけました!❤️ | |
# Define the text to animate | |
text="♥PEACE♥FOR♥ALL♥PEACE♥FOR♥ALL♥PEACE♥FOR♥ALL♥PEACE♥FOR♥ALL♥PEACE♥FOR♥ALL♥" | |
# Get terminal dimensions | |
cols=$(tput cols) |
// | |
// UUIDv7.swift | |
// UUIDv7 | |
// | |
// Created by Yoshimasa Niwa on 7/25/25. | |
// | |
import Foundation | |
import Security |
import Foundation | |
public enum ChunkedDataTaskError: Swift.Error { | |
case notSuccess(_ data: Data, _ httpResponse: HTTPURLResponse) | |
} | |
private extension Int { | |
var isSuccess: Bool { | |
(200 ..< 300).contains(self) |
import AppKit | |
import SwiftUI | |
public struct TextView: NSViewRepresentable { | |
@Binding | |
var text: String | |
var font: NSFont? | |
public init( | |
text: Binding<String> |
import Foundation | |
import Observation | |
func onChange<Value>( | |
of value: @autoclosure () -> Value, | |
initial: Bool = false, | |
perform: (_ oldValue: Value, _ newValue: Value) -> Void, | |
_: isolated Actor = #isolation | |
) async throws { | |
let (stream, continuation) = AsyncThrowingStream.makeStream(of: Void.self) |
#!/usr/bin/env bash | |
for i in {0..255}; do | |
printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" | |
if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then | |
printf "\n" | |
fi | |
done |
diff --git a/comfy/ldm/genmo/vae/model.py b/comfy/ldm/genmo/vae/model.py | |
index b68d48a..694b33a 100644 | |
--- a/comfy/ldm/genmo/vae/model.py | |
+++ b/comfy/ldm/genmo/vae/model.py | |
@@ -78,7 +78,12 @@ class PConv3d(ops.Conv3d): | |
# Apply padding. | |
assert self.padding_mode == "replicate" # DEBUG | |
mode = "constant" if self.padding_mode == "zeros" else self.padding_mode | |
+ is_mps_device = x.device.type == "mps" | |
+ if is_mps_device: |
#!/usr/bin/env xcrun swift | |
import Foundation | |
import MetalPerformanceShaders | |
import MetalPerformanceShadersGraph | |
let device = MTLCreateSystemDefaultDevice()! | |
//let size = 256 * 256 - 1 // This size should work | |
let size = 256 * 256 // This size may not work |