# \#pytorch

**URL:** https://discourse.julialang.org/tag/pytorch/330.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Plugging DifferentiationInterface.jl into pytorch](https://discourse.julialang.org/t/plugging-differentiationinterface-jl-into-pytorch/132598)

<div class="topic-metadata">

**Author:** [@mattsignorelli](https://discourse.julialang.org/u/mattsignorelli)\
**Replies:** 5\
**Last updated:** [September 23, 2025, 7:32pm UTC](https://discourse.julialang.org/t/plugging-differentiationinterface-jl-into-pytorch/132598 "2025-09-23T19:32:28Z")

</div>

I preface this with saying that I really am not very experienced with both pytorch and juliatorch, and apologize for any misunderstandings that I have. We are developing a physics simulation ecosystem that can be differ…

---

## [How to Manage Memory with Sequential, GPU-Intensive (e.g., PyTorch) Python Calls via PythonCall.jl](https://discourse.julialang.org/t/how-to-manage-memory-with-sequential-gpu-intensive-e-g-pytorch-python-calls-via-pythoncall-jl/129951)

<div class="topic-metadata">

**Author:** [@Dale\_James\_Black](https://discourse.julialang.org/u/Dale_James_Black)\
**Replies:** 0\
**Last updated:** [June 17, 2025, 1:07am UTC](https://discourse.julialang.org/t/how-to-manage-memory-with-sequential-gpu-intensive-e-g-pytorch-python-calls-via-pythoncall-jl/129951 "2025-06-17T01:07:18Z")

</div>

My Question I’m running into an issue where a long-running Python function seems to be terminated mid-execution. My question is: Are there any lower-level features or design patterns within PythonCall.jl that could help…

---

## [Slow LSTM on GPU in Flux](https://discourse.julialang.org/t/slow-lstm-on-gpu-in-flux/84228)

<div class="topic-metadata">

**Author:** [@JLDC](https://discourse.julialang.org/u/JLDC)\
**Replies:** 21\
**Last updated:** [February 15, 2024, 2:14am UTC](https://discourse.julialang.org/t/slow-lstm-on-gpu-in-flux/84228 "2024-02-15T02:14:58Z")

</div>

Hi, I’ve been running into an issue where I try to train a neural network using Flux and the training times are much slower on GPU than on CPU. So I tried comparing an MWE using Flux and an MWE using PyCall and running …

---

## [Calling Julia from PyTorch](https://discourse.julialang.org/t/calling-julia-from-pytorch/101357)

<div class="topic-metadata">

**Author:** [@AMart](https://discourse.julialang.org/u/AMart)\
**Replies:** 4\
**Last updated:** [July 10, 2023, 7:31pm UTC](https://discourse.julialang.org/t/calling-julia-from-pytorch/101357 "2023-07-10T19:31:35Z")

</div>

Hello I have written a GPU kernel in Julia that I use to accelerate a custom layer that I have written to be used with PyTorch. Everything works great, except when I try to use DDP from PyTorch. Here is a simple MWE tha…

---

## [Spatial transformer (i.e. GPU-friendly interpolations with gradients) with Flux.jl?](https://discourse.julialang.org/t/spatial-transformer-i-e-gpu-friendly-interpolations-with-gradients-with-flux-jl/70836)

<div class="topic-metadata">

**Author:** [@afishy](https://discourse.julialang.org/u/afishy)\
**Replies:** 7\
**Last updated:** [July 1, 2022, 4:56am UTC](https://discourse.julialang.org/t/spatial-transformer-i-e-gpu-friendly-interpolations-with-gradients-with-flux-jl/70836 "2022-07-01T04:56:17Z")

</div>

Originally posted this on the flux-bridged Slack channel, but thought this might be a good place to post. I need a spatial transformer or something equivalent for a project, written so far entirely in Julia. I thought In…

---

## [Flux LayerNorm slower than pytorch?](https://discourse.julialang.org/t/flux-layernorm-slower-than-pytorch/78084)

<div class="topic-metadata">

**Author:** [@gpucce](https://discourse.julialang.org/u/gpucce)\
**Replies:** 10\
**Last updated:** [March 18, 2022, 10:46pm UTC](https://discourse.julialang.org/t/flux-layernorm-slower-than-pytorch/78084 "2022-03-18T22:46:38Z")

</div>

I closed a similar topic I opened about one hour ago by mistake, here I try again with clearer example, the issue is that the same LayerNorm layer in pytorch and Flux has large difference in performance and I don’t know …

---

## [\[ANN\] DLPack.jl - Share CPU and CUDA arrays between Julia and Python](https://discourse.julialang.org/t/ann-dlpack-jl-share-cpu-and-cuda-arrays-between-julia-and-python/76871)

<div class="topic-metadata">

**Author:** [@PabloZubieta](https://discourse.julialang.org/u/PabloZubieta)\
**Replies:** 0\
**Last updated:** [February 21, 2022, 11:01pm UTC](https://discourse.julialang.org/t/ann-dlpack-jl-share-cpu-and-cuda-arrays-between-julia-and-python/76871 "2022-02-21T23:01:29Z")

</div>

Hello, I’m pleased to announce the release of DLPack.jl. DLPack is a C API that has continuously been adopted as a the base protocol for exchanging tensor data structures between different python libraries including JAX,…

---

## [Why matrix multiplication is much slower than PyTorch](https://discourse.julialang.org/t/why-matrix-multiplication-is-much-slower-than-pytorch/63661)

<div class="topic-metadata">

**Author:** [@yingqiuz](https://discourse.julialang.org/u/yingqiuz)\
**Replies:** 4\
**Last updated:** [June 27, 2021, 8:49pm UTC](https://discourse.julialang.org/t/why-matrix-multiplication-is-much-slower-than-pytorch/63661 "2021-06-27T20:49:27Z")

</div>

For example, matrix multiplication of 10,000 x 10,100 matrices, single threaded In julia: BLAS.set\_num\_threads(1) A = randn(10000, 10000) B = randn(10000, 10000) C = Matrix{Float64}(undef, 10000, 10000) @benchmark mul…

---

## [Julia slower than Matlab & Python? No](https://discourse.julialang.org/t/julia-slower-than-matlab-python-no/33128)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 119\
**Last updated:** [March 16, 2021, 1:00am UTC](https://discourse.julialang.org/t/julia-slower-than-matlab-python-no/33128 "2021-03-16T01:00:51Z")

</div>

A recent paper ML Software & Hardware for Econ finds Julia is often slower than Matlab & Numpy. Code for Option Pricing is here. Code for Dynamic Programming is here. Usually, writing Julia code similarly leads to eno…

---

## [Using GPU via PyCall causes non-reusable memory allocation](https://discourse.julialang.org/t/using-gpu-via-pycall-causes-non-reusable-memory-allocation/55140)

<div class="topic-metadata">

**Author:** [@JosePereiraUA](https://discourse.julialang.org/u/JosePereiraUA)\
**Replies:** 4\
**Last updated:** [February 16, 2021, 6:33pm UTC](https://discourse.julialang.org/t/using-gpu-via-pycall-causes-non-reusable-memory-allocation/55140 "2021-02-16T18:33:14Z")

</div>

My name is José Pereira, I’m a portuguese PhD student currently using Julia to develop a light-weight protein design package. I’m trying to implement TorchANI, a known ML model for molecular energy calculation, developed…

---

## [Creating deconvolution layers in Flux compared to PyTorch](https://discourse.julialang.org/t/creating-deconvolution-layers-in-flux-compared-to-pytorch/51186)

<div class="topic-metadata">

**Author:** [@kadir-gunel](https://discourse.julialang.org/u/kadir-gunel)\
**Replies:** 3\
**Last updated:** [December 4, 2020, 11:44am UTC](https://discourse.julialang.org/t/creating-deconvolution-layers-in-flux-compared-to-pytorch/51186 "2020-12-04T11:44:13Z")

</div>

Hello, Trying to port a written model from pytorch to flux. And I encounter some differences between the two libraries as expected. And wonder how to imitate the original one. While creating deconvolution layers in Pyt…

---

## [\[ANN\] Announcing Torch.jl](https://discourse.julialang.org/t/ann-announcing-torch-jl/42390)

<div class="topic-metadata">

**Author:** [@dhairyagandhi96](https://discourse.julialang.org/u/dhairyagandhi96)\
**Replies:** 14\
**Last updated:** [July 17, 2020, 6:59pm UTC](https://discourse.julialang.org/t/ann-announcing-torch-jl/42390 "2020-07-17T18:59:14Z")

</div>

I am excited to share some new development in the Julia ML stack. We are announcing Torch.jl which wraps the existing PyTorch and its CUDA kernels and makes them available through Julia. Torch.jl also exposes the kernels…
