There is no law specifically forbidding nude or topless sunbathing in your own backyard, provided that you are not violating the law on indecent exposure. California penal code 314 details what constitutes indecent exposure or lewd behavior.
California law defines indecent exposure as any person who makes their private parts visible in any public place or in any place where there are people who may be offended or annoyed.
If you're in your own backyard, on private property, you are free to sunbath nude or topless. It is best if you sunbathe with a certain degree of discretion, a secluded location obscured from view by a privacy fence makes for a good sunbathing spot.
You can be sunbathing nude on private property and still be charged with indecent exposure under certain conditions. If you can be seen by the public (for example, if your backyard backs up to a busy street) or by neighbors who may take offense at your sunbathing, then you are technically in violation of California's indecent exposure law.