deneutoy / act-tensorflow Goto Github PK
View Code? Open in Web Editor NEWAdaptive Computation Time algorithm in Tensorflow
Adaptive Computation Time algorithm in Tensorflow
Hey, I hope you are still watching this repo.
I'm trying to port this act_cell.py file to TF 1.0, but having a bunch of incompatibility issues. I've managed to find replacements for most of the TF-calls, but porting these two lines: https://github.com/DeNeutoy/act-tensorflow/blob/master/src/act_cell.py#L94-L95 eludes me.
I've tried a variety of things. Currently my replacement looks like this:
input_shape_size = input_with_flags.get_shape().as_list()[1]
input_flags_flat = tf.reshape(tf.contrib.layers.flatten(input_with_flags), [self.batch_size, self.train_length, input_shape_size])
output, new_state = tf.nn.dynamic_rnn(cell=self.cell, inputs=[input_flags_flat], initial_state=state, scope=type(self.cell).__name__)
But I'm getting:
TypeError: 'Tensor' object is not iterable.
The error occurs in the unrolling of the "state" variable which it treats as a tuple.
I'm calling the ACT cell like so:
self.inner_cell = tf.contrib.rnn.LSTMCell(num_units=input_size, state_is_tuple=True)
self.cell = ACTCell(num_units=input_size, cell=self.inner_cell, epsilon=0.01,
max_computation=50, batch_size=self.batch_size, train_length=self.train_length)
self.state = (np.zeros([1, fv_size]), np.zeros([1, fv_size]))
self.state_in = self.cell.zero_state(self.batch_size, tf.float32)
rnn, self.rnn_state = tf.nn.dynamic_rnn(
inputs=inputFlat,
cell=self.cell,
dtype=tf.float32,
initial_state=self.state_in,
scope=scope
)
I didn't have any issuesbefore I added the LSTMCell as an inner_cell to the ACTCell, the issue only arose after.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.