Data is ___ !
article thumbnail
[Pytorch] 모듈 및 함수 정리
Programming/Python 2023. 1. 15. 19:17

계속 업데이트 예정 ✨ 🔎 모듈nn.Parameter>>> self.cls_token = nn.Parameter(torch.randn(1, latent_vec_dim))>>> self.pos_embedding = nn.Parameter(torch.randn(1, num_patches+1, latent_vec_dim))모델을 업데이트 할 때 같이 업데이트 되는 변수사용자로부터 직접 받는 값은 아니지만 학습이 가능해야 하는 변수가 필요하다면 위와 같이 파라미터로 정의ViT에서 cls_token, pos_embedding은 외부 변수가 아니지만 latent_vec_dim, num_patches를 이용해서 만들어 사용해야 한다. 🔎 함수torch.repeat( ) vs torch.expand( )1..

article thumbnail
[Pytorch] 파이토치에서 모델 출력하기
Programming/Python 2023. 1. 3. 15:13

💡 모델 구조 출력간단하게 모델 구조 출력그냥 내가 만들어 놓은 (모델)클래스 이름을 print하면 된다. torchsummary 라이브러리 ! pip install torchsummarysummary(model, input_size = (channels, H, W))inpust_size를 넣어서 output shape와 parameter 수 확인 가능단, 모델 클래스에서 def __init__() 안에 self 말고 다른 파라미터가 있다면 그 값이 뭔지 정의해 주어야 한다.ex) input_shape = (3, 256, 256), num_rersidual_blocks=9 처럼 pytorch_model_summary 라이브러리! pip install pytorch-model-summarys..

profile on loading

Loading...