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

TypeError: 'Tensor' object is not callable #837

Open
hasan-svg opened this issue Feb 24, 2024 · 2 comments
Open

TypeError: 'Tensor' object is not callable #837

hasan-svg opened this issue Feb 24, 2024 · 2 comments

Comments

@hasan-svg
Copy link

torch.manual_seed(42)

An epoch is one loop through the data...

epochs=1

Training

1. Loop through the data

for epoch in range(epochs):
# Set the model to train mode
model_0.train() # turn on gradient requires gradient

# 2. Forward pass
y_preds = model_0(x_train)

# 3. Calculate the loss
loss = loss_fn(y_preds,y_train)
print(f"Loss: {loss}")

# 4. Optimize zero grad
optimizer.zero_grad()
# 5. Perform backpropagartion on the loss with respect to the parameters of the model
loss.backward()
# 6. set the optimizer
optimizer.step()
# Testing
model_0.eval() # turn off gradient
@Bandi-Saideva-Goud
Copy link

If you can paste whole cell code and complete error, it is easy to help

@bofcarbon1
Copy link

I received this error a couple of times. Without more details difficult to pinpoint. When I got the errors most of the time the problem was with a conflicting 'type' Could be the way arguments/parameters are passed between functions. By default the objects created may have a type of 'any' which work in most cases but not in functions that are particular about a specific type. For example a transform result passed into another tool function may result in an not callable object due to the 'type' conflict in one of the parameters.

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