You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AttributeError Traceback (most recent call last) in <cell line: 5>()
7 # Get a batch of training data and compute the training step
8 for step, data in enumerate(train_loader):
----> 9 metrics = wrapper.train_step(data)
10 if step % 100 == 0:
11 print(step)
2 frames /usr/local/lib/python3.10/dist-packages/keras/engine/compile_utils.py in match_dtype_and_rank(y_t, y_p, sw)
829 def match_dtype_and_rank(y_t, y_p, sw):
830 """Match dtype and rank of predictions."""
--> 831 if y_t.shape.rank == 1 and y_p.shape.rank == 2:
832 y_t = tf.expand_dims(y_t, axis=-1)
833 if sw is not None:
AttributeError: 'tuple' object has no attribute 'rank'
The text was updated successfully, but these errors were encountered:
Here is a messy workaround for this data type casting issue...
` for step, data in enumerate(train_loader):
x,y = data
xx = [tf.convert_to_tensor(a) for a in x]
yy = [tf.convert_to_tensor(b) for b in y]
xx = tf.convert_to_tensor(xx)
yy = tf.convert_to_tensor(yy)
data = (xx,yy)
metrics = wrapper.train_step(data)`
Starting epoch 1/6
AttributeError Traceback (most recent call last)
in <cell line: 5>()
7 # Get a batch of training data and compute the training step
8 for step, data in enumerate(train_loader):
----> 9 metrics = wrapper.train_step(data)
10 if step % 100 == 0:
11 print(step)
2 frames
/usr/local/lib/python3.10/dist-packages/keras/engine/compile_utils.py in match_dtype_and_rank(y_t, y_p, sw)
829 def match_dtype_and_rank(y_t, y_p, sw):
830 """Match dtype and rank of predictions."""
--> 831 if y_t.shape.rank == 1 and y_p.shape.rank == 2:
832 y_t = tf.expand_dims(y_t, axis=-1)
833 if sw is not None:
AttributeError: 'tuple' object has no attribute 'rank'
The text was updated successfully, but these errors were encountered: