Skip to content

Commit

Permalink
Merge 915af7c into b9694eb
Browse files Browse the repository at this point in the history
  • Loading branch information
Bihaqo authored Dec 28, 2020
2 parents b9694eb + 915af7c commit 45c6285
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 423 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
dist: trusty
language: python
python:
- "3.5"
- "3.6"
env:
matrix:
- TF_VERSION=1.15.2
- TF_VERSION=2.0
- TF_VERSION=2.4.0
# command to install dependencies
install:
- pip install --upgrade pip
- pip install tensorflow==$TF_VERSION
- pip install coveralls
script:
# Run eager and no-eager tests separately.
- nosetests t3f/*_no_eager_test.py --logging-level=WARNING --with-coverage --cover-package=t3f
- nosetests -e='*no_eager*' --logging-level=WARNING --with-coverage --cover-package=t3f
- nosetests --logging-level=WARNING --with-coverage --cover-package=t3f
after_success:
coveralls
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Installation
============

T3f assumes you have Python 3.5 or 3.6 and a working TensorFlow installation (tested versions are from 1.15.2 to 2.0, see here_ for TF installation instructions).
T3f assumes you have Python 3.6 and a working TensorFlow installation (tested with TF 2.4, see here_ for TF installation instructions).

.. _here: https://www.tensorflow.org/install/

Expand Down
2 changes: 1 addition & 1 deletion docs/requirement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# tf is necessary for building the docs with readthedocs.org: they fetch a fresh
# version of the library on each build and it doesn't import properly without
# tensorflow being installed.
tensorflow>=1.15.2,<=2.0
tensorflow>=2.4,<=2.4
ipykernel
nbsphinx
47 changes: 0 additions & 47 deletions t3f/batch_ops_no_eager_test.py

This file was deleted.

43 changes: 0 additions & 43 deletions t3f/decompositions_no_eager_test.py

This file was deleted.

26 changes: 13 additions & 13 deletions t3f/initializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def tensor_ones(shape, dtype=tf.float32, name='t3f_tensor_ones'):
shape = np.array(shape)
_validate_input_parameters(is_tensor=True, shape=shape)
num_dims = shape.size
tt_rank = np.ones(num_dims + 1)
tt_rank = np.ones(num_dims + 1, dtype=np.int)

with tf.name_scope(name):
tt_cores = num_dims * [None]
Expand All @@ -110,7 +110,7 @@ def tensor_zeros(shape, dtype=tf.float32, name='t3f_tensor_zeros'):
shape = np.array(shape)
_validate_input_parameters(is_tensor=True, shape=shape)
num_dims = shape.size
tt_rank = np.ones(num_dims + 1)
tt_rank = np.ones(num_dims + 1, dtype=np.int)
tt_cores = num_dims * [None]
with tf.name_scope(name):
for i in range(num_dims):
Expand Down Expand Up @@ -138,7 +138,7 @@ def eye(shape, dtype=tf.float32, name='t3f_eye'):
_validate_input_parameters(is_tensor=True, shape=shape)

num_dims = shape.size
tt_ranks = np.ones(num_dims + 1)
tt_ranks = np.ones(num_dims + 1, dtype=np.int)

with tf.name_scope(name):
tt_cores = num_dims * [None]
Expand Down Expand Up @@ -182,7 +182,7 @@ def matrix_ones(shape, dtype=tf.float32, name='t3f_matrix_ones'):
_validate_input_parameters(is_tensor=False, shape=shape)

num_dims = shape[0].size
tt_rank = np.ones(shape[0].size + 1)
tt_rank = np.ones(shape[0].size + 1, dtype=np.int)

with tf.name_scope(name):
tt_cores = [None] * num_dims
Expand Down Expand Up @@ -224,7 +224,7 @@ def matrix_zeros(shape, dtype=tf.float32, name='t3f_matrix_zeros'):

_validate_input_parameters(is_tensor=False, shape=shape)
num_dims = shape[0].size
tt_rank = np.ones(shape[0].size + 1)
tt_rank = np.ones(shape[0].size + 1, dtype=np.int)

with tf.name_scope(name):
tt_cores = [None] * num_dims
Expand Down Expand Up @@ -261,7 +261,7 @@ def tensor_with_random_cores(shape, tt_rank=2, mean=0., stddev=1.,
_validate_input_parameters(is_tensor=True, shape=shape, tt_rank=tt_rank)
num_dims = shape.size
if tt_rank.size == 1:
tt_rank = tt_rank * np.ones(num_dims - 1)
tt_rank = tt_rank * np.ones(num_dims - 1, dtype=np.int)
tt_rank = np.insert(tt_rank, 0, 1)
tt_rank = np.append(tt_rank, 1)

Expand Down Expand Up @@ -304,7 +304,7 @@ def tensor_batch_with_random_cores(shape, tt_rank=2, batch_size=1,
batch_size=batch_size)
num_dims = shape.size
if tt_rank.size == 1:
tt_rank = tt_rank * np.ones(num_dims - 1)
tt_rank = tt_rank * np.ones(num_dims - 1, dtype=np.int)
tt_rank = np.insert(tt_rank, 0, 1)
tt_rank = np.append(tt_rank, 1)
tt_rank = tt_rank.astype(int)
Expand Down Expand Up @@ -359,7 +359,7 @@ def matrix_with_random_cores(shape, tt_rank=2, mean=0., stddev=1.,

num_dims = shape[0].size
if tt_rank.size == 1:
tt_rank = tt_rank * np.ones(num_dims - 1)
tt_rank = tt_rank * np.ones(num_dims - 1, dtype=np.int)
tt_rank = np.concatenate([[1], tt_rank, [1]])

tt_rank = tt_rank.astype(int)
Expand Down Expand Up @@ -417,7 +417,7 @@ def matrix_batch_with_random_cores(shape, tt_rank=2, batch_size=1,
batch_size=batch_size)
num_dims = shape[0].size
if tt_rank.size == 1:
tt_rank = tt_rank * np.ones(num_dims - 1)
tt_rank = tt_rank * np.ones(num_dims - 1, dtype=np.int)
tt_rank = np.concatenate([[1], tt_rank, [1]])
shape = shape.astype(int)
tt_rank = tt_rank.astype(int)
Expand Down Expand Up @@ -522,7 +522,7 @@ def random_tensor(shape, tt_rank=2, mean=0., stddev=1., dtype=tf.float32,

num_dims = shape.size
if tt_rank.size == 1:
tt_rank = tt_rank * np.ones(num_dims - 1)
tt_rank = tt_rank * np.ones(num_dims - 1, dtype=np.int)
tt_rank = np.insert(tt_rank, 0, 1)
tt_rank = np.append(tt_rank, 1)

Expand Down Expand Up @@ -580,7 +580,7 @@ def random_tensor_batch(shape, tt_rank=2, batch_size=1, mean=0., stddev=1.,
batch_size=batch_size)
num_dims = shape.size
if tt_rank.size == 1:
tt_rank = tt_rank * np.ones(num_dims - 1)
tt_rank = tt_rank * np.ones(num_dims - 1, dtype=np.int)
tt_rank = np.insert(tt_rank, 0, 1)
tt_rank = np.append(tt_rank, 1)
tt_rank = tt_rank.astype(int)
Expand Down Expand Up @@ -647,7 +647,7 @@ def random_matrix(shape, tt_rank=2, mean=0., stddev=1.,

num_dims = shape[0].size
if tt_rank.size == 1:
tt_rank = tt_rank * np.ones(num_dims - 1)
tt_rank = tt_rank * np.ones(num_dims - 1, dtype=np.int)
tt_rank = np.concatenate([[1], tt_rank, [1]])

tt_rank = tt_rank.astype(int)
Expand Down Expand Up @@ -718,7 +718,7 @@ def random_matrix_batch(shape, tt_rank=2, batch_size=1, mean=0., stddev=1.,
batch_size=batch_size)
num_dims = shape[0].size
if tt_rank.size == 1:
tt_rank = tt_rank * np.ones(num_dims - 1)
tt_rank = tt_rank * np.ones(num_dims - 1, dtype=np.int)
tt_rank = np.concatenate([[1], tt_rank, [1]])

shape = shape.astype(int)
Expand Down
Loading

0 comments on commit 45c6285

Please sign in to comment.