Skip to content

Commit 1692dfe

Browse files
committed
Fixes created by running the full test suite.
1 parent 90f8e05 commit 1692dfe

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

pyttb/tensor.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ def __init__(
136136
assert False, "Empty tensor cannot contain any elements"
137137

138138
elif prod(shape) != data.size:
139-
assert (
140-
False
141-
), "TTB:WrongSize, Size of data does not match specified size of tensor"
139+
assert False, (
140+
"TTB:WrongSize, Size of data does not match specified size of tensor"
141+
)
142142

143143
# Make sure the data is indeed the right shape
144144
if data.size > 0 and len(shape) > 0:
@@ -1607,9 +1607,9 @@ def ttt(
16071607
othershape = tuple(np.array(other.shape)[otherdims])
16081608

16091609
if np.any(selfshape != othershape):
1610-
assert (
1611-
False
1612-
), f"Specified dimensions do not match got {selfshape} and {othershape}"
1610+
assert False, (
1611+
f"Specified dimensions do not match got {selfshape} and {othershape}"
1612+
)
16131613

16141614
# Compute the product
16151615

@@ -1846,9 +1846,9 @@ def tenfun(
18461846
ttb.sumtensor,
18471847
),
18481848
):
1849-
assert (
1850-
False
1851-
), f"Invalid input to ten fun: {an_input} of type {type(an_input)}"
1849+
assert False, (
1850+
f"Invalid input to ten fun: {an_input} of type {type(an_input)}"
1851+
)
18521852
input_tensors.append(self._tt_to_tensor(an_input))
18531853

18541854
# Case II: Expects input to be matrix and applies operation on each columns
@@ -1927,9 +1927,9 @@ def tenfun_unary(
19271927
if isinstance(an_input, (float, int)):
19281928
assert False, f"Argument {i} is a scalar but expected a tensor"
19291929
elif sz != an_input.shape:
1930-
assert (
1931-
False
1932-
), f"Tensor {i} is not the same size as the first tensor input"
1930+
assert False, (
1931+
f"Tensor {i} is not the same size as the first tensor input"
1932+
)
19331933
if len(inputs) == 0:
19341934
X = self.data
19351935
X = np.reshape(X, (1, -1), order=self.order)
@@ -2013,9 +2013,9 @@ def __setitem__(self, key, value):
20132013
def _set_linear(self, key, value):
20142014
idx = key
20152015
if not isinstance(idx, slice) and (idx > np.prod(self.shape)).any():
2016-
assert (
2017-
False
2018-
), "TTB:BadIndex In assignment X[I] = Y, a tensor X cannot be resized"
2016+
assert False, (
2017+
"TTB:BadIndex In assignment X[I] = Y, a tensor X cannot be resized"
2018+
)
20192019
if isinstance(key, (int, float, np.generic)):
20202020
idx = np.array([key])
20212021
elif isinstance(key, slice):

0 commit comments

Comments
 (0)