Skip to content

Instantly share code, notes, and snippets.

View MIERAI's full-sized avatar

YANG ZAIQI MIERAI

View GitHub Profile
@zacky1972
zacky1972 / horizontal_image_concat.exs
Last active April 19, 2023 10:33
Horizontal Image Concatenation
System.put_env("EVISION_PREFER_PRECOMPILED", "true") # Remove if you use a platform on which Evision does not provide a pre-compiled library.
System.put_env("EVISION_PRECOMPILED_CACHE_DIR", "#{System.user_home!()}/.cache")
Mix.install(
[
{:nx, "~> 0.3"},
{:exla, "~> 0.3"},
{:evision, "~> 0.1.2", github: "cocoa-xu/evision", tag: "v0.1.2"}
],
@zacky1972
zacky1972 / horizontal_image_division.exs
Last active December 18, 2023 07:02
Horizontal image division
# Setting for Evision to use precompiled version
System.put_env("EVISION_PREFER_PRECOMPILED", "true") # Remove if you use a platform on which Evision does not provide a pre-compiled library.
System.put_env("EVISION_PRECOMPILED_CACHE_DIR", "#{System.user_home!()}/.cache")
# Setting integration of Nx, EXLA and Evision
Mix.install(
[
@zacky1972
zacky1972 / Makefile
Last active November 9, 2023 03:04
HtPipe prevents the entire Elixir from terminating abnormaly by NIFs.
.phony: all clean
PRIV = $(MIX_APP_PATH)/priv
BUILD = $(MIX_APP_PATH)/obj
NIF = $(PRIV)/libnif.so
ifeq ($(CROSSCOMPILE),)
ifeq ($(shell uname -s),Linux)
LDFLAGS += -fPIC -shared
CFLAFGS += -fPIC