MCPcopy Create free account
hub / github.com/apache/singa / SetValue

Method SetValue

src/core/tensor/tensor.cc:849–862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847
848template <typename SType>
849void 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}
863template void Tensor::SetValue<float>(const float x);
864template void Tensor::SetValue<half_float::half>(const half_float::half x);
865template void Tensor::SetValue<int>(const int x);

Callers 15

Sum<float>Function · 0.45
SumAllFunction · 0.45
AddColumnFunction · 0.45
AddRowFunction · 0.45
SumColumnsFunction · 0.45
SumRowsFunction · 0.45
GpuRNNForwardInferenceFunction · 0.45
GpuRNNForwardTrainingFunction · 0.45
GpuRNNBackwardxFunction · 0.45
GpuRNNBackwardWFunction · 0.45
init_param_mappingMethod · 0.45
GpuRNNBackwardxExFunction · 0.45

Calls 2

langMethod · 0.80
ExecMethod · 0.80

Tested by

no test coverage detected