clab / clab/dynet

binary_log_loss error

Open
#1,604 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
3.4k
Forks
701
PR merge metrics
No merged PRs in 30d

Description

### I got an error when I using binary_log_loss:
```import numpy as np
import dynet as dy

a = dy.inputTensor(np.array([[0.2,0.4,0.7,0.2],[0.8,0.9,0.1,0.2]]), batched=True)
print(a.dim())
b = dy.inputTensor(np.array([[0,1,1,0],[0,1,0,0]]), batched=True)
print(b.dim())
c = dy.binary_log_loss(a,b)
print(c.dim())
print(c.npvalue())
```

### the error is:
```Traceback (most recent call last):
File "", line 1, in
File "_dynet.pyx", line 769, in _dynet.Expression.value (/home/yfliu/software/dynet-base/dynet/build/python/_dynet.cpp:15857)
File "_dynet.pyx", line 783, in _dynet.Expression.value (/home/yfliu/software/dynet-base/dynet/build/python/_dynet.cpp:15686)
RuntimeError: Node binary_log_loss(a, a) does not support batching but got fed batched tensor
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the supplied Python example using dy.binary_log_loss with batched inputTensor values, then trace the binary_log_loss entry point and its batching support. Done means the example no longer raises the reported batching error and returns a valid value for c.npvalue().

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.