Skip to content

Instantly share code, notes, and snippets.

View github-louis-fruleux's full-sized avatar

github-louis-fruleux

  • Teads
  • Paris
View GitHub Profile
@github-louis-fruleux
github-louis-fruleux / benchmark.py
Last active June 14, 2024 13:29
String upper slower in onnx than plain python
import timeit
import numpy as np
def setup_code(model_name: str):
return f"""
import string
import random
import onnxruntime as _ort
from onnxruntime_extensions import get_library_path as _lib_path
import numpy as np
name: graviton
dependencies:
- numpy
- pandas
- scipy
@github-louis-fruleux
github-louis-fruleux / Main.scala
Created March 31, 2023 14:10
Jsoniter scala codec for NonEmptyList
import cats.data.NonEmptyList
import com.github.plokhotnyuk.jsoniter_scala.core._
import com.github.plokhotnyuk.jsoniter_scala.macros._
object Main extends App {
import Sample._
implicit val nelSampleCodec: JsonValueCodec[NonEmptyList[Sample]] = Codecs.make
println(readFromArray[NonEmptyList[Sample]](
"""[
| {"id": 0},
@github-louis-fruleux
github-louis-fruleux / udf_diff_spark
Created September 6, 2022 13:29
Spark UDF change
import org.apache.spark.sql.types._
import org.apache.spark.sql.functions._
val f = udf((x: Int) => x, IntegerType)
val df = Seq((None), (Some(1))).toDF("value")
df.show
/* In both Spark versions 2.X and 3.X
+-----+
|value|