Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab 3 Part 2 resampling gives error #124

Open
jt-health-dev opened this issue May 3, 2023 · 2 comments
Open

Lab 3 Part 2 resampling gives error #124

jt-health-dev opened this issue May 3, 2023 · 2 comments

Comments

@jt-health-dev
Copy link

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'

@kennylids
Copy link

image

Same error here. Seems like the team updated the library.

@aamini please help

@fractalclockwork
Copy link

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)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants