| 847 | |
| 848 | template <typename SType> |
| 849 | void Tensor::SetValue(const SType x) { |
| 850 | // auto size = Size(); |
| 851 | auto ptr = block_; |
| 852 | |
| 853 | TYPE_LANG_SWITCH(data_type_, DType, device_->lang(), Lang, { |
| 854 | DType tmp = TypeCast<SType, DType>(x); |
| 855 | Tensor &thisRef = *this; |
| 856 | device_->Exec( |
| 857 | [thisRef, tmp](Context *ctx) mutable { |
| 858 | Set<DType, Lang>(tmp, &thisRef, ctx); |
| 859 | }, |
| 860 | {}, {ptr}, "SetValue"); |
| 861 | }); |
| 862 | } |
| 863 | template void Tensor::SetValue<float>(const float x); |
| 864 | template void Tensor::SetValue<half_float::half>(const half_float::half x); |
| 865 | template void Tensor::SetValue<int>(const int x); |
no test coverage detected