MCPcopy Create free account
hub / github.com/pytorch/tutorials / string

Method string

beginner_source/examples_nn/dynamic_net.py:45–49  ·  view source on GitHub ↗

Just like any class in Python, you can also define custom method on PyTorch modules

(self)

Source from the content-addressed store, hash-verified

43 return y
44
45 def string(self):
46 """
47 Just like any class in Python, you can also define custom method on PyTorch modules
48 """
49 return f'y = {self.a.item()} + {self.b.item()} x + {self.c.item()} x^2 + {self.d.item()} x^3 + {self.e.item()} x^4 ? + {self.e.item()} x^5 ?'
50
51
52# Create Tensors to hold input and outputs.

Callers 1

dynamic_net.pyFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected