  In this work we introduce a new class of optimal tensor codes related to the
Ravagnani-type anticodes, namely the $j$-tensor maximum rank distance codes. We
show that it extends the family of $j$-maximum rank distance codes and contains
the $j$-tensor binomial moment determined codes (with respect to the
Ravagnani-type anticodes) as a proper subclass. We define and study the
generalized zeta function for tensor codes. We establish connections between
this object and the weight enumerator of a code with respect to the
Ravagnani-type anticodes. We introduce a new refinement of the invariants of
tensor codes exploiting the structure of product lattices of some classes of
anticodes and we derive the corresponding MacWilliams identities. In this
framework, we also define a multivariate version of the tensor weight
enumerator and we establish relations with the corresponding zeta function. As
an application we derive connections on the generalized tensor weights related
to the Delsarte and Ravagnani-type anticodes.
