From d31a72374dadc273a0d2c59af18fe1096a5f9391 Mon Sep 17 00:00:00 2001 From: aodhneine Date: Mon, 16 Nov 2020 00:44:56 +0000 Subject: [PATCH] Add support for creating tensors from lists --- pygrad/tensor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pygrad/tensor.py b/pygrad/tensor.py index 00d94ec..c01f1f0 100644 --- a/pygrad/tensor.py +++ b/pygrad/tensor.py @@ -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)