package torch

  1. Overview
  2. Docs
PyTorch bindings for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.17.tar.gz
md5=c64a4ae1c677f9e2c2528bec6b70e733
sha512=2617754f8e5d127758ce66519683886d660ea9747659d6a3d58d0eb2e299ba9e3da7e5a559dc784bf36cdad477c59394f6ff93657378c572e17596bde52f4537

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.