package torch

  1. Overview
  2. Docs
PyTorch bindings for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.9b.tar.gz
md5=9da4e3a18e6468215ce07c8dc9ff0398
sha512=73d5ab4b820fe27572e8054a8a0d6029a17ed7936e76b395def7e7ad5971e898d4006fb8aa38065274a297a08f5f40763d91d6e5565118f53947dde24bbc3dbf

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.