(self, obj)
| 49 | """Special json encoder for numpy types.""" |
| 50 | |
| 51 | def default(self, obj): |
| 52 | if isinstance(obj, (np.int_, np.intc, np.intp, np.int8, np.int16, np.int32, |
| 53 | np.int64, np.uint8, np.uint16, np.uint32, np.uint64)): |
| 54 | return int(obj) |
| 55 | elif isinstance(obj, (np.float16, np.float32, np.float64)): |
| 56 | return float(obj) |
| 57 | elif isinstance(obj, (np.ndarray,)): # This is the fix |
| 58 | return obj.tolist() |
| 59 | return json.JSONEncoder.default(self, obj) |
| 60 | |
| 61 | |
| 62 | def wikimovie_eval_fn(dataset, results, name_map, output_prediction_file, |
nothing calls this directly
no outgoing calls
no test coverage detected