Closed basselkassem closed 3 years ago
Hi, Bassel, thanks for the report.
This is a bit confusing, but I actually think the code is correct. The documentation says:
Args:
inputs: Symbolic inputs. Should be (sources, targets) if `weights` is
non-symbolic. Otherwise, should be (sources, targets, weights).
weights: If target weights are not symbolic, `weights` should be passed as
a separate argument. In this case, `inputs` should have length 2.
The idea is that if you pass None
for weights
, the inputs
argument is expected to be a tuple of 3 elements; otherwise, it's expected to be a tuple of 2 elements. And that's just what the code does:
if weights is None:
sources, targets, weights = inputs
else:
sources, targets = inputs
(Notice in the else
case that the weights
variable is left unchanged because it already has a non-None
value.)
So I'm going to close this bug as I believe the code is correct. Please feel free to re-open it if you think I'm mistaken.
Thanks!
Thank you Aheydon for your replay. I get it know!
https://github.com/tensorflow/neural-structured-learning/blob/c21dad4feff187cdec041a564193ea7b619b8906/neural_structured_learning/keras/layers/pairwise_distance.py#L114