Implement tensor graph product