# A good way of building neural networks in both Julia and Python

**URL:** <https://discourse.julialang.org/t/a-good-way-of-building-neural-networks-in-both-julia-and-python/72064>\
**Category:** New to Julia\
**Tags:** flux, neural-network\
**Created:** [November 25, 2021, 1:52pm UTC](https://discourse.julialang.org/t/a-good-way-of-building-neural-networks-in-both-julia-and-python/72064 "2021-11-25T13:52:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iHany](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihany/32/18151_2.png) [@iHany](https://discourse.julialang.org/u/iHany)\
**Post date:** [November 25, 2021, 1:52pm UTC](https://discourse.julialang.org/t/a-good-way-of-building-neural-networks-in-both-julia-and-python/72064/1 "2021-11-25T13:52:48Z")

</div>

Hi,  
I’ve built some custom neural networks in Julia (especially, Flux.jl).  
However, for some reason, I wanna use the same neural networks in Python.

In this case, it may be possible to rewrite the neural networks code in Python,  
but it is apparently time-consuming work, and  
I have to modify codes twice every time when I decide to change some parts of networks.

Are there any good ideas to maintain a custom neural network code wisely?

---

<div class="post-metadata">

**Author:** ![GHL](https://avatars.discourse-cdn.com/v4/letter/g/7feea3/32.png) [@GHL](https://discourse.julialang.org/u/GHL)\
**Post date:** [November 25, 2021, 2:08pm UTC](https://discourse.julialang.org/t/a-good-way-of-building-neural-networks-in-both-julia-and-python/72064/2 "2021-11-25T14:08:46Z")

</div>

There is [PyCall.jl](https://github.com/JuliaPy/PyCall.jl) and [pyjulia](https://github.com/JuliaPy/pyjulia), but i guess you are looking for a transpiler, not just a way to call julia from python?

---

<div class="post-metadata">

**Author:** ![iHany](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihany/32/18151_2.png) [@iHany](https://discourse.julialang.org/u/iHany)\
**Post date:** [November 25, 2021, 2:50pm UTC](https://discourse.julialang.org/t/a-good-way-of-building-neural-networks-in-both-julia-and-python/72064/3 "2021-11-25T14:50:53Z")

</div>

I dont know exactly what transpiler is but I didn’t mean to use Python codes in Julia 🙂

---

<div class="post-metadata">

**Author:** ![jstrube](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jstrube/32/525_2.png) [@jstrube](https://discourse.julialang.org/u/jstrube)\
**Post date:** [November 25, 2021, 4:58pm UTC](https://discourse.julialang.org/t/a-good-way-of-building-neural-networks-in-both-julia-and-python/72064/4 "2021-11-25T16:58:56Z")

</div>

You may want to take a look at [PySR](https://github.com/MilesCranmer/PySR), which can be used from python but uses a Julia backend for the computation.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [May 17, 2022, 10:46pm UTC](https://discourse.julialang.org/t/a-good-way-of-building-neural-networks-in-both-julia-and-python/72064/5 "2022-05-17T22:46:14Z")

</div>

The answer might be different for building and using neural networks, and also different than for non-NN code.

In general, you want to choose one language for your main language, for the heavy lifting. That could be Julia (historically C and/or C++ and Fortran). You can basically do everything, including neural networks in Julia only.

I’m not sure if these might be helpful:

> **[Neural Network Exchange Format](https://en.wikipedia.org/wiki/Neural_Network_Exchange_Format)**
>
> Neural Network Exchange Format (NNEF) is an artificial neural network data exchange format developed by the Khronos Group. It is intended to reduce machine learning deployment fragmentation by enabling a rich mix of neural network training tools and inference engines to be used by applications across a diverse range of devices and platforms.
> NNEF was proposed in 2015 by member companies of the Khronos Group as a device and implementation independent transfer format capable of describing any arti...

> [@Triton: GPU Programming for Neural Networks](https://discourse.julialang.org/t/triton-gpu-programming-for-neural-networks/72033):
>
> Any thoughts on OpenAI’s [Triton](https://openai.com/blog/triton/)? @maleadt ?
