Add support for creating tensors from lists
This commit is contained in:
parent
12d229e502
commit
d31a72374d
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue