messages
listlengths
1
1
[ { "role": "assistant", "content": "--!native\nlocal Int = {}\nInt.__index = Int\n\nexport type Int = typeof(setmetatable({\n\tsign = 0 :: number, -- -1, 0, +1\n\tlimbs = {} :: { number }, -- little-endian uint32 limbs (base 2^32)\n}, Int))\n\nlocal function trimLimbs(limbs: { number })\n\twhile #limbs > 0 a...
[ { "role": "assistant", "content": "return {'Thousand','Million','Billion','Trillion','Quadrillion','Quintillion','Sextillion','Septillion','Octillion','Nonillion','Decillion','Undecillion','Duodecillion','Tredecillion','Quattuordecillion','Quindecillion','Sedecillion','Septendecillion','Octodecillion','Nove...
[ { "role": "assistant", "content": "return {'K','M','B','T','Q','QN','S','SP','O','N','D','UD','DD','TD','QD','QND','SD','SPD','OD','ND','V','UV','DV','TV','QV','QNV','SV','SPV','OV','NV','TG','UTG','DTG','TTG','QTG','QNTG','STG','SPTG','OTG','NTG','QG','UQG','DQG','TQG','QQG','QNQG','SQG','SPQG','OQG','NQG'...
[ { "role": "assistant", "content": "--!native\n-- forked by @EternityDev\n-- originally created by @KdudeDev\n\n--[=[\n\t@class InfiniteMath\n\n\tInfiniteMath is module that allows you to surpass the limit of -10^308 to 10^308, with a new limit of -10^^308 to 10^^308 (1 with 10^308 zeros)\n\n\tInfiniteMath h...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal RunService = game:GetService(\"RunService\")\n\nlocal JPSPlus = require(\"./JPSPlus\")\n\nlocal WIDTH, HEIGHT = 384, 384\nlocal OBSTACLE_DENSITY = 0.25\nlocal SEED = 12345\n\nlocal NUM_QUERIES = 5000\nlocal WARMUP = 200\n\nlocal DIAG_POLICY ...
[ { "role": "assistant", "content": "local WorldGrid = {}\nWorldGrid.__index = WorldGrid\n\nfunction WorldGrid.new(origin: Vector3, cellSize: number, width: number, height: number)\n\treturn setmetatable({\n\t\tOrigin = origin,\n\t\tCellSize = cellSize,\n\t\tWidth = width,\n\t\tHeight = height,\n\t}, WorldGri...
[ { "role": "assistant", "content": "--!optimize 2\nlocal Dirs = {}\n\n@native\nlocal function bit(d) return bit32.lshift(1, d-1) end\n\nDirs.E = 1\nDirs.W = 2\nDirs.N = 3\nDirs.S = 4\nDirs.NE = 5\nDirs.NW = 6\nDirs.SE = 7\nDirs.SW = 8\n\nDirs.dx = { [1]= 1, [2]=-1, [3]= 0, [4]= 0, [5]= 1, [6]=-1, [7]= 1, [8]...
[ { "role": "assistant", "content": "--!optimize 2\nlocal Grid = {}\nGrid.__index = Grid\n\nGrid.DiagonalPolicy = {\n\tAlways = \"Always\", -- diagonal allowed if destination is free\n\tNoSqueeze = \"NoSqueeze\", -- (default) diagonal allowed if dest free AND (at least one orthogonal adjacent is free)\n\tNoCo...
[ { "role": "assistant", "content": "--@EternityDev\n-- Jump Point Search Plus (JPS+)\nlocal JPSPlus = {}\n\nJPSPlus.dirs = require(\"@self/dirs\")\nJPSPlus.grid = require(\"@self/grid\")\nJPSPlus.preprocess = require(\"@self/preprocess\")\nJPSPlus.planner = require(\"@self/planner\")\nJPSPlus.smoothing = req...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Dirs = require(\"./dirs\")\nlocal PQ = require(\"./priorityqueue\")\n\nlocal Planner = {}\nPlanner.__index = Planner\n\nlocal function octile(ix, iy, gx, gy, D, D2)\n\tlocal dx = math.abs(ix - gx)\n\tlocal dy = math.abs(iy - gy)\n\tlocal mn ...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Dirs = require(\"./dirs\")\nlocal Grid = require(\"./grid\")\n\nlocal Preprocess = {}\n\nlocal function makeOffsets(total)\n\tlocal off = table.create(8)\n\tlocal offB = table.create(8)\n\tfor d = 1, 8 do\n\t\tlocal o = (d - 1) * total\n\t\t...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal PQ = {}\nPQ.__index = PQ\n\nfunction PQ.new(capacity)\n\tcapacity = capacity or 256\n\treturn setmetatable({\n\t\tn = 0,\n\t\tid = table.create(capacity),\n\t\tf = table.create(capacity),\n\t\tg = table.create(capacity),\n\t}, PQ)\nend\n\n...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Smoothing = {}\n\nlocal function hasLOS(blocked, stride, x0, y0, x1, y1)\n\tlocal dx = x1 - x0\n\tlocal dy = y1 - y0\n\tlocal adx = math.abs(dx)\n\tlocal ady = math.abs(dy)\n\tlocal sx = (dx > 0 and 1) or (dx < 0 and -1) or 0\n\tlocal sy = (...
[ { "role": "assistant", "content": "--@EternityDev\n--!strict\n--!native\n--!optimize 2\nlocal Raycast = {}\nRaycast.__index = Raycast\n\nlocal RunService = game:GetService(\"RunService\")\nlocal Signal = require(script.Signal)\n\nlocal PreSimulation = RunService.PreSimulation\nlocal sampleActor = script:Wai...
[ { "role": "assistant", "content": "--!strict\n--!optimize 2\nlocal promise = require(script.Parent.Parent.promise)\nlocal janitor = require(script.Parent.Parent.janitor)\n\nexport type Promise<T...> = promise.TypedPromise<T...>\nexport type Janitor = janitor.Janitor\n\nexport type task = {\n\ttype: \"call\"...
[ { "role": "assistant", "content": "--!optimize 2\nlocal TaskChain = {}\nTaskChain.__index = TaskChain\n\nlocal types = require(script.Types)\n\n--]\nlocal function _processNextTask(self: types.TaskChain)\n\tif self._status == \"Destroyed\" or not self._isProcessing then\n\t\treturn\n\tend\n\n\tif #self._tas...
[ { "role": "assistant", "content": "--!optimize 2\n--!native\nlocal Surround = {}\n\nlocal RunService = game:GetService(\"RunService\")\nlocal ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\n\nlocal scheduler = require(ReplicatedStorage:WaitForChild(\"scheduler\"))\n\nlocal begin_profiler, end_pr...
[ { "role": "assistant", "content": "--!optimize 2\nlocal client = {}\n\nlocal ContextActionService = game:GetService(\"ContextActionService\")\nlocal CollectionService = game:GetService(\"CollectionService\")\nlocal localPlayer = game:GetService(\"Players\").LocalPlayer\n\nlocal vide = require(\"../vide\")\n...
[ { "role": "assistant", "content": "--!optimize 2\nlocal Players = game:GetService(\"Players\")\nlocal RunService = game:GetService(\"RunService\")\nlocal Stats = game:GetService(\"Stats\")\n\nlocal vide = require(\"../../vide\")\nlocal remotes = require(\"./remotes/Remotes\")\n\nlocal get_performance_socket...
[ { "role": "assistant", "content": "--!optimize 2\n--!strict\n--@EternityDev\nlocal Function = {}\nFunction.__index = Function\n\nlocal RunService = game:GetService(\"RunService\")\n\nfunction Function.new(remote: RemoteFunction)\n\tlocal meta = setmetatable({\n\t\tremote = remote,\n\t}, Function)\n\tremote....
[ { "role": "assistant", "content": "--!optimize 2\n--!strict\n--@EternityDev\n--Client\nlocal Remotes = {}\n\nif not script.Parent.Parent.Parent:FindFirstChild(\"Remotes\") then\n\tInstance.new(\"Folder\", script.Parent.Parent.Parent).Name = \"Remotes\"\nend\nlocal RemotesDir = script.Parent.Parent.Parent:Wa...
[ { "role": "assistant", "content": "--!optimize 2\n--!strict\nlocal scheduler = {}\n\nlocal profiler = require(\"@self/profiler\")\nlocal client = nil\n\nscheduler.profiler = profiler\n\nscheduler.server = function()\n\tlocal server = require(\"@self/server\")\n\treturn server\nend\n\nscheduler.client = func...
[ { "role": "assistant", "content": "--!optimize 2\n--!native\nlocal Profiler = {}\nProfiler.isRunning = false\n\nlocal IsServer: boolean = game:GetService(\"RunService\"):IsServer()\nlocal vide = require(\"../vide\")\nlocal convert_scale = require(\"./util/convert_scale\")\nlocal Signal = require(\"./util/li...
[ { "role": "assistant", "content": "--!optimize 2\nlocal server = {}\nlocal HttpService = game:GetService(\"HttpService\")\nlocal RunService = game:GetService(\"RunService\")\nlocal Stats = game:GetService(\"Stats\")\nlocal CollectionService = game:GetService(\"CollectionService\")\n\nlocal convert_units = r...
[ { "role": "assistant", "content": "--!optimize 2\n--!strict\n--@EternityDev\n--Server\nlocal Remotes = {}\n\nif not script.Parent.Parent.Parent:FindFirstChild(\"Remotes\") then\n\tInstance.new(\"Folder\", script.Parent.Parent.Parent).Name = \"Remotes\"\nend\nlocal RemotesDir = script.Parent.Parent.Parent:Wa...
[ { "role": "assistant", "content": "--!optimize 2\nlocal pebble = require(\"../../pebble\")\nlocal vide = require(\"../../vide\")\n\nlocal spawn_app = require(\"./spawn_app\")\nlocal scheduler_app = require(\"./scheduler\")\nlocal performance_app = require(\"./performance\")\n\ntype HomeProps = {\n\tenv: str...
[ { "role": "assistant", "content": "--!optimize 2\nlocal vide = require(\"../../vide\")\nlocal pebble = require(\"../../pebble\")\nlocal Profiler = require(\"../profiler\")\n\nlocal create = vide.create\nlocal source = vide.source\nlocal values = vide.values\nlocal cleanup = vide.cleanup\n\nlocal function pa...
[ { "role": "assistant", "content": "--!optimize 2\nlocal vide = require(\"../../vide\")\nlocal pebble = require(\"../../pebble\")\nlocal stack_bar = require(\"./stack_bar\")\nlocal convert_scale = require(\"../util/convert_scale\")\n\ntype SchedulerProps = {\n\tenv: string,\n\tPosition: UDim2,\n\tProfilerSta...
[ { "role": "assistant", "content": "-- by jabby\n--!strict\n--!optimize 2\nlocal Players = game:GetService(\"Players\")\n\nlocal vide = require(\"../../vide\")\n\nlocal destroy_fn: { [() -> ()]: boolean } = {}\n\nlocal function unmount_all()\n\tfor destroy in destroy_fn do\n\t\tdestroy()\n\tend\n\ttable.clea...
[ { "role": "assistant", "content": "--!optimize 2\nlocal vide = require(\"../../vide\")\n\nlocal create = vide.create\nlocal indexes = vide.indexes\nlocal derive = vide.derive\n\ntype stack_bar = {\n\tvalues: () -> { { Name: string, Color: Color3, Size: UDim2, Duration: number } },\n\tselected: (index: numbe...
[ { "role": "assistant", "content": "--!optimize 2\n\n--[[\n\t## made by anexpia •…• ##\n\n\tassigns values to specific bytes so that they can be encoded\n\tthis is mainly for sending values that cannot be encoded from server to client\n\tlike newproxy() objects, or other unique values like tables that you wa...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\n--!strict\n\n-- read float16 number from buffer\nlocal function readf16(buff: buffer, cursor: number): number\n\tlocal n: number = buffer.readu16(buff, cursor)\n\tlocal mantissa: number, exponent: number, sign: number = bit32.extract(n, 0, 10), \n...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\n\n-- quaternion stuff from https://devforum.roblox.com/t/introducing-luau-buffer-type-beta/2724894/105?u=anexpia\n-- modified a bit to be more performant when encoding \n\nlocal Types = require(script.Parent.Types)\nlocal floatencoder = require(sc...
[ { "role": "assistant", "content": "--!optimize 2\n\n--[[ \n\t## made by anexpia •…• ## \n]]\n\nlocal RS = game:GetService(\"RunService\")\nlocal Settings = require(script.Parent.Settings)\nlocal SyncingEnabled = Settings.serverclientsyncing\n\nlocal enumitem_to_type = {}\nlocal enumitem_to_value = {}\n\n\nl...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\n--!nolint LocalShadow\n\n--[[ ## made by anexpia •…• ## ]]\n\nlocal Encoder = script.Parent\n\nlocal Datatypes = require(Encoder.ReadDatatypes)\nlocal RbxEnumEncoder = require(Encoder.RbxEnumEncoder)\nlocal Settings = require(Encoder.Settings)\nlo...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal brickcolorbyte = 30\n\nr...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\nlocal Miscellaneous = require(Module.Miscellaneous)\n\ntype datatypedecodinginfo = Types.d...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\nlocal Miscellaneous = require(Module.Miscellaneous)\n\nlocal color3always6bytes = Settings...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal colorbyte = 25\n\nlocal ...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal contentbyte = 33\nlocal ...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal datetimebyte = 35\n\nreturn {\n [datetimebyte] = @native function(...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal numberbyte = 21\nlocal w...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\nlocal Miscellaneous = require(Module.Miscellaneous)\ntype datatypedecodinginfo = Types.dat...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal physpropsbyte = 29\nloca...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal raybyte = 18\nlocal writ...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal rectbyte = 28\nlocal wri...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal udimbyte = 26\nlocal wri...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal udim2byte = 27\nlocal wr...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal vectorbyte = 16\nlocal v...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal vectorbyte = 15\nlocal v...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal bufferu8byte = 12\nlocal...
[ { "role": "assistant", "content": "--[[ \n\t## made by anexpia •…• ## \n\n\toriginally this also had write functions for each datatype\n\tbut i found that it was slower than having if conditions\n\n\tso now it only contains read functions and thats it\n]]\n\nlocal bytetofunction = {}\nlocal bytetodatatype =...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\nlocal Enums = require(Module.Enums)\n\ntype datatypedecodinginfo = Types.datatypedecodingi...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal stringu8byte = 54\nlocal...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\nlocal ByteToValue = require(Module.Enums).bytetovalue\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal tblu8byte = 51...
[ { "role": "assistant", "content": "--!nolint LocalUnused\n--!nolint ImportUnused\n--!optimize 2\n\nlocal Module = script.Parent.Parent\n\nlocal Settings = require(Module.Settings)\nlocal Types = require(Module.Types)\n\ntype datatypedecodinginfo = Types.datatypedecodinginfo\n\nlocal templatebyte = -1\nlocal...
[ { "role": "assistant", "content": "local Encoder = script.Parent\n\n-- explanation for each of the settings exists in the main module\nlocal t = {\n color3always6bytes = false;\n rbxenum_behavior = \"full\" :: \"full\" | \"compact\";\n\n serverclientsyncing = false;\n sanitize_nanandinf = false;...
[ { "role": "assistant", "content": "type anyTable = { [any]: any }\n\nexport type encodeinfo = {\n\tvaluepositionlookup: anyTable;\n\n\tsettings: WriteSettings,\n\tscanlist: { anyTable },\n\treferencelist: { any },\n\t\n\tallocatedsize: number;\n}\n\nexport type decodeinfo = {\n\tsanitize_nanandinf: boolean?...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\n--!nolint LocalShadow \n\n--[[ ## made by anexpia •…• ## ]]\n\n-- [[ byte tags, if negative then its a dict key ]]\n-- 0 -> at end: terminate, at start: deduplication table\n-- 1 -> stop and start new table\n-- 2 -> boolean: true\n-- 3 -> boolean:...
[ { "role": "assistant", "content": "--[[ \n\t## made by anexpia •…• ##\n\t\nv---v---v---v---v---v currently supported types v---v---v---v---v---v\n\n[x] -> datatype has deduplication \ndeduplication means that if the value exists in more than one table, it will be encoded only once\nthis reduces buffer size ...
[ { "role": "assistant", "content": "--!optimize 2\n-- jabby_util\nlocal function convert_scale(unit: string, value: number): string\n\tlocal s = math.sign(value)\n\tvalue = math.abs(value)\n\tlocal prefixes = {\n\t\t[4] = \"T\",\n\t\t[3] = \"G\",\n\t\t[2] = \"M\",\n\t\t[1] = \"k\",\n\t\t[0] = \"\",\n\t\t[-1]...
[ { "role": "assistant", "content": "--!optimize 2\n-- jabby_util\nlocal function convert_units(unit: string, value: number): string\n\tlocal s = math.sign(value)\n\tvalue = math.abs(value)\n\tlocal prefixes = {\n\t\t[4] = \"T\",\n\t\t[3] = \"G\",\n\t\t[2] = \"M\",\n\t\t[1] = \"k\",\n\t\t[0] = \" \",\n\t\t[-1...
[ { "role": "assistant", "content": "--!optimize 2\n--!strict\n--!native\n\n--$Packages\nlocal ThreadPool = require(\"@self/threadpool\")\n\n--$Types\nexport type Connection<T...> = {\n\tdisconnect: (self: Connection<T...>) -> (),\n\treconnect: (self: Connection<T...>) -> (),\n\tconnected: boolean,\n}\n\nexpo...
[ { "role": "assistant", "content": "--!optimize 2\nlocal Types = require(\"./Types\")\nlocal GradClip = require(\"./GradClip\")\nlocal Anomaly = require(\"./Util/Anomaly\")\n\ntype Tensor = Types.Tensor\n\nlocal Debug = {}\n\nfunction Debug.checkTensor(t: Tensor, name: string?): boolean\n\tif Anomaly.hasBadV...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal GC = {}\nfunction GC.clipValue(params, clip)\n\ttask.desynchronize()\n\tfor _, p in params do\n\t\tif p._grad then\n\t\t\tfor i = 1, #p._grad._storage do\n\t\t\t\tp._grad._storage[i] = math.clamp(p._grad._storage[i], -clip, clip)\n\t\t\tend\...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Types = require(\"./Types\")\nlocal Initializer = {}\n\nlocal function _randn(): number\n\tlocal u1 = math.random()\n\tlocal u2 = math.random()\n\tif u1 <= 1e-7 then\n\t\tu1 = 1e-7\n\tend\n\treturn math.sqrt(-2 * math.log(u1)) * math.cos(2 *...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Types = require(\"./Types\")\nlocal M = {}\n\nfunction M.accuracy(logits: Types.Tensor, targets: Types.Tensor): number\n\ttask.desynchronize()\n\tlocal C, B = logits._shape[1], logits._shape[2]\n\tlocal correct = 0\n\tfor j = 1, B do\n\t\tlo...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Types = require(\"./Types\")\nlocal Util = require(\"./Util\")\nlocal State = {}\n\nlocal assert = Util.Assert\n\nlocal function mapParamsToIndices(params: { Types.Tensor }): { [Types.Tensor]: string }\n\tlocal map = {}\n\tfor i, p in params...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Tensor = {}\n\nlocal Util = require(\"./Util\")\nlocal Types = require(\"./Types\")\nlocal Tape -- lazy-load\n\nlocal TensorMethods = {}\nlocal function attachMethods(t)\n\tfor name, fn in TensorMethods do\n\t\tt[name] = fn\n\tend\nend\n\nex...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Tape = require(\"./autograd/Tape\")\nlocal Types = require(\"./Types\")\nlocal Losses = require(\"./nn/Losses\")\nlocal Metrics = require(\"./Metrics\")\nlocal Util = require(\"./Util\")\n\nlocal Trainer = {}\nTrainer.__index = Trainer\n\nlo...
[ { "role": "assistant", "content": "--!strict\nexport type DType = \"f64\" | \"f32\" | \"i32\" | \"u8\"\nexport type Shape = { number }\nexport type Storage = { number }\n\nexport type Tensor = {\n\t_storage: Storage,\n\t_shape: Shape,\n\t_dtype: DType,\n\t_requiresGrad: boolean,\n\t_size: number,\n\t_stride...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Types = require(\"../Types\")\nlocal Anomaly = {}\nfunction Anomaly.hasBadValues(t: Types.Tensor)\n\tfor i = 1, #t._storage do\n\t\tlocal v = t._storage[i]\n\t\tif v ~= v or v == math.huge or v == -math.huge then\n\t\t\treturn true\n\t\tend\...
[ { "role": "assistant", "content": "--!optimize 2\n--@Eternity_Devs\nreturn function<T>(condition: T, errorMessage: string, level: number?): T\n\tif not (condition :: any) then\n\t\terror(errorMessage, level or 2)\n\tend\n\treturn condition\nend\n" } ]
[ { "role": "assistant", "content": "--!native\n--!native\n--!optimize 2\n--@Eternity_Devs\n--from Warp lib\nlocal DedicatedBuffer = {}\n\nlocal create = buffer.create\nlocal copy = buffer.copy\nlocal writei8 = buffer.writei8\nlocal writei16 = buffer.writei16\nlocal writei32 = buffer.writei32\nlocal writeu8 =...
[ { "role": "assistant", "content": "--!native\n--!native\n--!optimize 2\n--@Eternity_Devs\n--from Warp lib & extended\nlocal assert = require(\"./Assert\")\nlocal Buffer = {}\nBuffer.__index = Buffer\n\nlocal Dedicated = require(script.Dedicated)\n\nlocal tostring = buffer.tostring\nlocal fromstring = buffer...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Types = require(\"../Types\")\nlocal GradStats = {}\n\nlocal function stats(t: Types.Tensor): (number, number, number, number)\n\tlocal n = #t._storage\n\tif n == 0 then\n\t\treturn 0, 0, 0, 0\n\tend\n\ttask.desynchronize()\n\tlocal minv, ma...
[ { "role": "assistant", "content": "--!optimize 2\nlocal Hooks = {}\n\nfunction Hooks.addForwardHook(module, fn)\n\tlocal orig = module.forward\n\tmodule.___fwd = orig\n\tmodule.forward = function(self, ...)\n\t\tlocal out = orig(self, ...)\n\t\tfn(self, out)\n\t\treturn out\n\tend\nend\n\nfunction Hooks.rem...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Parallel = {}\nfunction Parallel.with(fn: () -> ...any): ...any\n\ttask.desynchronize()\n\tlocal res = { fn() }\n\ttask.synchronize()\n\treturn table.unpack(res)\nend\nfunction Parallel.withSafe(fn: () -> ...any): (boolean, ...any)\n\ttask.d...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Types = require(\"../Types\")\nlocal assert = require(\"./Assert\")\n\nlocal Profiler = {}\n\nlocal fmt = string.format\nlocal stats: { [string]: Types.Stat } = {}\nlocal stack: { Types.Marker } = {}\nlocal enabled: boolean = true\n\nlocal f...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal RNG = {}\nlocal _rng = Random.new()\n\nfunction RNG.seed(s: number)\n\t_rng = Random.new(math.floor(s))\n\treturn s\nend\n\nfunction RNG.uniform(a: number?, b: number?, rng: Random?)\n\ta = a or 0\n\tb = b or 1\n\treturn (rng or _rng):NextNu...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal function update(self, x: number)\n\tself.n += 1\n\tlocal d = x - self.mean\n\tself.mean += d / self.n\n\tself.m2 += d * (x - self.mean)\nend\n\nlocal function var(self): number\n\tif self.n < 2 then\n\t\treturn 1.0\n\tend\n\treturn self.m2 /...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Visual3D = {}\n\nlocal Workspace = game:GetService(\"Workspace\")\nlocal RunService = game:GetService(\"RunService\")\nlocal HttpService = game:GetService(\"HttpService\")\n\nlocal Types = require(\"../Types\")\n\ntype Tensor = Types.Tensor\...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Util = {}\n\nlocal Types = require(\"./Types\")\n\nlocal function isModule(m: any): boolean\n\treturn type(m) == \"table\" and type(m.forward) == \"function\" and type(m.parameters) == \"function\"\nend\nlocal function applyRecursive(m: any,...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Tensor = require(\"../Tensor\")\nlocal BLAS = require(\"../ops/BLAS\")\nlocal Types = require(\"../Types\")\nlocal Tape = {}\nlocal gradEnabled = true\n\nlocal function withTape(t: Types.Tensor, parents: { Types.Tensor }, back: (grad: Types....
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Util = require(\"../Util\")\nlocal assert = Util.Assert\n\nreturn function(C: number)\n\tlocal mu = {}\n\tlocal var = {}\n\tlocal prior = table.create(C, 0)\n\tlocal fitted = false\n\tlocal self\n\tself = {\n\t\tfit = function(_, X, y: { num...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Tensor = require(\"../Tensor\")\nlocal Util = require(\"../Util\")\nlocal assert = Util.Assert\n\nreturn function(K: number, iters: number)\n\titers = iters or 20\n\tlocal centers: any = nil\n\tlocal function initPlusPlus(X)\n\t\tlocal D, N ...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Types = require(\"../Types\")\nlocal Util = require(\"../Util\")\nlocal assert = Util.Assert\n\n--@class KNN\n--@field X any\n--@field y {number}\n--@field k integer\n\nlocal function predict(self, Q: Types.Tensor): { number }\n\ttask.desync...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Tape = require(\"../autograd/Tape\")\nlocal Losses = require(\"../nn/Losses\")\nlocal Linear = require(\"../nn/Linear\")\nlocal SGD = require(\"../optim/SGD\")\n\nreturn function(inF: number)\n\tlocal model = Linear(inF, 1)\n\tlocal self\n\t...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Tensor = require(\"../Tensor\")\nlocal Tape = require(\"../autograd/Tape\")\nlocal Losses = require(\"../nn/Losses\")\nlocal Linear = require(\"../nn/Linear\")\nlocal Adam = require(\"../optim/Adam\")\n\nreturn function(inF: number)\n\tlocal...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Util = require(\"../Util\")\nlocal assert = Util.Assert\n\nreturn function(C: number, alpha: number)\n\talpha = alpha or 1.0\n\tlocal classCount = table.create(C, 0)\n\tlocal featureCount = {}\n\tlocal fitted = false\n\tlocal self\n\tself = ...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Tensor = require(\"../Tensor\")\nlocal Tape = require(\"../autograd/Tape\")\nlocal Losses = require(\"../nn/Losses\")\nlocal Linear = require(\"../nn/Linear\")\nlocal SGD = require(\"../optim/SGD\")\n\nreturn function(inF: number, wd: number...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Linear = require(\"../nn/Linear\")\nlocal Losses = require(\"../nn/Losses\")\nlocal Tape = require(\"../autograd/Tape\")\nlocal Tensor = require(\"../Tensor\")\nlocal Types = require(\"../Types\")\nlocal Adam = require(\"../optim/Adam\")\nlo...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Types = require(\"../Types\")\n\nreturn function(\n\tdataset: Types.Dataset,\n\tbatchSize: number,\n\tshuffle: boolean,\n\tgenerator: { randint: (a: number, b: number) -> number }?,\n\tdrop_last: boolean?\n)\n\tlocal N = dataset:size()\n\tge...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Types = require(\"../Types\")\nreturn function(N: number, K: number): Types.BatchIter\n\tlocal order: { number } = {}\n\tfor i = 1, N do\n\t\torder[i] = i\n\tend\n\tfor i = N, 2, -1 do\n\t\tlocal j = math.random(i)\n\t\torder[i], order[j] = ...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\n\n--@param N number -- total items\n--@param testRatio number? -- fraction in test split (default 0.2)\n--@param stratify {number}? -- optional class per item (1..C), length N\n--@param rng Random.new? -- optional RNG for deterministic splits\n--@...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Tensor = require(\"../Tensor\")\nlocal Types = require(\"../Types\")\nreturn function(X: Types.Tensor, Y: Types.Tensor): Types.Dataset\n\tlocal D, N = X._shape[1], X._shape[2]\n\tlocal function colSlice(startIdx: number, endIdx: number): (Ty...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\n-- Quantum-Inspired Metaheuristic Neural Network (QIMHNN)\nlocal Types = require(\"../../Types\")\nlocal Tensor = require(\"../../Tensor\")\nlocal Tape = require(\"../../autograd/Tape\")\nlocal Util = require(\"../../Util\")\nlocal Utils = require...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Tensor = require(\"../../Tensor\")\nlocal Tape = require(\"../../autograd/Tape\")\nlocal Types = require(\"../../Types\")\nlocal Linear = require(\"../../nn/Linear\")\nlocal Activations = require(\"../../nn/Activations\")\n\nlocal function R...
[ { "role": "assistant", "content": "--!native\n--!optimize 2\nlocal Tensor = require(\"../../Tensor\")\nlocal Tape = require(\"../../autograd/Tape\")\nlocal Types = require(\"../../Types\")\nlocal Scan = require(\"../../ops/Scan\")\nlocal Initializer = require(\"../../Initializer\")\nlocal BLAS = require(\"....
[ { "role": "assistant", "content": "--!native\n--!optimize 2\n-- Metaheuristic Optimizer for QIMHNN\nlocal Types = require(\"../../Types\")\nlocal Tensor = require(\"../../Tensor\")\nlocal Util = require(\"../../Util\")\n\nlocal assert = Util.Assert\n\nexport type MetaheuristicConfig = {\n\tlr: number,\n\tsw...