我正在学习SwiftUI。我遇到了“ GeometryReader”。我想知道为什么以及何时使用它?
我试图在谷歌colab中复制此处描述的工作( https://www.analyticsvidhya.com/blog/2019/02/building-crowd-counting-model-python/ )。不幸的是,一开始它可以工作,但一段时间后,它显示这行代码的 cuda 内存不足错误。
output = model(img.unsqueeze(0))
Run Code Online (Sandbox Code Playgroud)
这是错误描述:
RuntimeError: CUDA out of memory. Tried to allocate 98.00 MiB (GPU 0; 11.17 GiB total capacity; 10.78 GiB already allocated; 40.81 MiB free; 34.25 MiB cached)
Run Code Online (Sandbox Code Playgroud)
我尝试在不同的谷歌帐户中运行此代码,但显示相同的错误。
我开始尝试在WWDC 2019上宣布的新SwiftUI框架,并在https://developer.apple.com/tutorials/swiftui上开始了该教程。
现在,我谈到了通过来将Profile连接到HomeScreen的地步PresentationButton
。更确切地说,我在谈论以下代码部分Home.swift
:
.navigationBarItems(trailing:
PresentationButton(
Image(systemName: "person.crop.circle")
.imageScale(.large)
.accessibility(label: Text("User Profile"))
.padding(),
destination: ProfileHost()
)
)
Run Code Online (Sandbox Code Playgroud)
当我第一次单击该按钮时,“配置文件”看起来很好,但是当我关闭它,然后再次单击该按钮时,什么也没有发生。
有人知道为什么会这样吗?
提前致谢