Bihaqo / t3f

Tensor Train decomposition on TensorFlow
https://t3f.readthedocs.io/en/latest/index.html
MIT License
219 stars 55 forks source link

Integer overflow in shapes #128

Closed rborrelli closed 6 years ago

rborrelli commented 6 years ago

Hi all, I am probably doing something wrong but a simple testing of creation of a zero TT matrix with the following code returns an error probably due to an integer overflow

`import t3f

b = [2, 40, 32, 20, 12, 8, 4, 24, 8, 8, 8, 24, 4, 24, 6, 20, 6, 6, 4, 80, 20, 72, 6, 32, 6] hshape = [b,b] X = t3f.initializers.matrix_zeros(hshape) print(X)`

Running the code gives: the error

File "", line 1, in File "/opt/anaconda2/lib/python2.7/site-packages/t3f/tensor_train.py", line 103, in str shape = self.get_shape() File "/opt/anaconda2/lib/python2.7/site-packages/t3f/tensor_train_base.py", line 49, in get_shape return tf.TensorShape((m, n)) File "/opt/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_shape.py", line 458, in init self._dims = [as_dimension(d) for d in dims_iter] File "/opt/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_shape.py", line 399, in as_dimension return Dimension(value) File "/opt/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_shape.py", line 39, in init raise ValueError("Dimension %d must be >= 0" % self._value) ValueError: Dimension -2305843009213693952 must be >= 0

Bihaqo commented 6 years ago

41

Will fix it soon

Bihaqo commented 6 years ago

BTW, no need to import modules individually, you can just do t3f.matrix_zeros instead of t3f.initializers.matrix_zeros

Bihaqo commented 6 years ago

129