Active and Passive Voice
There are two types of passive voice in Sanskrit - Transitive Passive (कर्मणि) and Intransitive Passive (भावे).
Transitive Passive (कर्मणि)
In transitive passive sentences the object of the transitive action is the syntactic focus and not the agent of the action. The verb undergo modification as if it were a 4th conjugation (गण) आत्मनेपद. The verb agrees with the object in number (वचन) and person (पुरुष). The object of a passive action should be in प्रथमा विभक्ति (nominative case) and the agent should be in तृतीया विभक्ति (instrumental case).
Active: रामो गृहम् गच्छति। Rama goes home.
Passive: रामेण गृहम् गम्यते। (Note that गृहम् here is प्रथमा विभक्ति) Home is gone to by Rama.
Active: रामो भूमिम् खनति। Rama digs the ground.
Passive: रामेण भूमिः खन्यते। The ground is dug by Rama.
Active: अहं पुत्रान् पश्यामि। I see (my) sons.
Passive: मया पुत्राः दृश्यन्ते। (My) sons are seen by me.
Active: त्वम् भार्याम् स्मरसि। You remember your wife
Passive: त्वया भार्या स्मर्यते। (Your) wife is remembered by you.
Passive sentences can of course be of different types. Examples of present, past imperfect, imperfect and potential sentences in passive voice.
Present (लट् लकार):
Active: त्वम् भूमिम् खनसि। You dig the ground.
Passive: त्वया भूमिः खन्यते। The ground is dug up by you.
Past Imperfect (लङ् लकार, अनद्यतन भूत काल):
Active: त्वम् भूमिम् अखनः। You dug up the ground.
Passive: त्वया भूमिः अखन्यत। The ground was dug up by you.
Imperative (लोट् लकार):
Active: त्वम् भूमिम् खन। You there, dig up the ground. (Order)
Passive: त्वया भूमिः खन्यताम्। The ground must be dug up by you.
Potential (लिङ् लकार):
Active: त्वम् भूमिम् खनेः। You should dig up the ground.
Passive: त्वया भूमिः खन्येत। The ground should be dug up by you.
Intransitive Passive (भावे)
One can have intransitive passive construction for any intransitive verb, and for transitive verbs used without objects. In this type of sentence there is no object. The focus of the sentence is on the action (भाव). In these sentences the agents takes the instrumental case (तृतीया) and the passive verb is always in 3rd person singular.
Active: त्वम् गच्छसि। You go.
भावे: त्वया गम्यते। Going is done by you.
Active: देवाः खादन्ति। Gods eat.
भावे : देवैः खाद्यते। The eating is done by Gods.
Active: अहम् अपतम्। I fell.
भावे : मया अपत्यत। Falling was done by me.
Active: यूयम् गच्छत।
भावे : युष्माभिः गम्यताम्।
Passive constructions in the context of gerunds and infinitives (क्त्वा and तुमुन प्रत्यय)
As long as the gerund/infinitive has the same object and agent as the main finite verb, the case of the object and the agent is determined by the voice of the main verb.
Active: पक्त्वा रामः ओदनं खादति। Having cooked (it), Rama eats rice.
Passive: पक्त्वा ओदनः खाद्यते रामेण। Having (been) cooked, the rice is eaten by Rama.
Active: रामः खादितुम् ओदनम् पचति। Rama cooks rice in order to eat it.
Passive: खादितुम ओदनः पच्यते रामेण। Rice has been cooked byy Rama to (be) eaten.
However, if the gerund/infinitive has a different object, then that object will always be expressed in accusative case (द्वितीया विभक्ति)
Active: गृहं गत्वा रामः ओदनं खादति। Having gone home, Rama eats rice.
Passive: गृहं गत्वा रामेण ओदनः खाद्यते। Having gone home, rice is eaten by Rama.
Active: रामः ओदनं खादितुम् गृहं गच्छति। Rama goes home to eat rice.
Passive: ओदनं खादितुम रामेण गृहं गम्यते। Home is gone to by Rama, to eat rice.