4 ms·
Show HN: GoTorch – A Go Implementation of PyTorch
I'm starting to implement a barebones version of pytorch in Go. The primary motivation is:
1. I want to better learn Pytorch and how it works so what better way than to just re-implement some of its core features.
2. I write mainly in Go and haven't come across a lot of ML support in Go
3. I'd rather have a Go ML service instead of spinning up additional infrastructure to just support a python ML service in my Go projects
4. Go's static typing, native concurrency (avoid GIL problem in python), efficient memory management, single binary deployment and more make it a better interface compared to python IMO
Knowing the Pytorch is mainly implemented in c++ and c under the covers, I'm not expecting any performance gains by porting it to Go. But still, will be interesting to see how it compares.
Check it out below and let me know your thoughts!
https://github.com/evisdrenova/gotorch
- thrwwycbr 3y agoHave you seen the gorgonia repos? https://github.com/gorgonia/agogo https://github.com/gorgonia/agogo They basically went a similar route and had to implement all kinds of data types and GPU code to be able to train their alphago model. In go, the biggest pitfall I'd imagine is memory management because you cannot influence the GC. So I'd build up everything with as many references from the start, and integrate it with the pperf tools to be able to benchmark it
- edrenova 3y agoI hadn't seen this before but I did come across this recently (although it seems to be an older project) -> https://github.com/wangkuiyi/gotorch https://github.com/wangkuiyi/gotorch Agreed on the GC issue, going to be doing some perf testing on it and see how it performs. Expecting it won't be as fast as if it was written in C but curious to see the delta.
- waynerad 3y agoWow, this is an amazing idea! I wish I had time to contribute but I'm maxed out. I love Go and I always tell people (everybody who will listen) that one should always use a statically typed, strongly typed language for production code.