MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / predict

Function predict

ann_class2/pytorch_example2.py:103–106  ·  view source on GitHub ↗
(model, inputs)

Source from the content-addressed store, hash-verified

101# also encapsulate these steps
102# Note: inputs is a torch tensor
103def predict(model, inputs):
104 inputs = Variable(inputs, requires_grad=False)
105 logits = model.forward(inputs)
106 return logits.data.numpy().argmax(axis=1)
107
108
109# return the accuracy

Callers 1

scoreFunction · 0.70

Calls 1

forwardMethod · 0.45

Tested by

no test coverage detected