I created myy own model and it's not working inside Learner

(miguel) #1

Hi family.

I’m noob here and this is my first effort programming in pytorch =). Here my code:

And this is what i do later:
learn = Learner(db, model, loss_func = nn.CrossEntropyLoss(), metrics=[error_rate, accuracy])

Then, i do some operation, for instance learn.summary() i got this error:

TypeError: dropout(): argument ‘input’ (position 1) must be Tensor, not numpy.int64

Someone know what’s wrong in my code?
Thanks all

0 Likes

(Rohit Gupta) #2

self.neuronal_block is a sequential network and needs the tensor t not self.flat_fts in self.forward. self.flat_fts is already assigned to nn.Linear inside __init__ and you don’t need to pass it again. Just pass the tensor t = self.neuronal_block(t).

0 Likes