Add support for creating tensors from lists

This commit is contained in:
Aodhnait Étaín 2020-11-16 00:44:56 +00:00
parent 12d229e502
commit d31a72374d

View file

@ -7,6 +7,8 @@ class Tensor:
# TODO Implement 'requires_grad' functionality.
def __init__(self, value):
# TODO Add support for scalar values.
if isinstance(value, list):
value = np.array(value)
if not isinstance(value, np.ndarray):
print(f"{type(value)} is not compatible with {np.ndarray}")
exit(-1)