본문 바로가기

TF에서 gradient 정보를 바로 활용하기 만약 TF computational graph에 custom function과 custom gradient를 넣고 싶으면 어떻게 해야할까? 아래 gist에 해당 내용을 정리해보았다. https://gist.github.com/sjchoi86/01d8957cfdeb39d55e7dd42e8836b2ab 결국 TF 문법이 어려웠던 것인데, 기본적인 tf.py_func은 gradient가 None이 되어서, 만약 forward path만 신경을 쓰고 싶을 때 사용하면 편한 것 같아요. 특히나 graph에 있는 tf Tensor를 sess.run 등으로 뺴오지 않아고 py_func으로 처리를 하면 해당 함수 안에서는 ndarray가 되거든요. 만약에 gradient도 custom으로 주고 싶다면 tf.Regist.. 더보기
GIT hard pull git fetch --all git reset --hard origin/master https://stackoverflow.com/questions/1125968/how-do-i-force-git-pull-to-overwrite-local-files 요 위의 두 줄이면 된다. 1. get fetch -all 이건 remote에서 가장 최근의 것을 일단 받기만 한다. merge나 rebase를 안한다고 하니, 어떤 문제를 일으키지도 않는다. 2. git reset --hard origin/master 앞서서 fetch한 버젼 위에 origin/master에 있는 내용으로 reset을 한다. --hard 옵션을 넣었기 때문에 다른 문제가 생길 소지 (locally changed)를 고려하지 않는다. 더보기
Point Process in a Ball Consdier a binomial point process (BPP) where n points are uniformly sampled with a d-dimensional ball of radius R centered at the origin. We want to know about the euclidean distance from the origin to its m-th nearest point. The special case of m=1 will be the shortest distrance from the origin. The distribution of the distance of the m-th nearest point follows a generalized beta distribution:.. 더보기
Mesh format convert to stl 메쉬의 포맷을 바꾸는 것은 아주 중요하다. 제일 기본이 되는 것은 언제나 stl (stereolithography)이고, 나도 이걸 좋아한다. DAE는 쓸때없는 cover랑 scene이 들어가있어서 parsing이 잘 안된다. OBJ도 마찬가지다. 온라인에는 수많은 컨버터가 있는데 오프라인으로 쓸 수 있는걸 찾다보니까 http://openctm.sourceforge.net/ 요게 나온다. 소스만 있다. 소스를 받는다. OS에 맞는 Makefile.os의 이름을 Makefile로 바꾸고 make를 한다. 그러면 된다. 아주 간단하다. 대신에 이를 위해서 brew를 죄다 다시 컴파일 하느라 엄청난 시간이 걸렸다. 모 원래 그렇단다. 받고 나면 아주 간단하다. ctmconv A.obj A.stl 혹은 ctmc.. 더보기