Skip to content

Preserve zero operator device, dtype and batch metadata - #151

Open
M-Colley wants to merge 1 commit into
cornellius-gp:mainfrom
M-Colley:codex/zero-operator-placement
Open

M-Colley wants to merge 1 commit into
cornellius-gp:mainfrom
M-Colley:codex/zero-operator-placement

Conversation

@M-Colley

Copy link
Copy Markdown

ZeroLinearOperator records a dtype/device but drops them when materializing its dense value, indexing, and transposing. A CUDA double zero operator therefore produces CPU float32 values. Its logdet() similarly returns a CPU float32 scalar even for a batched operator.

Preserve placement in those constructors and return one negative-infinity log determinant per batch. Use the tuple-shaped torch.zeros form for scalar advanced-index results as well. The regression checks dense conversion, scalar/slice/tensor indexing, point/batch transposition and batched log determinants for CPU/CUDA and float32/float64. All four new device/dtype subcases fail against unchanged main; the corrected full zero-operator module passes (9 tests, 4 subtests).

ufmt, flake8 and git diff --check pass. This patch and its tests were prepared with Codex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant