/home/wy/torch/install/bin/lua: ./Nn/next_round_value_pre.lua:114: Invalid index in scatterAdd at /home/wy/torch/pkg/torch/lib/TH/generic/T
HTensorMath.c:495stack traceback:
[C]: in method 'scatterAdd'
./Nn/next_round_value_pre.lua:114: in method '_card_range_to_bucket_range_on_board'
./Nn/next_round_value_pre.lua:247: in method 'get_value_aux'
./Lookahead/lookahead.lua:254: in method '_compute_terminal_equities_next_street_box'
./Lookahead/lookahead.lua:323: in method '_compute_terminal_equities'
./Lookahead/lookahead.lua:93: in method '_compute'
./Lookahead/lookahead.lua:66: in method 'resolve'
./Lookahead/resolving.lua:182: in method 'get_chance_action_cfv'
./Player/continual_resolving.lua:112: in method '_update_invariant'
./Player/continual_resolving.lua:81: in method '_resolve_node'
./Player/continual_resolving.lua:142: in method 'compute_action'
Player/deepstack.lua:41: in main chunk
[C]: in function 'dofile'
...e/wy/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: in ?
there are three places use scatterAdd:
wy@ubuntu:~/poker/DeepHoldem-master/Source$ grep -rni scatterAdd -C 4 .
./Game/card_tools.lua-26-
./Game/card_tools.lua-27-function M:get_possible_hands_mask(hands)
./Game/card_tools.lua-28- local used_cards = arguments.Tensor(hands:size(1), game_settings.card_count):fill(0)
./Game/card_tools.lua-29-
./Game/card_tools.lua:30: used_cards:scatterAdd(2,hands,arguments.Tensor(hands:size(1), 7):fill(1))
./Game/card_tools.lua-31- local ret = torch.le(torch.max(used_cards, 2), 1):long()
./Game/card_tools.lua-32- if arguments.gpu then
./Game/card_tools.lua-33- ret = ret:cudaLong()
./Game/card_tools.lua-34- end
and I read the torch7's code, torch7/lib/TH/generic/THTensorMath.c:
void THTensor_(scatterAdd)(THTensor tensor, int dim, THLongTensor index, THTensor *src)
{
long elems_per_row, i, idx;
THArgCheck(dim < THTensor_(nDimension)(tensor), 2, "Index dimension is out of bounds");
THArgCheck(THLongTensornDimension(index) == THTensor(nDimension)(tensor), 3,
"Index tensor must have same dimensions as output tensor");
THArgCheck(THTensor(nDimension)(src) == THTensor(nDimension)(tensor), 4,
"Input tensor must have same dimensions as output tensor");
elems_per_row = THLongTensor_size(index, dim);
TH_TENSOR_DIM_APPLY3(real, tensor, real, src, long, index, dim,
for (i = 0; i < elems_per_row; ++i)
{
idx = (index_data + iindex_stride);
if (idx < TH_INDEX_BASE || idx >= tensor_size + TH_INDEX_BASE)
{
THFree(TH_TENSOR_DIM_APPLY_counter);
THError("Invalid index in scatterAdd");
}
tensor_data[(idx - TH_INDEX_BASE) tensor_stride] += (src_data + i*src_stride);
})
}
but I don't know how to fix this.
I am using Ubuntu 16.04, and tried both LUA52 and LUA53.
the log is: $ th Player/deepstack.lua 20001
there are three places use scatterAdd:
and I read the torch7's code, torch7/lib/TH/generic/THTensorMath.c:
but I don't know how to fix this. I am using Ubuntu 16.04, and tried both LUA52 and LUA53.
PS: the insert code of issue is toooooo bad :(