Git Product home page Git Product logo

Comments (1)

gargahcerk avatar gargahcerk commented on August 24, 2024

I thought the problem was with BatchToSpace. I was able to prevent BatchToSpace from occurring (occurs when conv1d dilation > 1) and there is still the problem with Regularizer Loss = 0.0. The FLOPs can be calculated, so I assume that reg_outputs/ reg_inputs (network_regularizers/resource_function.py#L477) must be 0.

Further information:
I use the model Jasper (Openseq2seq). For Batch Normalization I set scale and fused = true. channels_last is set.

This is how I included morphnet:

def get_regularization_loss(self):
    from open_seq2seq.optimizers import get_regularization_loss as old_regularization_loss
    if not self.params['morphnet']:
      return old_regularization_loss()
    else:
      from morph_net.network_regularizers import flop_regularizer
      from morph_net.tools import structure_exporter

      network_regularizer = flop_regularizer.GammaFlopsRegularizer(output_boundary=[self._logits.op], input_boundary=[self.get_data_layer().input_tensors["source_tensors"][0].op,  self.get_data_layer().input_tensors["target_tensors"][0].op], gamma_threshold=1e-3)

      regularization_strength = 1e-10
      regularizer_loss = (network_regularizer.get_regularization_term() * regularization_strength)
      self.reg_loss = regularizer_loss
      self.reg_costs = network_regularizer.get_cost()

      tf.summary.scalar('RegularizationLoss', regularizer_loss)
      tf.summary.scalar(network_regularizer.cost_name, network_regularizer.get_cost())

      return tf.add(old_regularization_loss(),regularizer_loss)

from morph-net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.