DataNodeSensor Input handling
hfaghihi15 opened this issue · comments
There is a problem with the datanodeSensor handling inputs as pre
passed to it.
We have to make the this attributes accessible to the user either by providing them direct inputs of one datanode at a time using *inputs
in the forward call or by providing the names
of the passed arguments (the same strings passed pre
) to the forward call. Now when I call inputs[0]
, I receive a list in the forward call of the DataNodeSensor
when there exist multiple instances.
def forward(self, instance, *inputs) -> Any:
text = self.nlp(instance.getAttribute('index'))
the name index
is a pre that should be accessible somehow to avoid hard coding the name of properties in the sensor. also here inputs[0]
returns a list of index
properties instead of one example at a time.
Change the fetch_value(instance, )
function to be called each time with the forward()
function and fetch a specific key from the data node.
fetch_value()
was called in define_inputs()
and is called only once. I come up with changing forward_wrap()
which use to retrieve the inputs and feed to forward()
. If the input is from the same concept (based on information from self.pres
), I will break it into every single row of the tensor for each datanode. Otherwise, I will keep the original tensor.
It works well in test. @hfaghihi15 where is a real case you use this sensor? I can test with that also.
fetch_value()
was called indefine_inputs()
and is called only once. I come up with changingforward_wrap()
which use to retrieve the inputs and feed toforward()
. If the input is from the same concept (based on information fromself.pres
), I will break it into every single row of the tensor for each datanode. Otherwise, I will keep the original tensor.It works well in test. @hfaghihi15 where is a real case you use this sensor? I can test with that also.
Thanks Quan. The example I have is in the new example branch of sentiment analysis. Let me check on the update. Which branch has this update now?