## Passing additional minibatchable quantities to a trainnet() loss function

I am calling trainnet() with the syntax,

netTrained = trainnet(cds,net,lossFcn,options)

where lossFcn=f(Y,T) is a handle to a custom loss function. Here the variable Y is the network prediction based on input X and T is the training target. Both Y and T are S1xS2xC images. During training, the usual operation of trainnet() is to fetch minibatched pairs (X,T) pointed to by the CombinedDataStore cds and to give the pairs (Y(X),T) to the lossFcn.

I would now like to modify the training to have a loss function of the form lossFcn=f(Y,T,W) where W is an additional minibatchable data set of the same dimensions as Y and T containing constant weights. My question is if there is a way to combine 3 datastores instead of 2 datastores to make this happen. In other words, instead of cds reading in minibatched pairs (X,T), is it possible to have it read in minibatched triplets (X,T,W)? Moreover, will trainnet() know the role of each of member of the triplet, i.e., that X are the network inputs and that (T,W) are ‘other stuff’? Or how am I meant to communicate this?I am calling trainnet() with the syntax,

netTrained = trainnet(cds,net,lossFcn,options)

where lossFcn=f(Y,T) is a handle to a custom loss function. Here the variable Y is the network prediction based on input X and T is the training target. Both Y and T are S1xS2xC images. During training, the usual operation of trainnet() is to fetch minibatched pairs (X,T) pointed to by the CombinedDataStore cds and to give the pairs (Y(X),T) to the lossFcn.

I would now like to modify the training to have a loss function of the form lossFcn=f(Y,T,W) where W is an additional minibatchable data set of the same dimensions as Y and T containing constant weights. My question is if there is a way to combine 3 datastores instead of 2 datastores to make this happen. In other words, instead of cds reading in minibatched pairs (X,T), is it possible to have it read in minibatched triplets (X,T,W)? Moreover, will trainnet() know the role of each of member of the triplet, i.e., that X are the network inputs and that (T,W) are ‘other stuff’? Or how am I meant to communicate this? I am calling trainnet() with the syntax,

netTrained = trainnet(cds,net,lossFcn,options)

where lossFcn=f(Y,T) is a handle to a custom loss function. Here the variable Y is the network prediction based on input X and T is the training target. Both Y and T are S1xS2xC images. During training, the usual operation of trainnet() is to fetch minibatched pairs (X,T) pointed to by the CombinedDataStore cds and to give the pairs (Y(X),T) to the lossFcn.

I would now like to modify the training to have a loss function of the form lossFcn=f(Y,T,W) where W is an additional minibatchable data set of the same dimensions as Y and T containing constant weights. My question is if there is a way to combine 3 datastores instead of 2 datastores to make this happen. In other words, instead of cds reading in minibatched pairs (X,T), is it possible to have it read in minibatched triplets (X,T,W)? Moreover, will trainnet() know the role of each of member of the triplet, i.e., that X are the network inputs and that (T,W) are ‘other stuff’? Or how am I meant to communicate this? trainnet, datastore, minibatch, deep learning, ai MATLAB Answers — New Questions