# PyTorch入門 :::spoiler {state=open}<h5>by</h5> >林侑辰 ---- ## 簡介 此課程會用5堂課帶大家逐步入門PyTorch `注意`:因為是入門所以並不適合PyTorch或是人工智慧領域的高手來上課 ---- ## [python快速教學](https://www.youtube.com/watch?v=7R0OjgLYGuw) + 資料型態 ```python= x=1 #int整數 y=2.5 #float浮點數 z="hi" #string字串 a=True #bool布林值 ``` + Print ```python= print("Hello World") ``` 輸出結果:Hello World ---- ## if、elif、else ```python= if x>1: print('hi') elif x<0: print(123) else: print("0<x<1") ``` ---- ### 運算子 + 加減乘除 : `+ - * /` + 求餘數 : `%` 例如 : `5 % 2 = 1` + 求商: `a//b` + 指數: `a**b` + 小、大於等於 : `<=、>=` + 不等於 : `!=` + 相等: `==` ---- ## For/While 迴圈 ```python= for i in range(3): print(1) ``` ```python= i=0 while i<3: print(i) i += 1 #相當於 i=i+1 ``` ---- ## 函式 ```python= def hi(): print("hi") def count(x,y): sum = x+y return sum hi() count(1,2) ``` ---- ## Class ```python= class Test: def __init__(self,number): self.number = number def get_number(self): return self.number ```
{"description":"需要先學會python","title":"PyTorch入門 0","contributors":"[{\"id\":\"0007669a-47f5-43b3-9d2c-38fa9230ec81\",\"add\":1135,\"del\":128}]"}
    122 views