Skip to content

Commit

Permalink
flaxlib in cc
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 696286840
  • Loading branch information
IvyZX authored and Flax Authors committed Nov 13, 2024
1 parent ac3e85a commit 5e45f71
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flaxlib/flaxlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from flaxlib.flaxlib import sum_as_string as sum_as_string
from flax.flaxlib.flaxlib_cc import sum_as_string as sum_as_string
File renamed without changes.
13 changes: 13 additions & 0 deletions flaxlib/src/lib.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <string>

#include "third_party/nanobind/include/nanobind/nanobind.h"

namespace flaxlib {
std::string sum_as_string(int a, int b) {
return std::to_string(a + b);
}

NB_MODULE(flaxlib_cc, m) {
m.def("sum_as_string", &sum_as_string);
}
} // namespace flaxlib

0 comments on commit 5e45f71

Please sign in to comment.