package torch

  1. Overview
  2. Docs
Torch bindings for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

torch-v0.16.0.tar.gz
sha256=ccd9ef3b630bdc7c41e363e71d8ecb86c316460cbf79afe67546c6ff22c19da4

doc/src/torch.core/device.ml.html

Source file device.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
type t =
  | Cpu
  | Cuda of int

(* Hardcoded, should match torch_api.cpp *)
let to_int = function
  | Cpu -> -1
  | Cuda i ->
    if i < 0 then Printf.sprintf "negative index for cuda device" |> failwith;
    i
;;

let of_int i = if i < 0 then Cpu else Cuda i
OCaml

Innovation. Community. Security.