2024-05-06 13:23:22 -03:00
|
|
|
from norch.tensor import Tensor
|
2024-05-25 10:53:09 -03:00
|
|
|
from norch.utils import functions
|
2024-05-06 01:21:18 -03:00
|
|
|
import random
|
|
|
|
|
|
|
|
|
|
class Parameter(Tensor):
|
|
|
|
|
"""
|
|
|
|
|
A parameter is a trainable tensor.
|
|
|
|
|
"""
|
|
|
|
|
def __init__(self, shape):
|
2024-05-25 10:53:09 -03:00
|
|
|
data = functions.generate_random_list(shape=shape)
|
2024-05-06 01:21:18 -03:00
|
|
|
super().__init__(data, requires_grad=True)
|