MCPcopy
hub / github.com/MrNothing/AI-Blocks / Run

Function Run

Sources/templates/predictor_template.py:16–44  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

14load_path = ""
15
16def Run(self):
17
18 ### defining the model ###
19
20 #input
21 input = tf.placeholder(tf.float32, shape=[None, self._input.input_size], name="x_input")
22
23 #output
24 output = self._model.Run(input)
25
26 #initialize everything
27 instance = AIBlocks.InitModel(load_path=self.load_path)
28 Log("Model initialized!")
29
30 #load test data
31 batch = self._input.getTestBatch()
32 inputs = batch[0]
33 real_categories = batch[1]
34
35 predictions = instance.Run(output, feed_dict={input: inputs})
36
37 for i in range(len(predictions)):
38 estimation = AIBlocks.MaxIndex(predictions[i])
39 real = AIBlocks.MaxIndex(Y_batch[i])
40
41 if(estimation==real):
42 #TODO: Do something here...
43
44 AIBlocks.CloseInstance(instance)

Callers

nothing calls this directly

Calls 5

LogFunction · 0.85
InitModelMethod · 0.80
CloseInstanceMethod · 0.80
RunMethod · 0.45
MaxIndexMethod · 0.45

Tested by

no test coverage detected