package torch

  1. Overview
  2. Docs
PyTorch bindings for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.7.tar.gz
md5=e8681bb78ee902c7df73d8569ac92ed9
sha512=335064169516f456f1f123e52ec8ab1b5e0c7f9d036bd72e0171b19a2a57c2eb8ea70d1a64ae0d43b05775307d7a017b742f6f6af9d44e3e4d6dc57f478b15a3

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

Source file device.ml

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

Innovation. Community. Security.