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

Function predict

ann_class2/pytorch_batchnorm.py:113–120  ·  view source on GitHub ↗
(model, inputs)

Source from the content-addressed store, hash-verified

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

Callers 1

scoreFunction · 0.70

Calls 1

forwardMethod · 0.45

Tested by

no test coverage detected