kiwigrad
1.0.0

แม้จะไม่มีความสามารถในการบินผ่านท้องฟ้าอย่าง Pytorch และ Tensorflow แต่ Kiwigrad ยังคงเป็นนกที่น่าเกรงขามที่เต็มไปด้วยศักยภาพที่ไม่ได้รับการรอคอย
Kiwigrad? ใช่มันเป็น micrograd อีกรุ่นที่สร้างขึ้นเพื่อความสนุกสนานและการทดลอง
เพื่อติดตั้งรีลีสปัจจุบัน
pip install kiwigrad==0.28 Kiwigrad เป็น Micrograd และแพ็คเกจ Minigrad ที่มีคุณสมบัติเพิ่มเติม คุณสมบัติหลักที่เพิ่มเข้ามาใน Kiwigrad คือ:
from kiwigrad import MLP , Layer
class PotNet ( MLP ):
def __init__ ( self ):
layers = [
Layer ( nin = 2 , nout = 16 , bias = True , activation = "relu" ),
Layer ( nin = 16 , nout = 16 , bias = True , activation = "relu" ),
Layer ( nin = 16 , nout = 1 , bias = True , activation = "linear" )
]
super (). __init__ ( layers = layers )
model = PotNet () from kiwigrad import Value , draw_dot
a = Value ( - 4.0 )
b = Value ( 2.0 )
c = a + b
d = a * b + b ** 3
c += c + Value ( 1. )
c += Value ( 1. ) + c + ( - a )
d += d * Value ( 2 ) + ( b + a ). relu ()
d += Value ( 3. ) * d + ( b - a ). relu ()
e = c - d
f = e ** 2
g = f / Value ( 2.0 )
g += Value ( 10.0 ) / f
print ( f' { g . data :.4f } ' ) # prints 24.7041, the outcome of this forward pass
g . backward ()
print ( f' { a . grad :.4f } ' ) # prints 138.8338, i.e. the numerical value of dg/da
print ( f' { b . grad :.4f } ' ) # prints 645.5773, i.e. the numerical value of dg/db
draw_dot ( g ) cd test
pytest .