clj-python / clj-python/libpython-clj
the problem to access nested Python attributes or methods **(py.. torch/backends mps is_available)**.
未关闭
还没有人认领这个 Issue。
- 主要语言
- Clojure
- 星标
- 1.2k
- 派生
- 74
- PR 合并指标
- 30 天内没有已合并 PR
描述
the problem to access nested Python attributes or methods
(py.. torch/backends mps is_available),
Please comment how to fix it
(defn get-device []
(try
(let [device (torch/device (if (py.. torch/backends mps is_available)
"mps"
"cpu"))]
(println "Using device:" device)
device)
(catch Exception e
(println "Error initializing device:" (.getMessage e))
(torch/device "cpu")))) ;; Fallback to CPU on error
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该 issue 没有指明文件或测试;先复现所示的 get-device 示例,并检查 libpython-clj 如何处理对 torch.backends.mps.is_available 的嵌套 py.. 访问。完成的标准是嵌套的可用性检查能够正常工作,并且示例在 MPS 可用时选择 MPS,同时保留所示的 CPU 回退。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- clojure, python, pytorch
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100