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

Function MakeLinspaceArray2D

tensorflow/compiler/xla/array2d.h:101–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99// with dimensions n1 x n2.
100template <typename NativeT = float>
101std::unique_ptr<Array2D<NativeT>> MakeLinspaceArray2D(double from, double to,
102 int64 n1, int64 n2) {
103 auto array = absl::make_unique<Array2D<NativeT>>(n1, n2);
104 int64 count = n1 * n2;
105 NativeT step =
106 static_cast<NativeT>((count > 1) ? (to - from) / (count - 1) : 0);
107 auto set = [&array, n2](int64 index, NativeT value) {
108 (*array)(index / n2, index % n2) = value;
109 };
110 for (int64 i = 0; i < count - 1; ++i) {
111 set(i, (static_cast<NativeT>(from) +
112 static_cast<NativeT>(i) * static_cast<NativeT>(step)));
113 }
114 set(count - 1, static_cast<NativeT>(to));
115 return array;
116}
117} // namespace xla
118
119#endif // TENSORFLOW_COMPILER_XLA_ARRAY2D_H_

Callers 8

CreateR2F32LinspaceMethod · 0.85
TESTFunction · 0.85
TEST_PFunction · 0.85
TEST_FFunction · 0.85
XLA_TEST_PFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
DoItMethod · 0.85

Calls

no outgoing calls

Tested by 7

TESTFunction · 0.68
TEST_PFunction · 0.68
TEST_FFunction · 0.68
XLA_TEST_PFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
DoItMethod · 0.68