Giter Club home page Giter Club logo

Comments (3)

liu-nlper avatar liu-nlper commented on July 23, 2024

from sltk.

KaqiKaqi avatar KaqiKaqi commented on July 23, 2024

还是不行,报了另外一个错

Traceback (most recent call last):
File "../test.py", line 77, in
targets_list = sl_model.predict(sample_batched)
File "/xunku/SLTK-master/TorchNN/layers/bilstm_crf.py", line 106, in predict
path_score, best_paths = self.crf(lstm_feats, mask)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call
result = self.forward(*input, **kwargs)
File "/xunku/SLTK-master/TorchNN/layers/crf.py", line 183, in forward
path_score, best_path = self._viterbi_decode(feats, mask)
File "/xunku/SLTK-master/TorchNN/layers/crf.py", line 146, in _viterbi_decode
partition_history = torch.cat(partition_history).view(
RuntimeError: invalid argument 0: Tensors must have same number of dimensions: got 3 and 2 at /pytorch/torch/lib/TH/generic/THTensorMath.c:2888

from sltk.

KaqiKaqi avatar KaqiKaqi commented on July 23, 2024

我知道原因了。
line 134 partition_history.append(partition) 加进去的 partition 的 rank 是3,最后一维的 dim 是1
line 140 加进去的 partition 的 rank 是2。也就是说 partition, cur_bp = torch.max(cur_values, 1) 产生的 partition 的 rank 是2.

我的torch 是0.3.0, 不知道和版本有关系没有。

from sltk.

Related Issues (20)

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.