Builtin training loop

I know that pytorch doesn’t have a builtin fit method like keras, and one should implement it by himself, my question is why? i’ve read somewhere that its implementation in the core would need lots of things, but what are those things?, if you can’t tell in details, plz just give a clear overview with some examples, i really need to understand these so called “obstacles”. Thank you

PyTorch supports various higher-level APIs which provide a fit or similar methods, such as Ignite, Lightning, etc.
You can see the standard training loop e.g. here:

# in your training loop:
optimizer.zero_grad()   # zero the gradient buffers
output = net(input)
loss = criterion(output, target)
optimizer.step()    # Does the update

You can of course wrap it in another method if it’s more convenient for you or just use any higher-level API which would fit your use cases.

Thank you for your reply, but i think i am misunderstood here , i am not asking how to do it, instead, i am referring to the last reply in this thread, please take a look to know what i mean