| 192 | } |
| 193 | |
| 194 | void TfDriver::ResetTensor(int id) { |
| 195 | if (!IsValid()) return; |
| 196 | auto tensor = input_tensors_[input_names_[id]]; |
| 197 | switch (input_types_[id]) { |
| 198 | case tensorflow::DT_FLOAT: { |
| 199 | FillTensorWithZeros<float>(&tensor); |
| 200 | break; |
| 201 | } |
| 202 | case tensorflow::DT_INT32: { |
| 203 | FillTensorWithZeros<int32_t>(&tensor); |
| 204 | break; |
| 205 | } |
| 206 | default: |
| 207 | Invalidate(absl::StrCat("Unsupported tensor type ", input_types_[id], |
| 208 | tensorflow::DataType_Name(input_types_[id]), |
| 209 | " in ResetInput")); |
| 210 | return; |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | void TfDriver::ReshapeTensor(int id, const string& values_as_string) { |
| 215 | input_shapes_[id] = Split<int64_t>(values_as_string, ","); |