Skip to content

Instantly share code, notes, and snippets.

@bitswarming
Created November 29, 2017 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitswarming/8a7063daf3dd8972830514538aab1388 to your computer and use it in GitHub Desktop.
Save bitswarming/8a7063daf3dd8972830514538aab1388 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3.5
from common.base import Base
import tensorflow as tf
class ClassName(Base):
"""
Add description about class
"""
""" Declare input, output, parameter names
class Input:
X = "x"
class Output:
RESULT = "result"
class Params:
NAME = "name"
"""
def __init__(self, tf_session, name):
Base.__init__(self, tf_session=tf_session, name=name)
""" Create all inputs, outputs, parameters
Example:
self.add_input(self.Input.X, desc="A Tensor or SparseTensor of type float32, float64, int32, int64, complex64 or complex128", important=True)
self.add_output(self.Output.RESULT, desc="A Tensor or SparseTensor the same size and type as x with absolute values.")
self.add_param(self.Params.NAME, desc="abs", value=name, important=False)
"""
def init(self):
""" Init tensorflow objects and return it as a dictionary
Example:
res = tf.abs(x=self.get_input(self.Input.X),
name=self.get_param(self.Params.NAME)
)
self.set_output(self.Output.RESULT, res)
return {self.Output.RESULT: res}
"""
pass
def run(self):
""" This section is not used at the moment and will never be launched
"""
pass
def stop(self):
""" This section is not used at the moment and will never be launched
"""
pass
def create_summary(self):
"""Attach a lot of summaries to a Tensors (for TensorBoard visualization)."""
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment