MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / predict

Function predict

ann_class2/pytorch_dropout.py:114–121  ·  view source on GitHub ↗
(model, inputs)

Source from the content-addressed store, hash-verified

112# also encapsulate these steps
113# Note: inputs is a torch tensor
114def predict(model, inputs):
115 # set the model to testing mode
116 # because dropout has 2 different modes!
117 model.eval()
118
119 inputs = Variable(inputs, requires_grad=False)
120 logits = model.forward(inputs)
121 return logits.data.numpy().argmax(axis=1)
122
123
124# return the accuracy

Callers 1

scoreFunction · 0.70

Calls 1

forwardMethod · 0.45

Tested by

no test coverage detected