• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #include "tensorflow/stream_executor/blas.h"
17 
18 #include "absl/strings/str_cat.h"
19 
20 namespace stream_executor {
21 namespace blas {
22 
TransposeString(Transpose t)23 string TransposeString(Transpose t) {
24   switch (t) {
25     case Transpose::kNoTranspose:
26       return "NoTranspose";
27     case Transpose::kTranspose:
28       return "Transpose";
29     case Transpose::kConjugateTranspose:
30       return "ConjugateTranspose";
31     default:
32       LOG(FATAL) << "Unknown transpose " << static_cast<int32>(t);
33   }
34 }
35 
UpperLowerString(UpperLower ul)36 string UpperLowerString(UpperLower ul) {
37   switch (ul) {
38     case UpperLower::kUpper:
39       return "Upper";
40     case UpperLower::kLower:
41       return "Lower";
42     default:
43       LOG(FATAL) << "Unknown upperlower " << static_cast<int32>(ul);
44   }
45 }
46 
DiagonalString(Diagonal d)47 string DiagonalString(Diagonal d) {
48   switch (d) {
49     case Diagonal::kUnit:
50       return "Unit";
51     case Diagonal::kNonUnit:
52       return "NonUnit";
53     default:
54       LOG(FATAL) << "Unknown diagonal " << static_cast<int32>(d);
55   }
56 }
57 
SideString(Side s)58 string SideString(Side s) {
59   switch (s) {
60     case Side::kLeft:
61       return "Left";
62     case Side::kRight:
63       return "Right";
64     default:
65       LOG(FATAL) << "Unknown side " << static_cast<int32>(s);
66   }
67 }
68 
69 // -- AlgorithmConfig
70 
ToString() const71 string AlgorithmConfig::ToString() const { return absl::StrCat(algorithm_); }
72 
ComputationTypeString(ComputationType ty)73 string ComputationTypeString(ComputationType ty) {
74   switch (ty) {
75     case ComputationType::kF16:
76       return "f16";
77     case ComputationType::kF32:
78       return "f32";
79     case ComputationType::kF64:
80       return "f64";
81     case ComputationType::kI32:
82       return "i32";
83     case ComputationType::kComplexF32:
84       return "complex f32";
85     case ComputationType::kComplexF64:
86       return "complex f64";
87     default:
88       LOG(FATAL) << "Unknown ComputationType " << static_cast<int32>(ty);
89   }
90 }
91 
operator <<(std::ostream & os,ComputationType ty)92 std::ostream& operator<<(std::ostream& os, ComputationType ty) {
93   return os << ComputationTypeString(ty);
94 }
95 
96 }  // namespace blas
97 }  // namespace stream_executor
98