MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ConvertToHalfValue

Function ConvertToHalfValue

tensorflow/c/quantize_embedding_variable.cc:77–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void ConvertToHalfValue(const Tensor& in_tensor, const string name,
78 BundleWriter& writer) {
79 auto in_data = in_tensor.flat<float>();
80 Tensor out_tensor(DataTypeToEnum<Eigen::half>::v(), in_tensor.shape());
81 auto out_data = out_tensor.flat<Eigen::half>();
82#if INTEL_MKL
83#pragma omp parallel for num_threads(omp_get_num_procs())
84#endif // INTEL_MKL
85 for (size_t i = 0; i < out_tensor.NumElements(); ++i) {
86 out_data(i) = static_cast<Eigen::half>(in_data(i));
87 }
88 writer.Add(name, out_tensor);
89}
90
91void ConvertToInt8Value(const Tensor& in_tensor, const string name,
92 const string scale_name, BundleWriter& writer) {

Callers 1

Calls 3

shapeMethod · 0.45
NumElementsMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected