mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Merge branch 'prettyprint'
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
SET(src DiskFile.c File.c MemoryFile.c PipeFile.c Storage.c Tensor.c Timer.c utils.c init.c TensorOperator.c TensorMath.c random.c)
|
||||
SET(luasrc init.lua File.lua Tensor.lua CmdLine.lua Tester.lua test/test.lua)
|
||||
|
||||
|
||||
# Necessary do generate wrapper
|
||||
ADD_TORCH_WRAP(tensormathwrap TensorMath.lua)
|
||||
ADD_TORCH_WRAP(randomwrap random.lua)
|
||||
|
12
utils.c
12
utils.c
@ -57,7 +57,16 @@ int torch_islongargs(lua_State *L, int index)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int torch_isatty(lua_State *L)
|
||||
{
|
||||
#ifdef LUA_WIN
|
||||
lua_pushboolean(L, 0);
|
||||
#else
|
||||
FILE **fp = (FILE **) luaL_checkudata(L, -1, LUA_FILEHANDLE);
|
||||
lua_pushboolean(L, isatty(fileno(*fp)));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int torch_lua_tic(lua_State* L)
|
||||
{
|
||||
@ -158,6 +167,7 @@ static int torch_setnumthreads(lua_State *L)
|
||||
|
||||
static const struct luaL_Reg torch_utils__ [] = {
|
||||
{"getdefaulttensortype", torch_lua_getdefaulttensortype},
|
||||
{"isatty", torch_isatty},
|
||||
{"tic", torch_lua_tic},
|
||||
{"toc", torch_lua_toc},
|
||||
{"setnumthreads", torch_setnumthreads},
|
||||
|
Reference in New Issue
Block a user