Skip to content

Commit 27d077f

Browse files
authored
Merge pull request #236 from ClojureCivitas/tensor-images-9
tensor images minor fix
2 parents 40cd668 + fa24c0f commit 27d077f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/dtype_next/image_processing_with_tensors.clj

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,22 @@ original-tensor
181181
;;
182182
;; Let's explore essential tensor operations for transforming and converting data.
183183

184+
;; ## The tensor Namespace
185+
186+
(require '[tech.v3.tensor :as tensor])
187+
188+
;; The [`tech.v3.tensor`](https://cnuernber.github.io/dtype-next/tech.v3.tensor.html)
189+
;; namespace provides multi-dimensional array operations—the core of working with
190+
;; tensors in dtype-next.
191+
;;
192+
;; **Key functions we'll use:**
193+
;; - `tensor/compute-tensor` — create tensors by applying a function to each position
194+
;; - `tensor/select` — extract regions (zero-copy slicing)
195+
;; - `tensor/slice` / `tensor/slice-right` — iterate through dimensions
196+
;; - `tensor/reshape` — reinterpret shape without copying
197+
;; - `tensor/transpose` — reorder dimensions
198+
;; - `tensor/reduce-axis` — collapse dimensions with aggregation
199+
184200
;; ## Reshaping
185201

186202
;; Sometimes it's convenient to flatten spatial dimensions into a single axis.
@@ -244,11 +260,6 @@ original-tensor
244260

245261
;; ## Creating Tensors: tensor/compute-tensor
246262

247-
(require '[tech.v3.tensor :as tensor])
248-
249-
;; The [`tech.v3.tensor`](https://cnuernber.github.io/dtype-next/tech.v3.tensor.html)
250-
;; namespace provides multi-dimensional array operations.
251-
252263
;; `tensor/compute-tensor` creates a tensor by calling a function for each position.
253264
;; The function receives indices and returns the value for that position.
254265

0 commit comments

Comments
 (0)