From mathematics:
"Tensors eat vectors and spit out numbers."
Is this an analogy, metaphor or other named figure of speech?
From mathematics:
"Tensors eat vectors and spit out numbers."
Is this an analogy, metaphor or other named figure of speech?
The literary device used is called: 1) zoomorphism, giving animal characteristics to something that is not an animal.
Alternatively, it could be called 2) personification as well, if you consider eating and spitting out as applying to humans. Somehow the verbs eat and spit out made me think of animals first. But I guess humans are animals, too.
"Tensors eat vectors and spit out numbers."
Is like a transformation of: "Lions eat gazelles and spit out their bones."
I am sure one can come up with many other images. Here's another:
1) Cats eat mice and spit out the bones. [animal]
2) Men eat fish and spit out the bones. [human]
Both are explained in the link below and I liked the cat picture (though nothing beats the disappearing Cheshire cat in Alice in Wonderland, whose smile is left behind).
But the real delight there is: chremamorphism:
"Can the qualities of inanimate objects be attributed to humans, and animals? Yes, they can, and this technique is called chremamorphism."
Mine: He started rattling, let out a prolonged cranking noise and fell silent.
Yes, these are all metaphors in that they create an image of an animal or human or thing but they are also specific literary devices. Metaphors can be created in any number of ways, all of which I am not going to go into here. Literary devices can get very complicated. A good reference handbook for everyone to have in their personal library is "The Oxford Book of Literary Terms", which is now in its fourth edition.
Analogies are comparisons. There is no comparison here. There's substitution of technical verbs for verbs associated with eating and animals. That's metaphor as the image is created of an animal through the use of the verbs.
[Editing Note: I just realized I had made a mistake in my example above so I corrected it. See chremamorphism.]
Answer: It's a metaphor.
Disclaimer: I am not a mathematician.
Explanation: Keep reading.
From what I understand of tensors, they are geometric objects that are made up of vector and numerical (coordinate) components. (Source: https://www.youtube.com/watch?v=TvxmkZmBa-k) Knowing this helps us establish that the subject (tensors) and objects (vectors, numbers) in this fascinating sentence are indeed 'real'. They do actually mean tensors, vectors and numbers.
Now let's look at the verbs, 'eat' and 'spit out'. These are typically actions that animals, humans included, perform. This is not 'real'; tensors cannot eat or spit, but these actions have been assigned to tensors. We call this zoomorphism or personification.
The purpose of this sentence is to establish the relationship between three things: one where there is a certain input and a different, processed output. This is similar to the process of eating and spitting out. Rather than just say that tensors are like humans, vectors are like chicken wings, and numbers are like bones, this sentence uses zoomorphism/personification to liken the relationship between the three things to a person eating chicken wings without an explicit statement of said similarity.
This is very the definition of a metaphor - it is an implicit comparison made by applying an action/quality to an object to which said action/quality is literally inapplicable. Typically, with any metaphor, you can deconstruct it to reveal clear parallels, which will invariably use the words "like", "as", "similar" etc. (which I've just done with the humans, chicken wings, and bones example).
UPDATE: On further reading, I've found that while the above definition of a metaphor is its most common, the word actually encapsulates "all figures of speech that achieve their effect through association, comparison, and resemblance" according to The Oxford Companion to the English Language (1992) pp.653–55. (Source: https://english.stackexchange.com/a/3871/155273)
Meanwhile, an analogy is more of a logical argument that focuses on shared characteristics of two (or more) things, to establish that they are alike. It isn't a figure of speech.
That's further evidence that this sentence is in fact a metaphor, and not an analogy.
Forget the mathematics. Just think in terms of something eating something else and spitting out numbers. If this is a metaphor, why is it a metaphor? If it isn't a metaphor, what is it?
I understand this as a note to focus on the language and imagery, rather than on the maths, which I agree with fully. However, you can't ignore the context and expect to find the right answer. It's not the act of eating one thing and spitting out another that makes this sentence a metaphor; it's the fact that the 'eating' and 'spitting' are being done by a thing that, in reality, cannot eat or spit.
If your real question is, 'What is the figure of speech that describes this act of eating one thing and spitting out another?' I think the closest answer would be digestion, or a lack thereof.
UPDATE 2: I'm joking about the digestion bit. Of course it isn't a figure of speech!