Experiments

Imitating Latent Policy from Observation

자월현 2020. 12. 11.

1. Conda env rename

stackoverflow.com/questions/50198809/is-it-possible-to-list-environments-of-anaconda-with-dates-of-creation

 

Is it possible to list environments of anaconda *with* dates of creation

If you do conda info --envs you get a list of the environments you create in anaconda Is there a way to do this but to get also the dates of creation of these environments?

stackoverflow.com

 

ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

stable-baselines 2.10.0 requires gym[atari,classic_control]>=0.11, but you'll have gym 0.10.5 which is incompatible.
scipy 1.5.2 requires numpy>=1.14.5, but you'll have numpy 1.14.3 which is incompatible.
opencv-python 3.4.5.20 requires numpy>=1.14.5, but you'll have numpy 1.14.3 which is incompatible.
mkl-fft 1.2.0 requires numpy>=1.16, but you'll have numpy 1.14.3 which is incompatible.

 

2. requirements

numpy==1.14.3
setuptools==36.4.0
tensorflow==1.13.1  new!!
gym==0.10.5
baselines==0.1.5
opencv-python==3.4.5.20  new!!
matplotlib==2.2.2
seaborn==0.8.1

3. 함수들

1) eval(x)

x 안에 들어가는 식을 계산해서 output한다. x에 2+3이 들어가면 5를 output 하는 함수

2) os.path.basename, os.path.splitext

basename은 파일명을 반환하고, splitext는 확장자를 뺀 이름을 반환한다.

참고: chess72.tistory.com/132

 

파이썬 Python - OS.PATH 기초 정리

>>> sys.modules.keys() 현재 세션, 또는 프로그램안에서 사용되는 모든 모듈을 보여준다. >>> sys.getrefcount(object) >>> sys.exc_info() returns a tuple with the latest exception's type, value, and trace..

chess72.tistory.com

3) tensorflow.name_scope

name_scope은 변수 안에 변수가 있고 그 안에 관계가 있는 경우 그걸 묶어주는 함수인 것 같다.

예를 들면 answer = alpha+beta, alpha = a+b 일때, 그걸 해주는..? 참고: kamang-it.tistory.com/entry/Tensorflow-07-Name-Scope

 

4) python에서 *와 **

*는 argument를 tuple로 다 받아오는 것, **는 argument를 dictionary 형태로 받아오는 것인듯.

그래서 for item in *args: 라고 쓸 수 있고, for key, value in **kwargs.items(): 라고 할 수 있는듯 하다.

 

5) setattr()

setattr(object, name, value) 는, object.name = value와 유사하다고 보면 된다. 

 

6) tf.train.shuffle_batch()는 www.tensorflow.org/api_docs/python/tf/compat/v1/train/shuffle_batch

paths_batch, inputs_batch, targets_batch = tf.train.shuffle_batch(
[paths, inputs, targets],
batch_size=args.batch_size,
num_threads=1,
enqueue_many=True,  여러개의 example이 input으로 들어가는지 하나인지를 말한다.
capacity=num_samples,
min_after_dequeue=1000)  dequeue 후 남는 최소 수라고 한다. 이게 클수록 shuffle이 많이 된다고.

7) tf.summaray 

scalar 또는 histogram으로 내가 tensorboard에서 보고 싶은 변수를 지정할 수 있다. 

 

8) tf.trainable_variables

이건 어떻게 세팅하는건가? 그냥 tensor면 다 되는건지, 초기에 만들때 tf.Variables로 만들어야 되는건지, tf. function안에 있으면 다 되는건지..?

 

9) tf GPU 탄력적 운영:

goodtogreate.tistory.com/entry/TensorFlow%EB%A5%BC-%EA%B3%B5%EC%9A%A9-GPU%EC%97%90%EC%84%9C-%EC%82%AC%EC%9A%A9-%ED%95%A0-%EB%95%8C-%EB%A9%94%EB%AA%A8%EB%A6%AC-%EC%A0%88%EC%95%BD-%EB%B0%A9%EB%B2%95

 

TensorFlow를 공용 GPU에서 사용 할 때 메모리 절약 방법

TensorFlow를 공용 GPU에서 사용 할 때 메모리 절약 방법 절대적 메모리 uppeor bound 설정 tf.Session 생성 할 때 GPU memory allocation을 지정할 수 있다. 이것을 위해서 tf.GPUOptions 에 config 부분을 아래..

goodtogreate.tistory.com

10) tf.session.run() - tensorflowkorea.gitbooks.io/tensorflow-kr/content/g3doc/api_docs/python/client.html

tf global_step은 checkpoint 저장하는 step 인듯!

 

11) tf-slim은 CNN을 더 간편하게 구현하는 library이다. 

github.com/google-research/tf-slim/blob/master/README.md

 

12) name_scope, variable_scope, arg_scope

group을 만드는 것과 같다. 

name_scope, variable_scope 모두 '길드'라고 보면 편하다. 동일한 이름의 변수가 있어도, 길드가 다르면 다른 변수로 취급하기 쉽듯, scope이 다르면 다른 변수로 디버깅 하기 편하다.

arg_scope은 tf-slim에 등장하는 개념인데, 이것 역시 'python class처럼 상속될경우 같은 함수, 변수를 공유'하는 것과 유사한 개념이라고 생각하면 된다. 동일한 argument를 공유할 경우 한 arg_scope에 있으면, 그 argument가 상속되어 내려오고, 밑에서 다시 overwrite 할수 있다.

 

13) epoch은 그 training data를 모두 한번씩 학습시킬때까지를 1 epoch이라고 한다.

m.blog.naver.com/qbxlvnf11/221449297033

 

14) tf.expand_dims m.blog.naver.com/PostView.nhn?blogId=wideeyed&logNo=221164750517&proxyReferer=https:%2F%2Fwww.google.com%2F

내가 정해주는 axis에 dimension을 하나 늘려준다. 

(2,2) 인데 axis 1에 대해 늘리면, (2,1,2) 가 된다. 

 

15) tf.stop_gradient 

- 두개의 network가 연결되어 있는데, 학습을 따로 진행하고 싶을때 하나의 parameter를 freeze하는 함수이다.

 

16) tf.tile 약간 stack처럼 쌓는건데, 동일한 matrix를 복제하여 쌓는다. 

tf.tile(a, [13]) 은 a를 13번 가로로 붙이는 것이다. [a a a ...] 같이!

 

17) tf. identity()

음 백프로 이해 못했는데, 그 tensor에 대한 reference를 update해야할 때 쓰는 것이라고 한다.

stackoverrun.com/ko/q/9614307

 

TensorFlow에서 tf.identity는 무엇에 사용됩니까?

공식 CIFAR-10 자습서 및 stackoverflow의 배치 정규화 구현과 같이 일부 장소에서 tf.identity이 사용 된 것을 보았습니다.하지만 왜 필요한지 알 수 없습니다. 무엇에 사용됩니까? 누구든지 유스 케이스

stackoverrun.com

18) tf.reset_default_graph()

실험이나 그전거 필요없이 뭔가 다시 시작할때 reset하는 용도로 쓴다고 한다.

 

19) mujoco rendering 관련

wiki.dong-min.kim/view/%EB%8D%94%EB%9F%AC%EC%9A%B4_mujoco_%ED%99%98%EA%B2%BD_%EC%9E%A1%EA%B8%B0

댓글