(metadata)
| 18955 | return this.parseTensorFromMetadata(ivalue.val); |
| 18956 | } |
| 18957 | parseTensorFromMetadata(metadata) { |
| 18958 | if (metadata.quantized_schema) { |
| 18959 | throw new torch.Error('Quantized schema not implemented.'); |
| 18960 | } |
| 18961 | const index = metadata.storage_location_index; |
| 18962 | const data = this._module.storage_data[index].data; |
| 18963 | const dtype = this._dtypes.get(metadata.scalar_type); |
| 18964 | const size = data.length / dtype.itemsize(); |
| 18965 | const storage = new torch.storage.TypedStorage(size, dtype); |
| 18966 | storage._set_cdata(data); |
| 18967 | const tensor = new torch.Tensor(); |
| 18968 | const shape = Array.from(metadata.sizes); |
| 18969 | const stride = Array.from(metadata.strides); |
| 18970 | tensor.__setstate__([storage, metadata.storage_offset, shape, stride]); |
| 18971 | return tensor; |
| 18972 | } |
| 18973 | parseObject(ivalue) { |
| 18974 | const object = ivalue.val; |
| 18975 | const obj_type = this._module.object_types[object.type_index]; |
no test coverage detected