(self)
| 135 | self.assertEqual((0., 0.), output_details[0]['quantization']) |
| 136 | |
| 137 | def testString(self): |
| 138 | with ops.Graph().as_default(): |
| 139 | in_tensor = array_ops.placeholder(shape=[4], dtype=dtypes.string) |
| 140 | out_tensor = array_ops.reshape(in_tensor, shape=[2, 2]) |
| 141 | sess = session.Session() |
| 142 | |
| 143 | # Convert model and ensure model is not None. |
| 144 | converter = lite.TFLiteConverter.from_session(sess, [in_tensor], |
| 145 | [out_tensor]) |
| 146 | tflite_model = converter.convert() |
| 147 | self.assertTrue(tflite_model) |
| 148 | |
| 149 | # Check values from converted model. |
| 150 | interpreter = Interpreter(model_content=tflite_model) |
| 151 | interpreter.allocate_tensors() |
| 152 | |
| 153 | input_details = interpreter.get_input_details() |
| 154 | self.assertEqual(1, len(input_details)) |
| 155 | self.assertEqual('Placeholder', input_details[0]['name']) |
| 156 | self.assertEqual(np.string_, input_details[0]['dtype']) |
| 157 | self.assertTrue(([4] == input_details[0]['shape']).all()) |
| 158 | |
| 159 | output_details = interpreter.get_output_details() |
| 160 | self.assertEqual(1, len(output_details)) |
| 161 | self.assertEqual('Reshape', output_details[0]['name']) |
| 162 | self.assertEqual(np.string_, output_details[0]['dtype']) |
| 163 | self.assertTrue(([2, 2] == output_details[0]['shape']).all()) |
| 164 | # TODO(b/122659643): Test setting/getting string data via the python |
| 165 | # interpreter API after support has been added. |
| 166 | |
| 167 | def testQuantization(self): |
| 168 | with ops.Graph().as_default(): |
nothing calls this directly
no test coverage detected