| 957 | } |
| 958 | |
| 959 | memory(): MemoryInfo { |
| 960 | const info = this.backend.memory() as MemoryInfo; |
| 961 | info.numTensors = this.state.numTensors; |
| 962 | info.numDataBuffers = this.state.numDataBuffers; |
| 963 | info.numBytes = this.state.numBytes; |
| 964 | if (this.state.numStringTensors > 0) { |
| 965 | info.unreliable = true; |
| 966 | if (info.reasons == null) { |
| 967 | info.reasons = []; |
| 968 | } |
| 969 | info.reasons.push( |
| 970 | 'Memory usage by string tensors is approximate ' + |
| 971 | '(2 bytes per character)'); |
| 972 | } |
| 973 | return info; |
| 974 | } |
| 975 | |
| 976 | async profile(query: () => (TensorContainer | Promise<TensorContainer>)): |
| 977 | Promise<ProfileInfo> { |