package torch

  1. Overview
  2. Docs
PyTorch bindings for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.14.tar.gz
md5=7a712ae0e8c7f5452f628377d80a5bb4
sha512=22314b655bc6b5e5c970cbab8d132eae36ee0b8fb0a96b63727899442eb70fe00bd1895d7cc718a85b58bc2b2b4ea6820fa288a19346f095e5de18f7e47c2d02

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.