These ops are not pinnable since they generate data. It can be slower to generate and then copy the data instead of just generating the data on the device directly.
| 795 | // generate and then copy the data instead of just generating the data on the |
| 796 | // device directly. |
| 797 | bool IsPinnableOp(const string& op_type) { |
| 798 | static const gtl::FlatSet<string>* unpinnable_ops = new gtl::FlatSet<string>({ |
| 799 | "RandomUniform", |
| 800 | "RandomUniformInt", |
| 801 | "RandomStandardNormal", |
| 802 | "StatelessRandomUniform", |
| 803 | "StatelessRandomUniformInt", |
| 804 | "StatelessRandomNormal", |
| 805 | }); |
| 806 | |
| 807 | // XRT ops refer to per-device handles that are not safe to move between |
| 808 | // devices. |
| 809 | return unpinnable_ops->find(op_type) == unpinnable_ops->end() && |
| 810 | !absl::StartsWith(op_type, "XRT"); |
| 811 | } |
| 812 | |
| 813 | // The Op device may be updated if: |
| 814 | // - A resource touching input is specified: all resource-touching ops run in |
no test coverage detected