Giter VIP home page Giter VIP logo

xlua's Introduction

A set of useful extensions to Lua

Build Status

Dependencies:

Torch7 (www.torch.ch)

Install:

$ torch-rocks install xlua

Use

$ torch -lxlua
xLua > a = 5
xLua > b = 'test'
xLua > xlua.who()

Global Libs:
{[1] = string,
 [2] = package,
 [3] = os,
 [4] = io,
 [5] = xlua,
 [6] = sys,
 [7] = math,
 [8] = debug,
 [9] = table,
 [10] = coroutine}

Global Vars:
{[a] = 5,
 [b] = test}

xLua > xlua.clearall()   -- also calls the garbage collector !
xLua > xlua.who()

Global Libs:
{[1] = string,
 [2] = package,
 [3] = os,
 [4] = io,
 [5] = xlua,
 [6] = sys,
 [7] = math,
 [8] = debug,
 [9] = table,
 [10] = coroutine}

Global Vars:
{}

xLua > print(xlua)
{[clear] = function: 0x10020cd10,
 [clearall] = function: 0x10020ca70,
 [_PACKAGE] = ,
 [progress] = function: 0x10020cda0,
 [print] = function: 0x10020c9d0,
 [_NAME] = xlua,
 [who] = function: 0x10020cd50,
 [_M] = table: 0x10020c990,
 [lua_print] = function: 0x100201900}

xLua > test = {a = 14, b = "test"}
xLua > =test
{[a] = 14,
 [b] = test}
xLua > 

xlua's People

Contributors

adamlerer avatar clementfarabet avatar colesbury avatar georgostrovski avatar jnhwkim avatar koraykv avatar lucasb-eyer avatar marcoscoffier avatar mranzinger avatar nicholas-leonard avatar samehkhamis avatar soumith avatar szagoruyko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xlua's Issues

Naming intention for table.splice?

In most languages the intention of splice(start, len) is to extract the designated items out of the original data structure, but seems it's not the case for table.splice, it's actually doing exactly the opposite, just wondering is this by design? If so, care to explain the reasons behind? Thanks.

need tips for progress bar

Hi, all~
When I run demo train-on-cifar from torch7-demos on Gnome terminal, the progress bar is printed full of the window like this:

th> for i=1,20 do
xlua.progress(i,20)
print('\r')
end
 [==>..........................................................................]                                   1/20 ms | Step: 0ms
 [======>......................................................................]                                   2/20 ms | Step: 0ms
 [==========>..................................................................]                                   3/20 ms | Step: 0ms
 [==============>..............................................................]                                   4/20 ms | Step: 0ms
 [==================>..........................................................]                                   5/20 ms | Step: 0ms
 [======================>......................................................]                                   6/20 ms | Step: 0ms
 [=========================>...................................................]                                   7/20 ms | Step: 0ms
 [=============================>...............................................]                                   8/20 ms | Step: 0ms
 [=================================>...........................................]                                   9/20 ms | Step: 0ms
 [=====================================>.......................................]                                   10/20 s | Step: 0ms
 [=========================================>...................................]                                   11/20 s | Step: 0ms
 [=============================================>...............................]                                   12/20 s | Step: 0ms
 [=================================================>...........................]                                   13/20 s | Step: 0ms
 [====================================================>........................]                                   14/20 s | Step: 0ms
 [========================================================>....................]                                   15/20 s | Step: 0ms
 [============================================================>................]                                   16/20 s | Step: 0ms
 [================================================================>............]                                   17/20 s | Step: 0ms
 [====================================================================>........]                                   18/20 s | Step: 0ms
 [========================================================================>....]                                   19/20 s | Step: 0ms
 [============================================================================>]                                   20/20 s | Step: 0ms

However, when I run the same code on Cnetos terminal, there's only one progress bar.
What's wrong with Gnome terminal? Can anyone help me to figure out?

simple demo

Hello, is there a simple demo how to use it ?

Feature Request: Add flexibility to add a title string prefix for the progressbar

xlua.progressbar() currently lacks ability to add a title string as a prefix such as 'training', 'validation' or 'testing'.

Training : [=================== 5306/5306 =================>] Tot: 8m57s | Step: 107ms
Validation : [==================== 100/100 ==================>] Tot: 13s850ms | Step: 164ms

It is a simple fix to concatenate with title and adjust the progressbar width accordingly.

Strange `popen` behavior when xlua included in OpenResty

My openresty server is crashing when it attempts to load a file that includes xlua. I've been racking my brain as to the root cause but I'm totally stumped. The offending code is:

https://github.com/torch/xlua/blob/master/init.lua#L224-L231

For some reason, io.popen both from the lua sys package for uname and the call to io.popen('tput cols', 'r') are returning nil when they are read. My first guess was that something is redirecting stdin and stdout, I can neither prove or disprove this theory as I'm fairly new to Lua. io.popen works fine in the file that I'm requiring xlua from. Any thoughts or debugging ideas would be much appreciated. I totally understand this could have nothing to do with xlua and instead be caused by a different library, I just thought it was especially strange that io.popen only seems to be busted in xlua's init.lua.

License missing!

Hello, the repo xlua ships no license, could you please add a explicit LICENSE file. Without the LICENSE file I cannot make a Debian package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.