Both functions and labels can be a dictionary of tensors (not just one tensor). Tensors can be any shape you want, although usually it is num_examples * ...
If you are not using any predefined estimates, the easiest way would be to add another function so that you need to calculate the weights, calculate the weights in the model, and then use them (multiply the losses or pass them as a parameter).
You also have access to the hyperparameters inside input_fn, so you can calculate the weight there and add it as a separate column.
If you are using a canned rating, check the documentation. I see that most of them support weight_column_name. In this case, just give it the name that you used in the function dictionary for the weight values.
Otherwise, if all else fails, you can try the data as you want before submitting it to the tensor.
Sorin source share