在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:FluxML/Torch.jl开源软件地址:https://github.com/FluxML/Torch.jl开源编程语言:C++ 45.4%开源软件介绍:Torch.jlSensible extensions for exposing torch in Julia. This package is aimed at providing the Note:
Quick StartTo add the package, from the Julia REPL, enter the Pkg prompt by typing pkg> add Torch Or via Julia's package manager Pkg. julia> using Pkg; Pkg.add("Torch"); Usage Exampleusing Metalhead, Metalhead.Flux, Torch
using Torch: torch
resnet = ResNet() We can move our object over to Torch via a simple call to tresnet = resnet.layers |> torch Or if we need more control over the device to be used like so: ip = rand(Float32, 224, 224, 3, 1) # An RGB Image
tip = tensor(ip, dev = 0) # 0 => GPU:0 in Torch
cpu_tensor = tensor(ip, dev = -1) # -1 => CPU:0 Calling into the model is done via the usual Flux mechanism. tresnet(tip); We can take gradients using Zygote as well gs = gradient(x -> sum(tresnet(x)), tip);
# Or
ps = Flux.params(tresnet);
gs = gradient(ps) do
sum(tresnet(tip))
end Contributing and IssuesPlease feel free to open issues you might encounter in the issue tracker. I would also appreciate contributions through PRs toward corrections, increased coverage, docs, etc. Testing currently runs on Linux, but that can be expanded as need arises. AcknowledgementsTakes a lot of inspiration from existing such projects - ocaml-torch for generating the wrappers. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论