# Label weight error in SameDiff loss function

**URL:** <https://community.konduit.ai/t/label-weight-error-in-samediff-loss-function/1103>\
**Category:** SameDiff\
**Created:** [January 4, 2021, 3:20pm UTC](https://community.konduit.ai/t/label-weight-error-in-samediff-loss-function/1103 "2021-01-04T15:20:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SidneyLann](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/sidneylann/32/367_2.png) [@SidneyLann](https://community.konduit.ai/u/SidneyLann)\
**Post date:** [January 4, 2021, 3:20pm UTC](https://community.konduit.ai/t/label-weight-error-in-samediff-loss-function/1103/1 "2021-01-04T15:20:52Z")

</div>

sameDiff.loss.softmaxCrossEntropy(“loss”, label, out, sameDiff.var(“labelWeight”, Nd4j.create(NerUtil.labelWeight1d())));

this line cause below exception:

[main] ERROR org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner - Failed to execute op softmax\_cross\_entropy\_loss. Attempted to execute with 3 inputs, 1 outputs, 1 targs,0 bargs and 1 iargs. Inputs: [(FLOAT,[1024,6],c), (FLOAT,[6],c), (FLOAT,[1024,6],c)]. Outputs: [(FLOAT,,c)]. tArgs: [0.0]. iArgs: [3]. bArgs: -. Input var names: [out, labelWeight, label]. Output var names: [loss] - Please see above message (printed out from c++) for a possible cause of error.  
java.lang.RuntimeException: NDArray::tile method - shapeInfo of target array is not suitable for tile operation !  
at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.exec(NativeOpExecutioner.java:1924)  
at org.nd4j.linalg.factory.Nd4j.exec(Nd4j.java:6575)  
at org.nd4j.autodiff.samediff.internal.InferenceSession.doExec(InferenceSession.java:495)  
at org.nd4j.autodiff.samediff.internal.InferenceSession.getOutputs(InferenceSession.java:222)  
at org.nd4j.autodiff.samediff.internal.TrainingSession.getOutputs(TrainingSession.java:152)  
at org.nd4j.autodiff.samediff.internal.InferenceSession.getOutputs(InferenceSession.java:68)  
at org.nd4j.autodiff.samediff.internal.AbstractSession.output(AbstractSession.java:411)  
at org.nd4j.autodiff.samediff.internal.TrainingSession.trainingIteration(TrainingSession.java:118)  
at org.nd4j.autodiff.samediff.SameDiff.fitHelper(SameDiff.java:1713)  
at org.nd4j.autodiff.samediff.SameDiff.fit(SameDiff.java:1569)  
at org.nd4j.autodiff.samediff.SameDiff.fit(SameDiff.java:1509)  
at org.nd4j.autodiff.samediff.config.FitConfig.exec(FitConfig.java:173)

How to solve it? Thanks.
