Skip to content

Commit 5e45f71

Browse files
IvyZXFlax Authors
authored andcommitted
flaxlib in cc
PiperOrigin-RevId: 696286840
1 parent ac3e85a commit 5e45f71

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

flaxlib/flaxlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from flaxlib.flaxlib import sum_as_string as sum_as_string
15+
from flax.flaxlib.flaxlib_cc import sum_as_string as sum_as_string
File renamed without changes.

flaxlib/src/lib.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <string>
2+
3+
#include "third_party/nanobind/include/nanobind/nanobind.h"
4+
5+
namespace flaxlib {
6+
std::string sum_as_string(int a, int b) {
7+
return std::to_string(a + b);
8+
}
9+
10+
NB_MODULE(flaxlib_cc, m) {
11+
m.def("sum_as_string", &sum_as_string);
12+
}
13+
} // namespace flaxlib

0 commit comments

Comments
 (0)