C3W2 data_generator

Unable to resolve the following error. Need help please

Hi Hajra.

I looks like your mask variable contains ‘object’ type not ‘bool’. You can print() your mask before mask_np_arr to check what are you passing to np.array(mask)

did that, the type is <class, int>

the same error is raised for the batch also. The type is int in both cases

If you print your variables, you should get:

--------------------------------------------------
batch:
[[49, 50, 51, 52, 53, 54, 55, 56, 57, 1], [50, 51, 52, 53, 54, 55, 56, 57, 48, 1]]
batch_np_arr:
[[49 50 51 52 53 54 55 56 57  1]
 [50 51 52 53 54 55 56 57 48  1]]
--------------------------------------------------
mask:
[[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
mask_np_arr
[[1 1 1 1 1 1 1 1 1 1]
 [1 1 1 1 1 1 1 1 1 1]]

yes i get this for batch and mask but the np.array functional call raises error

Please send me your notebook, I will look into it

Thanks. but how do i do that

when I run print(type(mask)) I get <class ‘list’> and with
print(type(mask_np_arr)) I get <class ‘jaxlib.xla_extension.DeviceArray’>

Hi! Have you figured out where was the mistake? I’m also facing this problem

Yes I have completed the course. I can help you on that but unable to recall instantly what the issue was and how it went away. Let me get back to you in a while inshaAllah

The error is caused by inconsistent size of tensors. Check if the tensors in batch have been padded to max_length correctly.

Sir,

I am getting the same error as shown in screenshot.

I am getting the same output as expected.

Kindly help in resolving the issue.

Regards

Hello Hajra

I am getting the same error as yours, how did you resolved it if you can tell.

I am getting the same out as expected.

Thanks

I would be eager to help but I completed this course way back and cant immediately recall what the error was and how it was resolved.

Ok thanks