일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- windows forms
- pytorch
- VS Code
- Docker
- C#
- ubuntu
- mysql
- pip
- 프로그래머스
- Python
- 핑거스타일
- JSON
- 기타 연주
- YOLO
- LIST
- 채보
- C++
- pandas
- Numpy
- Selenium
- label
- C
- error
- SSH
- 오류
- Linux
- Visual Studio
- OpenCV
- paramiko
- 컨테이너
- Today
- Total
목록전체 글 (322)
기계는 거짓말하지 않는다
Pytorch 모델 사용 시, 입력 텐서와 가중치 텐서의 데이터 유형이 서로 일치하지 않을 때 발생할 수 있는 오류이다. 아래는 오류 내용들이다. RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same ~ to() method를 이용해 같은 데이터 유형으로 만들어주면 된..
DataFrame에서 조건을 만족하는 행 중 일정 비율 추출하는 예시이다. count가 50보다 작은 행들 중 40% 데이터만 랜덤으로 추출하려면 아래와 같이 할 수 있다. import pandas as pd import random df = pd.read_csv("custom_data.csv", encoding="utf-8") # count가 50보다 큰 행의 인덱스 rows_to_select = df[df["count"] < 50].index print(rows_to_select) print(df.iloc[rows_to_select]) print("-" * 50) # 조건에 맞는 인덱스 중 랜덤하게 40% 추출 rows_to_select = list(rows_to_select) random.seed(..
Tensorflow 2.10 GPU 버전을 사용하였다. keras 모델 fit 함수에서 오류가 발생했다. 아래는 오류 내용이다. tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, tensorflow.python.framework.errors_impl.UnimplementedError: Graph execution error: ... Deterministic GPU implementation of unsorted segment reduction op not available. [[{{node gradient_tape/sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLog..
간단하게 리눅스 쉘 명령어를 사용하고 결과를 확인할 때, 빠르게 확인할 수 있는 사이트이다. 소개된 곳 외에 여러 군데가 더 있는 것으로 알고 있다. JSLinux vi, nano, gcc 등을 편리하게 사용할 수 있었던 사이트는 아래 사이트이다. https://bellard.org/jslinux/ JSLinux JSLinux Run Linux or other Operating Systems in your browser! The following emulated systems are available: CPUOSUserInterfaceVFsyncaccessStartupLinkTEMUConfigComment x86Alpine Linux 3.12.0ConsoleYes click here url x86Alpi..
보통 파일 경로를 읽을 때 발생할 수 있다. 경로 상에 \ (back slash)로 기입되었을 경우 경로 상에 \ (back slash)를 \\ 두번 적어주거나 / (slash)로 바꿔주면 해결할 수 있다. 또는 raw string을 명시해서 해결할 수 있다. # 1 path = "F:\\dir\\AA.txt" # 2 path = "F:\dir\AA.txt" path = path.replace("\\", "/") # 3 path = r"F:\dir\AA.txt"
Linux Bash Shell Script를 작성하고 실행 도중 오류가 나면 다음 명령어를 중지하고 싶을 때, 아래와 같이 작성할 수 있다. #! /bin/bash # set -e 추가 set -e echo "Hello" # Exception 발생하는 C 프로그램 ./hello # 없는 디렉터리 mkdir mkdir aaa/aaaaa echo "Bash Shell Finished" set -e 명령어를 사용하면 명령 실행 도중 오류 시, 스크립트는 중지된다. 반대로 set +e 명령어를 사용하면 오류가 나더라도 그대로 진행한다. 아래는 예시 결과이다. hello.c 코드 #include int main(void) { printf("hello world\n"); int i = 1; i /= 0; retur..
파일을 읽어올 때 '\ufeff' 문자가 가장 앞에 붙는 경우가 있다. 이로 인해 오류가 발생할 수 있다. 파일을 열 때 utf-8-sig 형식을 이용하거나 저장을 할 때 UTF-8 BOM 인코딩이 아닌 UTF-8 형식으로 다시 저장한다. f = open('path', 'r', encoding='utf-8-sig') unicode - u'\ufeff' in Python string - Stack Overflow u'\ufeff' in Python string I got an error with the following exception message: UnicodeEncodeError: 'ascii' codec can't encode character u'\ufeff' in position 155: or..
배열에서 분할 정복을 이용하여 최댓값을 찾는 예시이다. 배열을 왼쪽, 오른쪽 반씩 나누고 왼쪽 반에서 최댓값을 재귀적으로 찾는다. 오른쪽도 마찬가지 방법으로 반복한다. 이렇게 왼쪽, 오른쪽에서 찾은 최댓값을 비교하여 더 큰 값을 최댓값으로 설정한다. 최솟값 찾기는 부호의 방향만 바꾸어주면 된다. #include int find_max_index(int arr[], int left, int right) { if (left == right) // 배열 길이 1 return left; int mid = (left + right) / 2; int left_max_index, right_max_index; left_max_index = find_max_index(arr, left, mid); right_max_i..