Skip to content

simple example demonstrating ocaml-torch memory leak

Notifications You must be signed in to change notification settings

tlh24/ocaml-torch-leaktest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ocaml-torch-leaktest

simple example demonstrating ocaml-torch memory leak.

Runs a MSE calculation, which compares one image to a database of images. Python equivalent is

dbf = th.randn(image_count, image_res, image_res)
for i in range(30): 
	a = th.randn(image_res, image_res)
	d = th.sum((dbf - a)**2, (1,2))
	mindex = th.argmin(d)
	dist = d[mindex]

Two ways of performing the calculation are provided; both leak memory (to different degrees).

An example run reports has a database size of 29 MB ( 8k 30x30 images), and leaks 1192 MB of memory over 30 runs (950 MB default libtorch -> 2142 MB).

About

simple example demonstrating ocaml-torch memory leak

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published