package torch

  1. Overview
  2. Docs
PyTorch bindings for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.15.tar.gz
md5=e0e2cf2688c69d6bb60f837e812db432
sha512=a518928c5be656a85973db2fe2fb8efb73ec4f4f972f0f733cd75ee8c25292d907bc31ca04a3f2dd5bc95800ee15ee19533ca47f9ff43432485c528c8f08ca90

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

Source file device.ml

1
2
3
4
5
6
7
8
9
10
11
12
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.