Reputation: 1360
I am wondering what is the complexity of the strided slice function in Tensorflow. Obviously, it is not as computationally intensive as a Convolution 2D, but it's certainly not free neither. I'm not even sure talking of complexity for this operation is meaningful since there is no addition or multiplication performed.
To be concrete, let's say I have a 10x3x3x10 tensor foo
and I want to perform bar=foo[3:5,:,:,4:5]
. How would you evaluate the complexity of the operation (both in terms of space and time)?
Upvotes: 3
Views: 270
Reputation:
You can use TF_Strided_Slice Operation and Conv2D Operation and then evaluate the complexity of those Operations using Profiling
in Keras Callback
.
Corresponding code is mentioned below:
log_dir="logs/profile/" + datetime.now().strftime("%Y%m%d-%H%M%S")
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1, profile_batch = 3)
model.fit(train_data,
steps_per_epoch=20,
epochs=5,
callbacks=[tensorboard_callback])
Upvotes: 2