text:
Калкански кругови је српска ТВ серија из 2021. године.

Емитовање је кренуло од 13. марта 2021. године на Суперстар ТВ и 20. марта 2021. године на РТС 1.

Радња

Сукоб две породице живописног села Дола крије тајну чувану деценијама.
Време је да се тај сукоб разреши.

Након што му полиција приведе ћерку Миону заједно са познатим београдским дилером, Дејан Матић одлучује да прекине рад у свом архитектонском студију, те да се са ћерком пресели у Дол, родно село свог оца.
Упркос Мионином отпору, он своју замисао и спроводи, са надом да ће у Долу ћерку одвојити од лошег друштва и лоших навика, те обновити међусобну блискост, изгубљену током Миониног одрастања и Дејановог бављења својом каријером.

Међутим, уместо очекиваног мира, у Долу их очекују тајне и неразјашњени односи који су спремни да и њима и свима око њих помрсе конце и направе неочекивани преокрет, али откривају и део породичне историје коју су њихови преци желели да сакрију.
При самом доласку, дочекује их Дејанов стриц Велибор са најавом дешавања у селу - инвеститор жели да посече стару шуму Забран и ту сагради комплекс хотела.

Зашто су неки мештани спремни на то, док су други животно уплашени, остаје да се прати у овој причи.

Улоге

Главне
 Војин Ћетковић као Дејан Матић
 Жарко Лаушевић као Велибор Матић
 Ивана Зечевић као  Миона Матић

Епизодне

|-
| Наташа Нинковић || Вера Јаковљевић
|-
| Нина Јанковић || Светлана, Баба Губа
|-
| Златија Оцокољић || Дара
|-
| Милутин Караџић || Бора
|-
| Бранка Пујић || Биља
|-
| Марко Гверо || "Макса" Максимовић
|-
| Филип Хајдуковић || Стефан Максимовић
|-
| Нела Михаиловић || Даница Максимовић
|-
| Александар Петковић || Милан
|-
| Филип Станковски || Ранко Јаковљевић
|-
| Весна Чипчић || Гордана Јаковљевић
|-
| Бојана Стојковић || Саша
|-
| Нина Нешковић || Миланка
|-
| Бранко Перишић || Кића
|-
| Оливера Бацић || певачица
|-
| Ана Сакић ||
|-
| Весна Тривалић ||
|-
| Марија Вицковић ||
|-
| Небојша Дугалић ||
|-
| Паулина Манов ||
|-
| Ања Павићевић ||
|-
| Љиљана Стјепановић ||
|-
| Вахидин Прелић ||
|-
| Ивана Ковачевић ||
|-
| Никола Шурбановић ||
|-
| Миодраг Пејковић ||
|-
| Александра Плескоњић Илић ||
|-
| Александар Ђурица ||
|-
| Бранка Пујић ||
|-
|Ђорђе Ђоковић ||
|-
|Александар Милојевић Лија ||
|-
| Ненад Вулевић ||
|-
| Никола Милојевић ||
|-
| Марко Павловић ||
|-
| Бојана Ковачевић ||
|-
| Милић Јовановић ||
|-
| Жељко Максимовић ||
|-
|Никола Малбаша ||
|-
|Џек Димић ||
|-
|Миломир Ракић ||
|-
|Тамара Алексић ||
|-
|Милица Буразер ||
|-
|Наташа Миовчић ||
|-
| Јаков Јевтовић || Вук
|-
|Исидора Грађанин || девојка
|-
| Павле Менсур || Бојан
|-
| Љубиша Милишић || Џанда
|-
| Немања Оливерић || Љуба Стојковић
|-
| Игор Ђорђевић || пуковник Константин Марковић
|-
| Лазар Николић || Петар Матић (Мачји смех)
|-
| Дејан Цицмиловић || Милун
|-
|Маја Шаренац || Смиљана
|-
| Јован Савић || Свилар
|-
| Маја Шиповац || Мира Стојковић
|-
|Јадранка Селец || Здравка
|-
|Војислав Брајовић || Момчило Матић
|-
|Бора Ненић || председник комисије
|-
|Александар Срећковић || Дејанов пословни партнер Власта
|-
| Иван Вујић || дете
|-
| Иван Нинчић || отац
|-
|Ивана Терзић || мајка
|-
| Александар Михаиловић || Драгутин
|-
| Драга Ћирић || бабица старица
|-
| Јелена Орловић || секретарица
|-
| Мики Радевић || Силос 1
|-
| Стефан Ђоковић || Силос 2
|-
|Петра Милошевић || девојчица
|-
| Влада Керкез || адвокат
|-
| Ратко Игњатов || доктор
|-
|Драган Павковић || конобар Трибалија
|-
|Милош Јефтић || музичар Трибалија
|-
| Вукашин Јовановић ||
|}

Занимљивости
Снимања су вршена на локацијама у Аранђеловцу и околини  од августа 2020. и трајала су око 10 недеља.

Епизоде

Референце

Спољашње везе

Српске серије
Оригинални програм канала Суперстар ТВ
Српске серије које су се почеле приказивати 2021.
Српске серије које су се престале приказивати 2021.
Телевизијске серије на српском језику

redpajama_set_name: RedPajamaWikipedia


Winter is coming, even here in the Northern Rivers region. Late autumn seems to herald the beginning of cold and flu season. I really hate being sick. I don't have the most robust constitution, so I do need to be careful. When I get a lurgie I tend to feel pretty sorry for myself, grumpy, and may have (once or twice) been convinced my end is imminent, while others in my family have been assured that I have succumbed to a common cold. Colds do seem to bring out my flair for the dramatic. I have 2 kids that go to school & preschool which means we get all sorts of bugs and viruses coming home. Last year I decided to make a master tonic to help me ward off the lurgies and I think it did a pretty good job. I did get one cold, but it was short lived. I also used it for my older child to treat a staph infection that is notorious for being antibiotic resistant, all cleared up in a jiffy. It was so good that I've just made it again and I thought I would share the recipe for anyone else keen to avoid winter bugs.
Of course this is only one part of the equation to maintain optimal health, there is no substitute for sleeping and eating well and getting vital nutrients, ensuring good gut health, minimising & managing stress and generally taking care of yourself. But even when we manage to do all those things (is it just me, or is that a full time job in itself?), sometimes our immune systems can still be vulnerable to strong pathogens, and sometimes we have unavoidable periods where it is quite a challenge to fully care for yourself and your family – sometimes life can be unavoidably busy and stressful! This is my first port of call now if I feel any illness coming on, I dose up for a day or two on my master tonic before I reach for any other herbal formulas, and I'm a herbalist! And if I can combine that with some cupping and acupuncture I am pretty well guaranteed to kick that bug before it really hits.
Now is the time to make your own master tonic as it as it takes about 6 weeks to brew to full strength. It is chock full of antibacterial, antiviral, anti-inflammatory, antioxidant foods that promote good circulation. Most of these ingredients are also mucolytics, so not only is it good for you, bad for bugs & will help your immune system to fight just about anything undesirable (including candida apparently), it will also help to eliminate excess mucus if you do happen to come down with a cold or the flu. My partner complained that it made him phlegmy, but it was just thinning the mucus to make it easier to cough up and get it out! My older son will take this too (albeit under duress), but my little ones taste buds are still a bit too delicate as this really does pack a punch with chili, garlic, onion & horseradish. You will need to assess whether it will work for the younger ones in your family, and reduce the dose. It is probably worth the battle if the other option is antibiotics! We know that antibiotics should be a last resort, not first, and can have a cascade of It is also safe to take during pregnancy, I'd reduce the turmeric though. I quite like the flavour, I have even used it in a few condiments in the kitchen, try adding it to coconut aminos to make a dipping sauce, pretty tasty!
There are recipes available on the web, this is just what I have done this time. The main difference is the addition of turmeric, because…well why wouldn't you in that list of things? Even more antioxidant and detoxifying power!
To use your master tonic a tablespoon 4 or 5 times a day if you have an infection of some sort. Less for kids or if you're pregnant. Take a couple of times a day if you have been around sick people, as a preventative.
I am not good with measures, these are approximate quantities. Essentially you want fairly equal portions of each, a bit less chili, all covered in apple cider vinegar.
fresh horseradish – either a large knob or about 5 long thin strands should do it!
Throw all your diced and chopped goodness into the jar and cover it with the apple cider vinegar. Give it a good shake. Leave it to brew away for 6 weeks on your bench, shaking once a day. After 6 weeks, strain off the solids and reserve the liquid – Voila – your master tonic!


text:
I have had the pleasure of knowing and working with Michael Tario since 2016. In that time, he has provided me exceptional service in many areas of law. He also has an exceptional work ethic and he is very responsive and articulate with his communication. I appreciate his ability to explain otherwise complicated matters in a very common sense and down-to-earth manner. He is a great listener and he stays focused on the most efficient way to the desired outcome. Having worked with other Lawyers over the years, I can say he will always be my go-to attorney when needed…and if the matter is outside the scope of his expertise, he is a good resource for other lawyers who can help. In an era where the bar for customer service is set very low, Michael Tario sets and maintains high standards for his law practice. Thank you for all your hard work and I will always use and recommend you in the future. -Dale Serbousek
Personal Injury Verdicts
Tidiman vs. Allstate Insurance Company – Jury Verdict $300,375.00
Michael Montes vs. State Farm Insurance Co – Damage Award $1,071,064.10
Zweber vs. State Farm (Personal Injury) – Jury Award $1.3 Million
Automobile Accident – $375,000 Out-of-Court Settlement
Wrongful Death – $600,000 Out-of-Court Settlement
Rogers vs The Fairhaven Pub Martini Bar-Jury ruled in favor of defense
Michael J. Tario, Personal Injury Attorney
Michael John Tario is one of the most highly respected and experienced practicing personal injury attorneys in Washington State. He opened his practice more than four decades ago and has earned the respect of his peers and the industry as exemplified by his many awards and high ratings*. Through most of his career, Mr. Tario practiced plaintiff personal injury and criminal defense but re-focused as a personal injury lawyer in 2006. During his career, Mr. Tario has successfully represented over 3,000 clients. He has negotiated well over 2,500 favorable out-of-court settlements, but where settlement was not possible, he has taken hundreds of cases to trial; fighting hard to protect the rights and interests of his clients. Michael is known for his hard fighting tenacity, his determination, and his commitment to try to do everything possible (within the bounds of the law) to give his clients "top notch" representation. While no attorney can win every case they handle, Mr. Tario's win/loss record speaks for itself. His advertised claim of "proven record of success" is based upon the results obtained in and out of court in over 40 years in practice.
Mr. Tario has resided in Bellingham, Washington since 1979 when he graduated from the University of Puget Sound Law School (now Seattle University Law School). Prior to attending law school, Mr. Tario obtained both a Bachelor of Arts and a Masters Degree in Persuasion and Speech Communication and Psychology (both degrees with Honors). In particular, he studied the psychology and social dynamics of perception and persuasion, focusing on the cognitive processes associated with the development of speech communication skills and persuasion techniques. Mr. Tario's undergraduate and graduate education afforded him significant insight and skills, directly contributing to his success.
Mr. Tario is admitted to practice law in the United States Supreme Court, the Supreme Court for the State of Washington, the 9th Circuit Court of Appeals, and the Federal District courts for the Western and Eastern Districts of Washington. Mr. Tario has appeared and represented clients on a "pro hac vice" basis in various other states including Alaska, Oregon, and California. He has been a continuing legal education teacher, a judge pro tem, a member of the Washington State Bar Association, the American Bar Association, the American Trial Lawyers Association, the Washington State Association for Justice, the Federal Bar Association for the Western District of Washington, and the National Association of Criminal Defense Attorneys. Mr. Tario is one of the thirty-three founding members of the Washington Association of Criminal Defense Attorneys.
*Every year since 1997, Mr. Tario earned a Silver Client Champion Award and a Distinguished Peer Rating for High Professional Achievement from Martindale-Hubbell. This rating signifies a very high rating in both legal ability and ethical standards. In 2014 he also earned the "Client Distinction Award" from Martindale-Hubbell. He was rated as one of America's Most Honored Professionals in 2019. Mr. Tario is a member of the Million Dollar Advocates Forum and he has earned a "Superb" 10.0 rating and 2012 and 2018 Client's Choice awards with Avvo. In December 2016, Mr. Tario received the Distinguished Lawyer Designation from the Expert Network, which is only conferred upon the Top 3 percent of Lawyers in North America. In May 2015, Mr. Tario was awarded "Top Rated Lawyer" for Litigation from Martindale-Hubbell. In 2014, he was recognized as being one of the nation's "Top 100 Trial Lawyers" by the National Trial Lawyers Association. In 2013, he was ranked in the "Top Lawyers in Washington" for Ethical Standards and Professional Excellence by the Legal Network. This award is given to those who are recognized for excellence in quality of service; overall value; responsiveness; and communication ability based on actual client reviews. In 2007, the Bellingham Business Journal rated Mr. Tario as "The Best Attorney in Bellingham to Defend You in a Lawsuit".
Mr. Tario has made guest appearances or has been interviewed or appeared on various local, national and international television, radio, and news programs, including "The O'Riley Factor" (Fox News), "Court TV", NPR, PBS, MSNBC, CNN, ABC, and NBC.
Michael is an avid sportsman, seaplane pilot, and sailor. He also enjoys camping, fishing, hunting, hiking, and sailing and exploring with his friends and family.
Michael John TarioClients' ChoiceAward 2018
Michael John TarioReviewsout of 32 reviews
Lawyer Michael Tario | Top Attorney Car Accident
Lawyer Michael Tario | Top Attorney Personal Injury
Lawyer Michael Tario | Top Attorney Medical Malpractice

redpajama_set_name: RedPajamaCommonCrawl


In this workshop, we'll compare four major citation managers—EndNote, Zotero, Mendeley, and RefWorks—examining key features of each product, including data import/export options, support for collaboration, available bibliographic styles, duplicate detection, and note and annotation features. By the end of the session participants will be able to evaluate citation management tools and select those that best meet their needs. The first half of the workshop will include demonstration and an outline of criteria for choosing the best fit. The second half of the workshop will be hands-on, so that participants can install and explore the different citation managers with help from instructors.


This vegan quinoa risotto uses white beans to make a rich, creamy & healthy dish. Flavored with shallots & thyme, it's perfect topped with roasted veggies.
I'm sure most of you are already fans of Laura's blog, The First Mess. If not, you should be – you'll love it. Laura and I both started our blogs around the same time, and I've loved her creative, plant-based recipes ever since.
I'm so excited to share this recipe from her new cookbook today. The First Mess Cookbook came out last week and I have to tell you – it's a stunner. I saw an early PDF copy months ago, and I not only drooled over every single page, I read it (virtual) cover to cover. I especially loved all of her little tips and tricks, like how she makes homemade almond milk by using almond butter so that no soaking or straining is involved – genius!
You're gonna want to make everything – Cookies for Breakfast, Savory Ginger Green Onion Crepes, and she even has a recipe for Earl Grey Vegan Tiramisu that I'm dying to try out. Laura has a way of combining ingredients in such unique ways.
This is a fun twist on risotto. In her book, Laura talks about disappointing quinoa risottos she's had at restaurants in the past (since quinoa isn't very creamy), which led her to create this recipe. It mixes a white bean puree into the quinoa to give the risotto necessary creaminess. There's no butter, no cheese, and also… no standing at the stove stirring for a lengthy amount of time like most risottos.
While it's not a full-on risotto replacement, it's so wholesome and delicious. Top it with roasted broccoli and Brussels sprouts, and you have a warm, cozy meal that's perfect for these remaining chilly spring days. The only thing I added was a clove of garlic and a bigger squeeze of lemon (for obvious reasons).
This recipe is from The First Mess Cookbook by Laura Wright and is reprinted with permission from the publisher. Top this creamy, vegan, and protein-packed take on risotto with your favorite roasted veggies.
Place the small florets on the baking sheet. Drizzle with 1 tablespoon of the olive oil, and season with salt and pepper. Toss to coat and slide the baking sheet into the oven. Roast the florets until the edges are evenly brown and crispy, flipping the pieces over occasionally to ensure equal doneness, about 20 to 25 minutes. Set aside.
While the florets roast, in a blender, purée the white beans with the garlic, lemon juice, nutritional yeast, 2 teaspoons of the olive oil and ⅓ cup of the vegetable stock. As soon as you have a smooth and creamy purée, stop the blender. Set the bean purée aside.
Heat the remaining 1 tablespoon of olive oil in a braiser or medium-sized soup pot over medium heat. Add the shallots, and saute until transluscent, about 4 minutes. Add the fresh thyme and stir until fragrant, about 1 minute.
Add the rinsed quinoa to the pot and stir to coat in the oil, herbs, and shallots. Then, add the remaining 2 cups of vegetable stock to the pot and stir. Bring to a boil, then simmer until the quinoa has absorbed almost all of the liquid, about 13 to 15 minutes.
Scrape the white bean puree into the pot and stir to combine. The quinoa should have a creamy consistency without seeming dry. If it seems dry, add a good splash of vegetable stock.
That looks so healthy & good!
It looks like there is a step missing about pureeing the beans. I think it would be puree them with the garlic, lemon, and nutritional yeast?
thanks for pointing that out – just fixed it!
Laura's book really sounds great, as does this recipe. I love the use of white bean puree. Such a clever trick to make it creamy. Beautiful images Jeanine. Pinned!
So yummy.. looks amazing, would definitely try and serve my customers… We are a href="http://www.letsmeetcafe.com/why-cafe-lets-meet/">best cafe in Jaipur.
Do you have the nutritional info (carbs mainly) for this recipe?
I have the book and love it. thank you for the reminder of this recipe.
This looks amazing!! Right now broccoli is not working for me to eat. Is there another veggie that would work similarly, like cauliflower? Thanks!
I love this recipe and have made it twice. I recommend replacing some of the veggie broth with white wine or dry vermouth – extra good!
Hi Dana, ooh, thanks for the tip, that sounds wonderful!


Position Purpose: Leads LSM team in the restaurant in providing a total McDonald's experience of fast, fun and friendly service that will make customers smile and return for more. Helps restaurant achieve its sales targets through Local Store Marketing Activities.
Customer Relation Activities : Welcoming, meeting and greeting in the lobby, making sure their dining experience is excellent and correcting any problem that may arise.
In the Restaurant Activities : Adding fun and building long term sales through activities held within the restaurant i.e. Birthday Parties, Restaurant Tours, Large Food Order ,Fun Day, Happy Meal Selling etc.
Female age between 21 to 27 years old.
Friendly, has good listening skills and ability to create fun atmosphere.
High School Graduate/ General education degree or equivalent.
Candidates with hospitality and customer service experience will have the advantage during the selection process.


text:
// See docs in ../ops/math_ops.cc.

#ifndef TENSORFLOW_CORE_KERNELS_SEGMENT_REDUCTION_OPS_IMPL_H_
#define TENSORFLOW_CORE_KERNELS_SEGMENT_REDUCTION_OPS_IMPL_H_

#include <cstdint>

#include "tensorflow/core/framework/op_requires.h"
#include "tensorflow/core/platform/types.h"
#define EIGEN_USE_THREADS
#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM
#define EIGEN_USE_GPU
#endif  // GOOGLE_CUDA || TENSORFLOW_USE_ROCM

#include "third_party/eigen3/Eigen/Core"
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
#include "tensorflow/core/framework/bounds_check.h"
#include "tensorflow/core/framework/numeric_op.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/register_types.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/tensor_types.h"
#include "tensorflow/core/framework/tensor_util.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/kernels/segment_reduction_ops.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/util/determinism.h"
#include "tensorflow/core/util/util.h"

#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM
#include "tensorflow/core/common_runtime/gpu/gpu_event_mgr.h"
#endif  // GOOGLE_CUDA || TENSORFLOW_USE_ROCM

#if GOOGLE_CUDA
#include "tensorflow/core/util/gpu_solvers.h"
#include "tensorflow/stream_executor/cuda/cuda_activation.h"

using stream_executor::cuda::ScopedActivateExecutorContext;
#elif TENSORFLOW_USE_ROCM
#include "tensorflow/core/platform/rocm.h"
#include "tensorflow/core/util/gpu_solvers.h"
using stream_executor::rocm::ScopedActivateExecutorContext;
#endif  // GOOGLE_CUDA

namespace tensorflow {

typedef Eigen::ThreadPoolDevice CPUDevice;
typedef Eigen::GpuDevice GPUDevice;

namespace internal {
Status ValidateSegmentReduction(OpKernelContext* c, const Tensor& input,
                                const Tensor& segment_ids);
Status ValidateUnsortedSegmentReduction(OpKernel* op_kernel,
                                        OpKernelContext* context,
                                        const Tensor& data,
                                        const Tensor& segment_ids,
                                        const Tensor& num_segments);
Status ValidateSparseSegmentReduction(OpKernelContext* context,
                                      const Tensor& input,
                                      const Tensor& indices,
                                      const Tensor& segment_ids,
                                      bool has_num_segments);
}  // namespace internal

// This operator handles reducing segments along the first dimension.
// See core/ops/math_ops.cc for more details.
template <typename Device, class T, class Index, typename Reducer,
          int default_value>
class SegmentReductionOp : public OpKernel {
 public:
  explicit SegmentReductionOp(OpKernelConstruction* context)
      : OpKernel(context) {}

  void Compute(OpKernelContext* context) override {
    const Tensor& input = context->input(0);
    const Tensor& segment_ids = context->input(1);

    OP_REQUIRES_OK(context, internal::ValidateSegmentReduction(context, input,
                                                               segment_ids));

    const int64_t num_indices = segment_ids.NumElements();
    auto input_flat = input.flat_outer_dims<T>();
    const int64_t num_col = input_flat.dimension(1);

    const auto segment_vec = segment_ids.vec<Index>();
    // Note that the current implementation assumes that segment_vec values are
    // sorted.
    const Index output_rows =
        num_indices > 0
            ? internal::SubtleMustCopy(segment_vec(num_indices - 1)) + 1
            : 0;
    OP_REQUIRES(context, output_rows >= 0,
                errors::InvalidArgument("segment ids must be >= 0"));

    OP_REQUIRES(context, input.dims() >= 1,
                errors::InvalidArgument("Shape must be at least rank 1"));

    TensorShape output_shape = input.shape();
    // Since we're changing the first dimension of the shape, we need to make
    // sure the new shape won't overflow.
    OP_REQUIRES_OK(context, output_shape.SetDimWithStatus(0, output_rows));

    // Note that we do not initialize the output buffer with a default value, so
    // we need to explicitly set missing indices to the default value.
    Tensor* output = nullptr;
    OP_REQUIRES_OK(context, context->allocate_output(0, output_shape, &output));
    if (num_indices == 0) return;
    OP_REQUIRES(context, output_rows > 0,
                errors::InvalidArgument("segment ids must be >= 0"));
    auto output_flat = output->flat_outer_dims<T>();

    Eigen::IndexList<Eigen::type2index<0> > dims_to_reduce;
    Index start = 0, end = 1;

    Index uninitialized_index = 0;  // Index from which the output is not set.
    Index out_index = internal::SubtleMustCopy(segment_vec(start));

    // TODO(agarwal): if this loop becomes a bottleneck, consider sharding it
    // across threads.
    Eigen::DSizes<Eigen::DenseIndex, 1> out_slice_shape(num_col);
    while (end <= num_indices) {
      // We initialize next_index to 0 to avoid "warning: 'next_index' may be
      // used uninitialized in this function" in the Mac build (since the
      // compiler isn't smart enough to realize the code is safe).
      Index next_index = 0;
      if (end < num_indices) {
        next_index = internal::SubtleMustCopy(segment_vec(end));
        if (out_index == next_index) {
          ++end;
          continue;
        }
        // We have a new segment here.  Verify that the segment ids are growing.
        OP_REQUIRES(context, out_index < next_index,
                    errors::InvalidArgument("segment ids are not increasing"));
      }

      // Process segment [start, end)
      const T* in_slice_ptr = &input_flat(start, 0);
      typedef Eigen::TensorMap<Eigen::Tensor<T, 1, Eigen::RowMajor>,
                               Eigen::Unaligned>
          OutT;

      OP_REQUIRES(
          context, FastBoundsCheck(out_index, output_rows),
          errors::InvalidArgument(
              "Segment id ", out_index, " out of range [0, ", output_rows,
              "), possibly because 'segment_ids' input is not sorted."));

      // If there is a gap between two indices, we need to set that gap to the
      // default value.
      if (out_index > uninitialized_index) {
        Eigen::DSizes<Eigen::DenseIndex, 2> gap_slice_shape(
            out_index - uninitialized_index, num_col);
        Eigen::TensorMap<Eigen::Tensor<T, 2, Eigen::RowMajor>, Eigen::Unaligned>
            gap_slice(&output_flat(uninitialized_index, 0), gap_slice_shape);
        gap_slice.setConstant(T(default_value));
      }

      T* out_slice_ptr = &output_flat(out_index, 0);
      OutT out_slice(out_slice_ptr, out_slice_shape);
      // We don't use out_slice.device(context->eigen_device<Device>)
      // because these pieces of work are likely to be very small and
      // the context switching overhead dwarfs any benefit we get from
      // using another thread to do this work.
      if (start == end - 1) {
        typedef Eigen::TensorMap<Eigen::Tensor<const T, 1, Eigen::RowMajor>,
                                 Eigen::Unaligned>
            InT;
        InT in_slice(in_slice_ptr, out_slice_shape);
        out_slice = in_slice;
      } else {
        Eigen::DSizes<Eigen::DenseIndex, 2> in_slice_shape(end - start,
                                                           num_col);
        typedef Eigen::TensorMap<Eigen::Tensor<const T, 2, Eigen::RowMajor>,
                                 Eigen::Unaligned>
            InT;
        InT in_slice(in_slice_ptr, in_slice_shape);

        out_slice = in_slice.reduce(dims_to_reduce, Reducer());
      }
      if (end >= num_indices) break;
      start = end;
      ++end;
      uninitialized_index = out_index + 1;
      out_index = next_index;
    }
  }
};

#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM

//  SegmentReductionGPUOp is a segment reduction operator implemented for GPU
//  only.
//  TODO: This implementation of SegmentReductionGPUOp is sometimes slower than
//  its unsorted counterpart (mostly when problem size is small).
//  This is due to the following two main reasons and a cost-effective way
//  to resolve these problems is desirable.
//  1. Sorted segment reduction requires a memory transfer from device to host
//     in order to know the size of the output dimension whereas unsorted
//     segment reduction receives the size of the output dimension as an input
//     parameter.
//  2. Sorted segment reduction is essentially a tiled version of unsorted
//     segment reduction and therefore such optimization comes at an inherent
//     cost. However such cost may not be justified when the problem size is
//     small. When to use the tiled version or the untiled version depends on
//     many factors including data alignments, ratio of calculation to memory
//     traffic and obviously, the problem sizes.
template <class T, class Index, class SegmentReductionFunctor, bool IsMean>
class SegmentReductionGPUOp : public AsyncOpKernel {
 public:
  explicit SegmentReductionGPUOp(OpKernelConstruction* context)
      : AsyncOpKernel(context) {}

  void ComputeAsync(OpKernelContext* context, DoneCallback done) override {
    const Tensor& input = context->input(0);
    const Tensor& segment_ids = context->input(1);

    OP_REQUIRES_ASYNC(
        context, TensorShapeUtils::IsVector(segment_ids.shape()),
        errors::InvalidArgument("segment_ids should be a vector."), done);

    OP_REQUIRES_ASYNC(context, input.dims() >= 1,
                      errors::InvalidArgument("Shape must be at least rank 1"),
                      done);

    const int64_t num_indices = segment_ids.NumElements();
    OP_REQUIRES_ASYNC(
        context, num_indices == input.dim_size(0),
        errors::InvalidArgument(
            "segment_ids should be the same size as dimension 0 of"
            " input."),
        done);

    if (num_indices == 0) {
      TensorShape output_shape = input.shape();
      output_shape.set_dim(0, 0);

      Tensor* output = nullptr;
      OP_REQUIRES_OK_ASYNC(
          context, context->allocate_output(0, output_shape, &output), done);
      done();
      return;
    }

    se::DeviceMemoryBase output_rows_device(
        const_cast<Tensor&>(segment_ids).template flat<Index>().data() +
        (num_indices - 1));
    ScratchSpace<Index> output_rows_host(context, 1, /* on_host */ true);

    auto stream = context->op_device_context()->stream();
    OP_REQUIRES_ASYNC(
        context,
        stream
            ->ThenMemcpy(output_rows_host.mutable_data(), output_rows_device,
                         sizeof(Index))
            .ok(),
        errors::Internal(type_string() +
                         ": failed to copy output_rows from device"),
        done);

    SegmentReductionFunctor functor_;
    auto create_and_check_output = [context, output_rows_host, &input,
                                    &segment_ids, &functor_, done]() {
      // Ensure that within the callback, the proper GPU settings are
      // configured.
      auto stream = context->op_device_context()->stream();
      ScopedActivateExecutorContext scoped_activation{stream->parent()};

      Index output_rows = *output_rows_host.data();
      output_rows++;
      OP_REQUIRES_ASYNC(context, output_rows > 0,
                        errors::InvalidArgument("segment ids must be >= 0"),
                        done);

      TensorShape output_shape = input.shape();
      // Since we're changing the first dimension of the shape, we need to make
      // sure the new shape won't overflow.
      OP_REQUIRES_OK_ASYNC(context,
                           output_shape.SetDimWithStatus(0, output_rows), done);

      Tensor* output = nullptr;
      OP_REQUIRES_OK_ASYNC(
          context, context->allocate_output(0, output_shape, &output), done);

      bool use_deterministic_kernels =
#if defined(PLATFORM_WINDOWS)
          // See comment in segment_reduction_ops_gpu_0.cu.cc regarding Windows
          // CI build error.
          false;
#else
          UseDeterministicSegmentReductions() ||
          (!SegmentReductionFunctor::atomic_reduction_is_associative &&
           OpDeterminismRequired());
#endif

      // The determinism check is here, rather than inside the functor (as it is
      // for the unsorted segment reduction ops) because the done callback
      // (required for OP_REQUIRES_ASYNC) is not available inside the functor.
      bool determinism_requirement_met =
          use_deterministic_kernels ||
          SegmentReductionFunctor::atomic_reduction_is_associative ||
          !OpDeterminismRequired() ||
          DisableSegmentReductionOpDeterminismExceptions();
      OP_REQUIRES_ASYNC(
          context, determinism_requirement_met,
          errors::Unimplemented(
              "Deterministic GPU implementation of sorted segment reduction op"
              " not available."),
          done);

      auto output_flat = output->flat_outer_dims<T>();
      auto data_ptr = input.template flat<T>().data();
      auto segment_flat = segment_ids.flat<Index>();
      functor_(context, context->eigen_device<GPUDevice>(), output_rows,
               segment_ids.shape(), IsMean, segment_flat, input.NumElements(),
               data_ptr, output_flat);

      done();
    };

    context->device()
        ->tensorflow_accelerator_device_info()
        ->event_mgr->ThenExecute(stream, create_and_check_output);
  }
};
#endif  // GOOGLE_CUDA || TENSORFLOW_USE_ROCM

// ____________________________________________________________________________
// Unsorted segment reduction ops.

namespace functor {

// The ReductionFunctor implementation for CPU.
template <typename T, typename Index, typename InitialValueF,
          typename ReductionF>
struct UnsortedSegmentFunctor<CPUDevice, T, Index, InitialValueF, ReductionF> {
  void operator()(OpKernelContext* ctx, const TensorShape& segment_ids_shape,
                  typename TTypes<Index>::ConstFlat segment_ids,
                  typename TTypes<T, 2>::ConstTensor data,
                  typename TTypes<T, 2>::Tensor output) {
    auto cpu_device = ctx->eigen_cpu_device();
    output.device(cpu_device) = output.constant(InitialValueF()());
    if (data.size() == 0) {
      return;
    }

    // This functor will reduce `N` rows input to `num_segments` rows output.
    const int64_t N = segment_ids.dimension(0);
    const int64_t num_segments = output.dimension(0);
    const int64_t inner_dim = data.dimension(1);
    ReductionF reduction;

    // `num_real_segment` counts the rows actually reduced from input,
    // the rows with negative segment index will be excluded.
    // It will be used for cost model.
    int64_t num_real_segment = N;
    // `num_reductions` counts the rows actually reduced in output,
    // the rows only filled with InitialValueF() will be excluded.
    int64_t num_reductions = 0;
    // `row_counter` records how many input rows will be reduced in each
    // output row, the row only fills with InitialValueF() will keep 0.
    // Length of non-zero elements is `num_reductions`.
    std::vector<Index> row_counter(num_segments, 0);

    for (int64_t i = 0; i < N; ++i) {
      Index j = internal::SubtleMustCopy(segment_ids(i));
      if (j < 0) {
        --num_real_segment;
        continue;
      }
      OP_REQUIRES(ctx, FastBoundsCheck(j, num_segments),
                  errors::InvalidArgument(
                      "segment_ids", SliceDebugString(segment_ids_shape, i),
                      " = ", j, " is out of range [0, ", num_segments, ")"));
      if (row_counter[j] == 0) num_reductions++;
      row_counter[j]++;
    }

    // Nothing to reduce. All output values equal to `InitialValueF()`.
    if (num_reductions == 0) return;

    // Parallelize by `num_segments`. It's simple, efficient and safe
    // (no data dependency):
    //
    //   input   segment_ids                 num_segments  operation
    //   | a0 |  | 0 |            worker 1:  |0|           f(a0, a1)
    //   | b0 |  | 1 |            worker 2:  |1|           f(b0, b1)
    // N | c0 |  | 2 |       -->  worker 3:  |2|           f(c0)
    //   | b1 |  | 1 |
    //   | a1 |  | 0 |
    //
    // TODO(intel-tf): Balance workload in `row_counter` to make parallelism
    //                 more efficient.
    auto reductionWorker = [&](int64_t begin, int64_t end) -> void {
      for (int64_t i = 0; i < N; i++) {
        Index j = internal::SubtleMustCopy(segment_ids(i));
        // If `j` is in work scope of this worker, do the reduction.
        if (j >= begin && j < end) {
          reduction(data.template chip<0>(i), output.template chip<0>(j));
        }
      }
    };

    // Reduction functors includes Sum, Max, Min, etc. Simply consider it
    // will cost 5 cycles per operation.
    const int64_t kAverTaskSize = num_real_segment / num_segments;
    const int64_t compute_cycles = 5 * inner_dim * kAverTaskSize;
    const int64_t input_bytes = sizeof(T) * inner_dim * kAverTaskSize;
    const int64_t output_bytes = sizeof(T) * inner_dim * kAverTaskSize;
    const Eigen::TensorOpCost cost(input_bytes, output_bytes, compute_cycles);
    cpu_device.parallelFor(num_segments, cost, reductionWorker);
  }
};

template <typename T>
using MatrixChip = Eigen::TensorChippingOp<0l, typename TTypes<T, 2>::Matrix>;

template <typename T>
using constMatrixChip =
    Eigen::TensorChippingOp<0l, const typename TTypes<T, 2>::ConstMatrix>;

// reduction functors
template <typename T>
struct SumOp {
  void operator()(const constMatrixChip<T> data, MatrixChip<T> output) {
    output += data;
  }
};

template <typename T>
struct MaxOp {
  void operator()(const constMatrixChip<T> data, MatrixChip<T> output) {
    output = data.cwiseMax(output);
  }
};

template <typename T>
struct MinOp {
  void operator()(const constMatrixChip<T> data, MatrixChip<T> output) {
    output = data.cwiseMin(output);
  }
};

template <typename T>
struct ProdOp {
  void operator()(const constMatrixChip<T> data, MatrixChip<T> output) {
    output *= data;
  }
};
}  // namespace functor

// The UnsortedSegmentReduction OpKernel. The DeviceReductionFunctor
// is the device specific implementation of the reduction. These device
// specific implementations are templated themselves with the corresponding
// initial value functors and reduction functors.
template <typename T, typename Index, typename DeviceReductionFunctor>
class UnsortedSegmentReductionOp : public OpKernel {
 public:
  explicit UnsortedSegmentReductionOp(OpKernelConstruction* context)
      : OpKernel(context), reduction_functor_(DeviceReductionFunctor()) {}

  void Compute(OpKernelContext* context) override {
    const Tensor& data = context->input(0);
    const Tensor& segment_ids = context->input(1);
    const Tensor& num_segments = context->input(2);
    OP_REQUIRES_OK(context,
                   internal::ValidateUnsortedSegmentReduction(
                       this, context, data, segment_ids, num_segments));
    const auto segment_flat = segment_ids.flat<Index>();
    const int64_t output_rows = internal::SubtleMustCopy(static_cast<int64_t>(
        num_segments.dtype() == DT_INT32 ? num_segments.scalar<int32>()()
                                         : num_segments.scalar<int64_t>()()));
    OP_REQUIRES(context, output_rows >= 0,
                errors::InvalidArgument("Input num_segments == ", output_rows,
                                        " must not be negative."));
    TensorShape output_shape;
    output_shape.AddDim(output_rows);
    for (int i = segment_ids.dims(); i < data.dims(); i++) {
      output_shape.AddDim(data.dim_size(i));
    }
    Tensor* output = nullptr;
    OP_REQUIRES_OK(context, context->allocate_output(0, output_shape, &output));
    auto output_flat = output->flat_outer_dims<T>();
    auto data_flat = data.flat_inner_outer_dims<T, 2>(segment_ids.dims() - 1);
    reduction_functor_(context, segment_ids.shape(), segment_flat, data_flat,
                       output_flat);
  }

 protected:
  DeviceReductionFunctor reduction_functor_;
};

// ____________________________________________________________________________
// Sparse segment reduction ops.

// Same as SegmentReductionOp but takes as input a "sparse" tensor, represented
// by two dense tensors, one containing the data, and the other containing
// indices into the data.
//
// The template parameters are:
// * Device: An Eigen device object, on which the kernel will execute.
// * T: The value type.
// * Index: The element type of the indices tensor (int32 or int64).
// * SegmentId: The element type of the segment_ids tensor (int32 or int64).
template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentReductionOpBase : public OpKernel {
 public:
  explicit SparseSegmentReductionOpBase(OpKernelConstruction* context,
                                        bool is_mean, bool is_sqrtn,
                                        bool has_num_segments, T default_value)
      : OpKernel(context),
        dtidx_(DataTypeToEnum<Index>::v()),
        is_mean_(is_mean),
        is_sqrtn_(is_sqrtn),
        has_num_segments_(has_num_segments),
        default_value_(default_value) {}

  void Compute(OpKernelContext* context) override {
    const Tensor& input = context->input(0);
    const Tensor& indices = context->input(1);
    const Tensor& segment_ids = context->input(2);

    OP_REQUIRES_OK(
        context, internal::ValidateSparseSegmentReduction(
                     context, input, indices, segment_ids, has_num_segments_));

    Index output_rows = -1;
    if (has_num_segments_) {
      const Tensor& num_segments = context->input(3);
      // Note that there is a Tnumsegments parameter on the op, but it is not
      // plumbed through to here and so always takes its default value of int32.
      output_rows = internal::SubtleMustCopy(num_segments.scalar<int32>()());
    }
    const int64_t num_indices = indices.NumElements();

    auto input_flat = input.flat_outer_dims<T>();
    const int64_t num_col = input_flat.dimension(1);
    const auto indices_vec = indices.vec<Index>();
    const auto segment_vec = segment_ids.vec<SegmentId>();
    // Note that the current implementation assumes that segment_vec values are
    // sorted.
    const SegmentId last_segment_id =
        num_indices > 0 ? segment_vec(num_indices - 1) : 0;
    int64_t limit = dtidx_ == DataType::DT_INT32 ? kint32max : kint64max;

    OP_REQUIRES(
        context, last_segment_id < limit,
        errors::InvalidArgument("Last segment id must be < kintmax, got ",
                                last_segment_id, " limit ", limit));

    const SegmentId last_segment_id_plus_one =
        num_indices > 0
            ? internal::SubtleMustCopy(segment_vec(num_indices - 1)) + 1
            : 0;

    if (has_num_segments_) {
      OP_REQUIRES(
          context, output_rows >= last_segment_id_plus_one,
          errors::InvalidArgument("segment ids must be < num_segments"));
    } else {
      output_rows = last_segment_id_plus_one;
    }
    OP_REQUIRES(context, output_rows >= 0,
                errors::InvalidArgument("segment ids must be >= 0"));

    TensorShape output_shape = input.shape();
    OP_REQUIRES_OK(context, output_shape.SetDimWithStatus(0, output_rows));

    // Note that we do not initialize the output buffer with a default value, so
    // we need to explicitly set missing indices to the default value.
    Tensor* output = nullptr;
    OP_REQUIRES_OK(context, context->allocate_output(0, output_shape, &output));
    if (num_indices == 0) {
      if (output_rows > 0) {
        output->flat_outer_dims<T>().setConstant(default_value_);
      }
      return;
    }
    OP_REQUIRES(context, output_rows > 0,
                errors::InvalidArgument("segment ids must be >= 0"));
    auto output_flat = output->flat_outer_dims<T>();

    Tensor temp;
    if (input.dtype() == DT_BFLOAT16 || input.dtype() == DT_HALF) {
      temp = tensorflow::Tensor(DT_FLOAT, output_shape);
    }
    auto temp_flat = temp.flat_outer_dims<float>();

    int64_t start = 0, end = 1;
    // Index from which the output is not initialized.
    SegmentId uninitialized_index = 0;
    SegmentId out_index = internal::SubtleMustCopy(segment_vec(start));

    while (true) {
      // We initialize next_index to 0 to avoid "warning: 'next_index' may be
      // used uninitialized in this function" in the Mac build (since the
      // compiler isn't smart enough to realize the code is safe).
      SegmentId next_index = 0;
      if (end < num_indices) {
        next_index = internal::SubtleMustCopy(segment_vec(end));
        if (out_index == next_index) {
          ++end;
          continue;
        }
        // We have a new segment here.  Verify that the segment ids are growing.
        OP_REQUIRES(context, out_index < next_index,
                    errors::InvalidArgument("segment ids are not increasing"));
      }

      OP_REQUIRES(
          context, FastBoundsCheck(out_index, output_rows),
          errors::InvalidArgument(
              "Segment id ", out_index, " out of range [0, ", output_rows,
              "), possibly because 'segment_ids' input is not sorted."));

      // If there is a gap between two indices, we need to set that gap to the
      // default value.
      if (out_index > uninitialized_index) {
        Eigen::DSizes<Eigen::DenseIndex, 2> gap_slice_shape(
            out_index - uninitialized_index, num_col);
        Eigen::TensorMap<Eigen::Tensor<T, 2, Eigen::RowMajor>, Eigen::Unaligned>
            gap_slice(&output_flat(uninitialized_index, 0), gap_slice_shape);
        gap_slice.setConstant(default_value_);
      }

      auto out = output_flat.template chip<0>(out_index);
      auto temp = temp_flat.template chip<0>(out_index);
      const int bad_offset = Reduce<T, Index>(input_flat, indices_vec, start,
                                              end - start, out, temp);
      OP_REQUIRES(context, bad_offset < 0,
                  errors::InvalidArgument(
                      "Bad: indices[", start + bad_offset,
                      "] == ", indices_vec(start + bad_offset),
                      " out of range [0, ", input_flat.dimension(0), ")"));

      start = end;
      ++end;
      uninitialized_index = out_index + 1;
      out_index = next_index;
      if (end > num_indices) break;
    }

    // Fill the gap at the end with the default value.
    if (uninitialized_index < output_rows) {
      Eigen::DSizes<Eigen::DenseIndex, 2> gap_slice_shape(
          output_rows - uninitialized_index, num_col);
      Eigen::TensorMap<Eigen::Tensor<T, 2, Eigen::RowMajor>, Eigen::Unaligned>
          gap_slice(&output_flat(uninitialized_index, 0), gap_slice_shape);
      gap_slice.setConstant(default_value_);
    }
  }

 private:
  const DataType dtidx_;
  template <typename Tin>
  using EnableIfBfloat16OrHalf =
      typename std::enable_if<std::is_same<Tin, bfloat16>::value ||
                                  std::is_same<Tin, Eigen::half>::value,
                              int>::type;
  template <typename Tin>
  using EnableIfNotBfloat16OrHalf =
      typename std::enable_if<!std::is_same<Tin, bfloat16>::value &&
                                  !std::is_same<Tin, Eigen::half>::value,
                              int>::type;

  template <typename Tin, typename Tindex, EnableIfNotBfloat16OrHalf<Tin> = 0>
  EIGEN_ALWAYS_INLINE auto fetch_val(
      const typename TTypes<Tin>::ConstMatrix& input_flat, Tindex index) {
    return input_flat.template chip<0>(index);
  }

  template <typename Tin, typename Tindex, EnableIfBfloat16OrHalf<Tin> = 0>
  EIGEN_ALWAYS_INLINE auto fetch_val(
      const typename TTypes<Tin>::ConstMatrix& input_flat, Tindex index) {
    return input_flat.template chip<0>(index).template cast<float>();
  }

  template <typename Tout>
  EIGEN_ALWAYS_INLINE Tout get_scaling_factor(int64_t num) {
    Tout m(1);
    if (is_mean_ && (num < 10)) {
      m = Tout(num);
    }
    if (is_sqrtn_ && (num < 10)) {
      m = Tout(sqrt(num));
    }
    return Tout(1) / m;
  }

  template <typename Tin, typename Tindex, EnableIfNotBfloat16OrHalf<Tin> = 0>
  int64_t Reduce(
      const typename TTypes<Tin>::ConstMatrix& input_flat,
      const typename TTypes<Tindex>::ConstVec& indices_vec, int64_t start,
      int64_t num, Eigen::TensorChippingOp<0, typename TTypes<Tin>::Matrix> out,
      Eigen::TensorChippingOp<0, typename TTypes<float>::Matrix> temp) {
    return ReduceImpl<Tin, Tindex, Tin>(input_flat, indices_vec, start, num,
                                        out, get_scaling_factor<Tin>(num));
  }

  template <typename Tin, typename Tindex, EnableIfBfloat16OrHalf<Tin> = 0>
  int64_t Reduce(
      const typename TTypes<Tin>::ConstMatrix& input_flat,
      const typename TTypes<Tindex>::ConstVec& indices_vec, int64_t start,
      int64_t num, Eigen::TensorChippingOp<0, typename TTypes<Tin>::Matrix> out,
      Eigen::TensorChippingOp<0, typename TTypes<float>::Matrix> temp) {
    int64_t res =
        ReduceImpl<Tin, Tindex, float>(input_flat, indices_vec, start, num,
                                       temp, get_scaling_factor<float>(num));
    out = temp.template cast<Tin>();
    return res;
  }

  template <typename Tin, typename Tindex, typename Tout>
  int64_t ReduceImpl(
      const typename TTypes<Tin>::ConstMatrix& input_flat,
      const typename TTypes<Tindex>::ConstVec& indices_vec, int64_t start,
      int64_t num,
      Eigen::TensorChippingOp<0, typename TTypes<Tout>::Matrix> out,
      const Tout scaling_factor) {
#define INDEX(n, i)                               \
  const auto index##n = indices_vec(start + (i)); \
  if (!FastBoundsCheck(index##n, input_flat.dimension(0))) return (i);

#define L(n) fetch_val<Tin, Tindex>(input_flat, index##n)

    if (num == 1) {
      INDEX(0, 0);
      out = L(0);
    } else {
      int64_t r = num & 7;
      switch (r) {
        case 2: {
          INDEX(0, 0);
          INDEX(1, 1);
          out = (L(0) + L(1)) * scaling_factor;
          break;
        }
        case 3: {
          INDEX(0, 0);
          INDEX(1, 1);
          INDEX(2, 2);
          out = (L(0) + L(1) + L(2)) * scaling_factor;
          break;
        }
        case 4: {
          INDEX(0, 0);
          INDEX(1, 1);
          INDEX(2, 2);
          INDEX(3, 3);
          out = (L(0) + L(1) + L(2) + L(3)) * scaling_factor;
          break;
        }
        case 5: {
          INDEX(0, 0);
          INDEX(1, 1);
          INDEX(2, 2);
          INDEX(3, 3);
          INDEX(4, 4);
          out = (L(0) + L(1) + L(2) + L(3) + L(4)) * scaling_factor;
          break;
        }
        case 6: {
          INDEX(0, 0);
          INDEX(1, 1);
          INDEX(2, 2);
          INDEX(3, 3);
          INDEX(4, 4);
          INDEX(5, 5);
          out = (L(0) + L(1) + L(2) + L(3) + L(4) + L(5)) * scaling_factor;
          break;
        }
        case 7: {
          INDEX(0, 0);
          INDEX(1, 1);
          INDEX(2, 2);
          INDEX(3, 3);
          INDEX(4, 4);
          INDEX(5, 5);
          INDEX(6, 6);
          out =
              (L(0) + L(1) + L(2) + L(3) + L(4) + L(5) + L(6)) * scaling_factor;
          break;
        }
        case 0: {
          INDEX(0, 0);
          INDEX(1, 1);
          INDEX(2, 2);
          INDEX(3, 3);
          INDEX(4, 4);
          INDEX(5, 5);
          INDEX(6, 6);
          INDEX(7, 7);
          out = (L(0) + L(1) + L(2) + L(3) + L(4) + L(5) + L(6) + L(7)) *
                scaling_factor;
          r = 8;
          break;
        }
        case 1: {
          INDEX(0, 0);
          INDEX(1, 1);
          INDEX(2, 2);
          INDEX(3, 3);
          INDEX(4, 4);
          INDEX(5, 5);
          INDEX(6, 6);
          INDEX(7, 7);
          INDEX(8, 8);
          out = (L(0) + L(1) + L(2) + L(3) + L(4) + L(5) + L(6) + L(7) + L(8)) *
                scaling_factor;
          r = 9;
          break;
        }
      }
      for (; r < num; r += 8) {
        INDEX(0, r);
        INDEX(1, r + 1);
        INDEX(2, r + 2);
        INDEX(3, r + 3);
        INDEX(4, r + 4);
        INDEX(5, r + 5);
        INDEX(6, r + 6);
        INDEX(7, r + 7);
        out += L(0) + L(1) + L(2) + L(3) + L(4) + L(5) + L(6) + L(7);
      }
      if (is_mean_ && num >= 10) {
        out = out / static_cast<Tout>(num);
      }
      if (is_sqrtn_ && num >= 10) {
        out = out / static_cast<Tout>(sqrt(num));
      }
    }

    return -1;
#undef L
#undef INDEX
  }

  const bool is_mean_;
  const bool is_sqrtn_;
  const bool has_num_segments_;
  const T default_value_;
};

#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM

// Specialization for GPU. Must be Async because may need to wait for a host to
// device memcpy before allocating output.
template <class T, typename Index, typename SegmentId>
class SparseSegmentReductionOpBase<GPUDevice, T, Index, SegmentId>
    : public AsyncOpKernel {
 public:
  explicit SparseSegmentReductionOpBase(OpKernelConstruction* context,
                                        bool is_mean, bool is_sqrtn,
                                        bool has_num_segments, T default_value)
      : AsyncOpKernel(context),
        is_mean_(is_mean),
        is_sqrtn_(is_sqrtn),
        has_num_segments_(has_num_segments),
        default_value_(default_value) {}

  void ComputeAsync(OpKernelContext* context, DoneCallback done) override {
    const Tensor& input = context->input(0);
    const Tensor& indices = context->input(1);
    const Tensor& segment_ids = context->input(2);

    OP_REQUIRES_OK_ASYNC(
        context,
        internal::ValidateSparseSegmentReduction(
            context, input, indices, segment_ids, has_num_segments_),
        done);

    ScratchSpace<SegmentId> last_segment_id_host(context, 1, /*on_host=*/true);

    auto create_and_check_output = [this, context, input, indices, segment_ids,
                                    last_segment_id_host, done]() {
      // Ensure that within the callback, the proper GPU settings are
      // configured.
      auto stream = context->op_device_context()->stream();
      ScopedActivateExecutorContext scoped_activation{stream->parent()};

      SegmentId last_segment_id = *last_segment_id_host.data();
      SegmentId output_rows = last_segment_id + 1;
      OP_REQUIRES_ASYNC(context, output_rows > 0,
                        errors::InvalidArgument("segment ids must be >= 0"),
                        done);

      TensorShape output_shape = input.shape();
      output_shape.set_dim(0, output_rows);

      Tensor* output = nullptr;
      OP_REQUIRES_OK_ASYNC(
          context, context->allocate_output(0, output_shape, &output), done);

      auto input_flat = input.flat_outer_dims<T>();
      const auto indices_vec = indices.vec<Index>();
      const auto segment_ids_vec = segment_ids.vec<SegmentId>();
      auto output_flat = output->flat_outer_dims<T>();

      functor::SparseSegmentReductionFunctor<T, Index, SegmentId> functor;
      OP_REQUIRES_OK_ASYNC(
          context,
          functor(context, is_mean_, is_sqrtn_, default_value_, input_flat,
                  indices_vec, segment_ids_vec, output_flat),
          done);
      done();
    };

    if (has_num_segments_) {
      // No need to do any device to host memcpy, just compute synchronously.
      const Tensor& num_segments_t = context->input(3);
      SegmentId num_segments =
          internal::SubtleMustCopy(num_segments_t.dtype() == DT_INT32
                                       ? num_segments_t.scalar<int32>()()
                                       : num_segments_t.scalar<int64_t>()());
      *last_segment_id_host.mutable_data() = num_segments - 1;
      create_and_check_output();
    } else {
      const int64_t num_indices = indices.NumElements();
      // Need to copy last element of segment_ids from device to host, and then
      // asynchronously allocate the output and finish the computation.
      se::DeviceMemoryBase last_segment_id_device(
          const_cast<Tensor&>(segment_ids).template flat<SegmentId>().data() +
          (num_indices - 1));
      auto stream = context->op_device_context()->stream();
      OP_REQUIRES_ASYNC(
          context,
          stream
              ->ThenMemcpy(last_segment_id_host.mutable_data(),
                           last_segment_id_device, sizeof(SegmentId))
              .ok(),
          errors::Internal(type_string() +
                           ": failed to copy last_segment_id from device"),
          done);
      context->device()
          ->tensorflow_accelerator_device_info()
          ->event_mgr->ThenExecute(stream, create_and_check_output);
    }
  }

 private:
  const bool is_mean_;
  const bool is_sqrtn_;
  const bool has_num_segments_;
  const T default_value_;
};

#endif  // GOOGLE_CUDA || TENSORFLOW_USE_ROCM

template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentReductionMeanOp
    : public SparseSegmentReductionOpBase<Device, T, Index, SegmentId> {
 public:
  explicit SparseSegmentReductionMeanOp(OpKernelConstruction* context)
      : SparseSegmentReductionOpBase<Device, T, Index, SegmentId>(
            context, true /*is_mean*/, false /*is_sqrtn*/,
            false /* has_num_segments */, T(0) /* default_value */) {}
};

template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentReductionMeanWithNumSegmentsOp
    : public SparseSegmentReductionOpBase<Device, T, Index, SegmentId> {
 public:
  explicit SparseSegmentReductionMeanWithNumSegmentsOp(
      OpKernelConstruction* context)
      : SparseSegmentReductionOpBase<Device, T, Index, SegmentId>(
            context, true /*is_mean*/, false /*is_sqrtn*/,
            true /* has_num_segments */, T(0) /* default_value */) {}
};

template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentReductionSqrtNOp
    : public SparseSegmentReductionOpBase<Device, T, Index, SegmentId> {
 public:
  explicit SparseSegmentReductionSqrtNOp(OpKernelConstruction* context)
      : SparseSegmentReductionOpBase<Device, T, Index, SegmentId>(
            context, false /*is_mean*/, true /*is_sqrtn*/,
            false /* has_num_segments */, T(0) /* default_value */) {}
};

template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentReductionSqrtNWithNumSegmentsOp
    : public SparseSegmentReductionOpBase<Device, T, Index, SegmentId> {
 public:
  explicit SparseSegmentReductionSqrtNWithNumSegmentsOp(
      OpKernelConstruction* context)
      : SparseSegmentReductionOpBase<Device, T, Index, SegmentId>(
            context, false /*is_mean*/, true /*is_sqrtn*/,
            true /* has_num_segments */, T(0) /* default_value */) {}
};

template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentReductionSumOp
    : public SparseSegmentReductionOpBase<Device, T, Index, SegmentId> {
 public:
  explicit SparseSegmentReductionSumOp(OpKernelConstruction* context)
      : SparseSegmentReductionOpBase<Device, T, Index, SegmentId>(
            context, false /*is_mean*/, false /*is_sqrtn*/,
            false /* has_num_segments */, T(0) /* default_value */) {}
};

template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentReductionSumWithNumSegmentsOp
    : public SparseSegmentReductionOpBase<Device, T, Index, SegmentId> {
 public:
  explicit SparseSegmentReductionSumWithNumSegmentsOp(
      OpKernelConstruction* context)
      : SparseSegmentReductionOpBase<Device, T, Index, SegmentId>(
            context, false /*is_mean*/, false /*is_sqrtn*/,
            true /* has_num_segments */, T(0) /* default_value */) {}
};

namespace functor {

template <typename T, typename Index, typename SegmentId>
struct SparseSegmentGradFunctor<CPUDevice, T, Index, SegmentId> {
  void operator()(OpKernelContext* context,
                  SparseSegmentReductionOperation operation,
                  typename TTypes<T>::ConstMatrix input_flat,
                  typename TTypes<Index>::ConstVec indices_vec,
                  typename TTypes<SegmentId>::ConstVec segment_vec,
                  typename TTypes<T>::Matrix output_flat) {
    const int64_t N = indices_vec.size();
    const SegmentId M = output_flat.dimension(0);

    // Note that similar to SparseSegmentMean, we assume that segment_vec is
    // already sorted and has non-negative values.
    const SegmentId num_segments = input_flat.dimension(0);
    const SegmentId last_segment_id_plus_one =
        internal::SubtleMustCopy(segment_vec(N - 1)) + 1;
    OP_REQUIRES(context, last_segment_id_plus_one <= num_segments,
                errors::InvalidArgument("Invalid number of segments"));

    // Compute scaling factors for input.
    std::vector<double> scaling(
        (operation == SparseSegmentReductionOperation::kSum ? 0 : num_segments),
        0.0);
    if (operation != SparseSegmentReductionOperation::kSum) {
      for (int64_t i = 0; i < N; ++i) {
        const SegmentId idx = internal::SubtleMustCopy(segment_vec(i));
        OP_REQUIRES(
            context, FastBoundsCheck(idx, num_segments),
            errors::InvalidArgument("Segment id ", idx, " out of range [0, ",
                                    num_segments, ")."));
        scaling[idx] += 1;
      }
      for (size_t i = 0; i < scaling.size(); ++i) {
        switch (operation) {
          case SparseSegmentReductionOperation::kSum: {
            OP_REQUIRES(
                context, false,
                errors::Internal(
                    "Should not happen: sum inside SparseSegmentReductionOp "
                    "scaling generation."));
          }
          case SparseSegmentReductionOperation::kMean: {
            scaling[i] = 1.0 / std::max(scaling[i], 1.0);
            break;
          }
          case SparseSegmentReductionOperation::kSqrtN: {
            scaling[i] = 1.0 / sqrt(std::max(scaling[i], 1.0));
            break;
          }
            // No default to get compiler warnings for missing cases.
        }
      }
    }

    output_flat.setZero();
    std::vector<bool> is_modified(M, false);

    for (int64_t i = 0; i < N; ++i) {
      const Index output_idx = internal::SubtleMustCopy(indices_vec(i));
      OP_REQUIRES(context, FastBoundsCheck(output_idx, M),
                  errors::InvalidArgument("Index ", output_idx,
                                          " out of range [0, ", M, ")."));

      const SegmentId idx = internal::SubtleMustCopy(segment_vec(i));
      OP_REQUIRES(
          context, FastBoundsCheck(idx, num_segments),
          errors::InvalidArgument("Segment id ", idx, " out of range [0, ",
                                  num_segments, ")."));

      const T scale = (operation == SparseSegmentReductionOperation::kSum
                           ? static_cast<T>(1)
                           : static_cast<T>(scaling[idx]));
      if (is_modified[output_idx]) {
        if (scale == 1.0) {
          output_flat.template chip<0>(output_idx) +=
              input_flat.template chip<0>(idx);
        } else {
          output_flat.template chip<0>(output_idx) +=
              input_flat.template chip<0>(idx) * scale;
        }
      } else {
        if (scale == 1.0) {
          output_flat.template chip<0>(output_idx) =
              input_flat.template chip<0>(idx);
        } else {
          output_flat.template chip<0>(output_idx) =
              input_flat.template chip<0>(idx) * scale;
        }
      }
      is_modified[output_idx] = true;
    }
  }
};

}  // namespace functor

// Implements the common logic for the gradients of SparseSegmentReduction
// kernels.
//
// The template parameters are:
// * Device: An Eigen device object, on which the kernel will execute.
// * T: The value type.
// * Index: The element type of the indices tensor (int32 or int64).
// * SegmentId: The element type of the segment_ids tensor (int32 or int64).
template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentGradOpBase : public OpKernel {
 public:
  explicit SparseSegmentGradOpBase(OpKernelConstruction* context,
                                   SparseSegmentReductionOperation operation)
      : OpKernel(context), operation_(operation) {}

  void Compute(OpKernelContext* context) override {
    const Tensor& input = context->input(0);
    const Tensor& indices = context->input(1);
    const Tensor& segment_ids = context->input(2);
    const Tensor& output_dim0 = context->input(3);

    OP_REQUIRES(context, TensorShapeUtils::IsVector(indices.shape()),
                errors::InvalidArgument("indices should be a vector."));
    OP_REQUIRES(context, TensorShapeUtils::IsVector(segment_ids.shape()),
                errors::InvalidArgument("segment_ids should be a vector."));
    OP_REQUIRES(context, TensorShapeUtils::IsScalar(output_dim0.shape()),
                errors::InvalidArgument("output_dim0 should be a scalar."));

    const int64_t N = indices.NumElements();
    OP_REQUIRES(context, N == segment_ids.NumElements(),
                errors::InvalidArgument(
                    "segment_ids and indices should have same size."));
    const SegmentId M = internal::SubtleMustCopy(output_dim0.scalar<int32>()());

    auto input_flat = input.flat_outer_dims<T>();
    const auto indices_vec = indices.vec<Index>();
    const auto segment_vec = segment_ids.vec<SegmentId>();

    TensorShape output_shape = input.shape();
    OP_REQUIRES_OK(context, output_shape.SetDimWithStatus(0, M));
    Tensor* output = nullptr;
    OP_REQUIRES_OK(context, context->allocate_output(0, output_shape, &output));
    if (M == 0 || N == 0) return;

    auto output_flat = output->flat_outer_dims<T>();
    functor::SparseSegmentGradFunctor<Device, T, Index, SegmentId>()(
        context, operation_, input_flat, indices_vec, segment_vec, output_flat);
  }

 private:
  const SparseSegmentReductionOperation operation_;
};

template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentSumGradOp
    : public SparseSegmentGradOpBase<Device, T, Index, SegmentId> {
 public:
  explicit SparseSegmentSumGradOp(OpKernelConstruction* context)
      : SparseSegmentGradOpBase<Device, T, Index, SegmentId>(
            context, SparseSegmentReductionOperation::kSum) {}
};

template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentMeanGradOp
    : public SparseSegmentGradOpBase<Device, T, Index, SegmentId> {
 public:
  explicit SparseSegmentMeanGradOp(OpKernelConstruction* context)
      : SparseSegmentGradOpBase<Device, T, Index, SegmentId>(
            context, SparseSegmentReductionOperation::kMean) {}
};

template <typename Device, class T, typename Index, typename SegmentId>
class SparseSegmentSqrtNGradOp
    : public SparseSegmentGradOpBase<Device, T, Index, SegmentId> {
 public:
  explicit SparseSegmentSqrtNGradOp(OpKernelConstruction* context)
      : SparseSegmentGradOpBase<Device, T, Index, SegmentId>(
            context, SparseSegmentReductionOperation::kSqrtN) {}
};

}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_KERNELS_SEGMENT_REDUCTION_OPS_IMPL_H_

redpajama_set_name: RedPajamaGithub


The Ford Capri is a fastback coupé built by Ford Motor Company between 1968 and 1986. It used the mechanical components from the Mk2 Ford Cortina and was intended as the European equivalent of the Ford Mustang. The Capri went on to be a highly successful car for Ford, selling nearly 1.9 million units in its lifetime.


Special information It may take a few weeks to experience the full benefits of Elavil treatment. Individuals taking it are encouraged to expect up to a 30 day wait before seeing improvement. Amitriptyline effectiveness depends on building up a steady dose of the medication in your body and maintaining it over time. This medication will commonly be prescribed for no more than 6 months, at which time your doctor may want to evaluate your treatment or recommend tests to see if you're having any physical reactions to the medication you may not be aware of. Do not skip doses, even if you feel you do not need them, as this may reduce the effectiveness of Elavil.
Compare price and buy elavil.


The Los Angeles Unified School District Board of Education has approved a resolution asking the state to put new charter schools on hold while the state studies their effects.
The board approved the resolution 5-1 Tuesday after unanimously ratifying a new contract for teachers that ended a six-day strike.
A few hundred protesters outside the meeting opposed placing limits on the growth of charters — privately operated, mostly non-union public schools.
The teachers union pushed the charter resolution, which isn't part of the contract. The district agreed to put it before the board as a gesture of good faith.
Only the state can call a moratorium or change charter laws.
Opponents say charters draw away students from traditional public schools and the money that goes with them.
The Los Angeles Unified School District Board of Education has unanimously approved a new contract with teachers, who returned to classrooms last week after a six-day strike.
The board's action came Tuesday despite an oversight agency issuing a report saying the contract that includes a 6 per cent pay hike may not be sustainable.
The Los Angeles County Office of Education cited concerns over the district's long-term financial outlook and said the district board should develop a detailed plan that addresses how it will pay for increased salaries while keeping up its minimum financial reserves.
The 30,000 members of United Teachers Los Angeles previously approved the contract agreement.
An oversight agency says a tentative contract between the Los Angeles Unified School District and its teachers' union that includes a 6 per cent pay hike may not be sustainable.
Citing concerns over the district's long-term financial outlook, the LA County Office of Education released the analysis Tuesday as the school board was set to vote on whether to ratify the agreement that ended a strike.
The county report says if the district board approves the deal, it should develop a detailed plan that addresses how it will pay for increased salaries while keeping up its minimum financial reserves.
The district didn't immediately comment on the analysis.
The 30,000 members of United Teachers Los Angeles previously approved the agreement.


Unlike Morris, Stickley did not reject mass production. Discover our main websites that all share our passion for textile crafting and are designed to help crafters unleash their creativity. Children feel proud when they create beautiful, practical items they can use at home or give as gifts. We have a large selection of imported yarns from Sirdar, Tahki, Classic Elite, Fiesta, Lane Borgosesia, Euro, Unger and more.
Welcome to my website packed full of interesting hand embroidery kits, ... After the program the kids could not stop talking about how much they enjoyed the program." We are always busy stocking our shelves with all that's new and wonderful in the stitchery world, so you're going to have fun looking around in here. C & T PUBLISHING LAFAYETTE, CA. 2000 Trade Paperback. It's not really as big as it may look- the brass hardware is only about 3 inches wide. Ruby Wings Designs - Sells beading kits with well-written instructions and with graphics showing each step of the process.
We provide top quality Needlecraft-, Counted Cross Stitch-, Embroidery-Kits, Handmade items,Books,Back Magazine issues and other items... Here's a photo of the Fall Pyn Keepe exchange I sent to Ina: The design is from a Milady's Needle kit called "Milady's Acorn Box". As an exclusive offer to Johnson Crafts customers, you can use voucher code JCRAFTS to get £1 off when you spend £20 or more on recycled or compatible printer ink cartridges.
I can browse the projects of new and old friends and let their projects inspire me. Hand dyed silk, hand dyed mohair and hand dyed wool threads suitable for a range of needle crafts including cross stitch and embroidery. Polypropylene (Olefin or Polyolefin) - A manufactured fiber characterized by its light weight, high strength, and abrasion resistance. They did have a variety of affordable wool. The Needlepoint Sampler Kit is the perfect way to introduce the art of needlepoint to a child or grandchild.
As California Stitchery, we have been supplying to needlework enthusiasts for over 21 years, specializing in Judaic themed stitchery. Yesterday's Dreams: Supplies for smocking, needlework, duplicate stitch, silk ribbon embroidery, and French sewing. Each vejigante sports at least two or tree horns, although some masks may have hundreds of horns in all shapes and sizes. The classic version is in tent, cross or Gobelin stitches. Check out our Facebook albums devoted to Vintage Textile Brides and Belle Époque, the most recent in a series of albums from the VintageTextile archives.
We supply and manufacture needlecraft supplies, including working frames, notions and accessories for all types of sewing, embroidery, quilting and other crafts. Europe's largest Patchwork & quilting supplies online shop. Symbols on the chart represent each stitch, with different symbols representing different colours of thread. Polyester has high strength (although somewhat lower than nylon), excellent resiliency, has high abrasion resistance, and resists shrinking, stretching and wrinkles.
Through its use, the expense and wastefulness of commercial patterns may be eliminated. We are so pleased to be able to add online sales to our services! If there is anything you can't find, email us and we will do our best to accommodate your special request. Gravity did the work -- no squeezing needed. Those include canvaswork, woolwork, petit point and tapestry embroidery, or tapestry needlework. Sugarloaf Craft Festivals has been one of the world's premier juried fine art and craft festivals since 1975.
There are so many working frames available today that it is very easy to become confused over which type to choose, especially when you are a beginner. Please contact us on 0800 0542828 or send your e-mail directly to info@rag-bag.co.uk. The staff is very helpful and friendly and helpful. (that good neighborhood feeling) They have a nice selection of fabrics. Current uses for nanofiber technology is in the fields of medical products, consumer products, industrial products, and high-tech applications for aerospace, capacitors, transistors, drug delivery systems, battery separators, energy storage, filtration, fuel cells, and information technology.
She quickly corrected us and we added a single candle beside those to make it 98! size: 320*160ct,14ct cross stitch picture for hanging. Anna-Marie has worked some lovely silk and metal thread kimono's and has kits in counted and metal thread. Gallery of decorative durable handmade crocheted oval and slice rag rugs. Creative Connections, Inc. - Features Duncan ceramic paints and glazes. This site also features dyes, batiks, other patterns, historic costume rentals and a CLEARING HOUSE of bargains for the quilter, sewer and craft enthusiast.
Tatting is the craft of making lace by using a hand-held shuttle and thread. However, I've never seen a kit like the Floral Path Bolster from Anchor Living. The simple egg has become a fragile canvas for painted, decorated, and sculptured masterpieces. All prices are in Australian Dollars and include 10% GST. Do this only if you plan to cut the taped edges completely off. Rocky Mountain Needleworking is an on-line needleworking shop. Includes 12 coloured marker pens to decorate Ready to hang when finished. 12 x 12 Inches Zen Color Canvas and Marker Pack..


Ever wanted to receive professional advice about buying and using giant advertising balloons? How do you come up with ideas? Are they difficult or time consuming to manufacture? What are the best ways to use custom inflatables? Now's your chance to have all your questions about advertising inflatables answered by the people who know best.
Want to go big? Expand your logo into enormous size with branded inflatable billboards. Among other uses, these work in combination with inside events that may not be visible from the street. Radio remotes, in-store manufacturer appearances and other events would greatly benefit from having an inflatable logo that directs customers inside. You'll find dozens of uses for these highly noticeable inflatables.
It's excitement gone wild! Give away free money, coupons or merchandise and crowds instantly appear. Banks, car dealers, retailers and others generate a lot of participation and goodwill at events using inflatable cash booths that spin dollars, coupons and paper certificates into a whirlwind for customers to catch. Fully branded with space for sponsor banners, air booths create fun and loyalty on the spot.
Inflatable kiosks (or booths) are branded, canopied areas that give you a large presence at events. Whether you need a sampling booth, display area for products, a shaded space for video screens or another sheltered place for experiential marketing, inflatable kiosks step up to the challenge. Relatively lightweight and completely shippable for multiple-city events, kiosks are affordable and eye-catching.
In the shape of hot air balloons, these inflatable hot air shapes focus on branding. Customize the size, colors, internal lighting options, banners and more. Need something different every month? No problem with personalized signage. For use on a roof or elsewhere, you'll drive foot traffic to your location quickly with these familiar, inflatable shapes.


text:
// The MIT License (MIT)
//
// Copyright (c) 2015 Suyeol Jeon (http://xoul.kr)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#import "Allkdic-Swift.h"

#import <Carbon/Carbon.h>

#import "AKHotKeyManager.h"

@implementation AKHotKeyManager

/**
 * Reference : http://dbachrach.com/blog/2005/11/program-global-hotkeys-in-cocoa-easily/
 */
EventHotKeyRef hotKeyRef;

+ (void)registerHotKey
{
    EventHotKeyID hotKeyId;
    EventTypeSpec eventType;
    eventType.eventClass = kEventClassKeyboard;
    eventType.eventKind = kEventHotKeyPressed;

    // When hotkey event fired, hotKeyHandler is called.
    InstallApplicationEventHandler(&hotKeyHandler, 1, &eventType, NULL, NULL);

    // 4byte character
    hotKeyId.signature = 'allk';
    hotKeyId.id = 0;

    NSDictionary *data = [[NSUserDefaults standardUserDefaults] objectForKey:UserDefaultsKey.HotKey];
    KeyBinding *keyBinding;
    if (data) {
        keyBinding = [[KeyBinding alloc] initWithDictionary:data];
    } else {
        NSLog(@"No existing key setting.");
        keyBinding = [[KeyBinding alloc] init];
        keyBinding.option = YES;
        keyBinding.command = YES;
        keyBinding.keyCode = 49; // Space
        [[NSUserDefaults standardUserDefaults] setObject:[keyBinding toDictionary] forKey:UserDefaultsKey.HotKey];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }

    NSLog(@"Bind HotKey : %@", keyBinding);

    UInt32 hotKeyModifiers = 0;
    if (keyBinding.shift) {
        hotKeyModifiers += shiftKey;
    }
    if (keyBinding.option) {
        hotKeyModifiers += optionKey;
    }
    if (keyBinding.control) {
        hotKeyModifiers += controlKey;
    }
    if (keyBinding.command) {
        hotKeyModifiers += cmdKey;
    }

    RegisterEventHotKey((UInt32)keyBinding.keyCode, hotKeyModifiers, hotKeyId, GetApplicationEventTarget(), 0,
                        &hotKeyRef);

    [[AllkdicManager sharedInstance].contentViewController updateHotKeyLabel];
}

+ (void)unregisterHotKey
{
    NSLog (@"Unbind HotKey");
    UnregisterEventHotKey(hotKeyRef);
}

#pragma mark -
#pragma mark HotKey

OSStatus hotKeyHandler(EventHandlerCallRef nextHandler, EventRef theEvent, void *userData)
{
    [[AllkdicManager sharedInstance] open];
    return noErr;
}

@end


text:
Jenny Lewis' New Video Is Exactly What Feminism in Music Should Look Like
ByChloe Stillwell
Any woman who was sorting through puberty in the late '90s and early aughts knows that Jenny Lewis might be the messiah. She belongs to a magical, yet small group of female musicians — namely Karen O, Gwen Stefani and Alison Mosshart — who got their start as indie darlings fronting male bands and then catapuled to pop star status without compromising their feminity or creativity at all. Now she's back with a video that might just show the way for feminism in the new age of music.
We live in the age of the empowered female pop star — of a hyper-sexualized, feminist-tract writing Beyoncé or roaring super-heroine Katy Perry. But yesterday when Lewis released the video for the first single "Just One Of The Guys" off her first solo album in six years, The Voyager (out July 29th), it immediately caught fire online. The reason is clear: This is the kind of feminism we aren't seeing enough of. Lewis's own take on pop feminism actually speaks to a feeling that likely resonates with many modern women — she subtly illuminates the difficulty in balancing traditional female roles with the new landscape of gender identity.
The video dramatizes the struggle hilariously, juxtaposing lyrics like "When I look at myself all I can see / I'm just another lady without a baby" with footage of Lewis, Anne Hathaway, Kristen Stewart and Brie Larson struggling their way through drag performances. (Lewis sports a rainbow suit masterpiece straight from a desert fever dream.)
Just because a girl can hang, doesn't mean she's not a girl anymore, and doesn't sometimes want girl stuff. Where Beyoncé, Miley, Katy, Rihanna and their compatriots are promoting an equally valid but forceful "free to do what I want to" kind of feminism, Lewis is speaking to a more moderate, realistic version of everyday feminism where women are trying to find a balance between the old and the new. Both versions are valid, but Lewis is doing the leg work to prove that more than one kind of feminism can succeed in the image-obsessed, sex-crazed world of music.
It's a tonal shift from a lot of music that has an overt feminist intention. The fun the women had making the video is palpable. Lewis told GQ, "I haven't laughed that hard since What About Bob? came out on laser disk." Together, they made a video that conveyed the sensibility of the song — the joint hyper-awareness of what it means to be woman, and the necessity to make light of that same awareness.
Image Credit: YouTube
Each of these powerful women goes full slap-stick on their variations on the worst kind of men you can imagine, dramatizing the difficulty of pulling it off while conveying complete control and wild care-freedom. Lewis articulates with stunning ease and clarity that a female artist doesn't have to be a hyper-sexualized diva or a firework in order to be a feminist. The sentiment in "Just One Of The Guys," both lyrically and on the screen, is honest without being too sentimental or overdone — and that's exactly what feminism in music should look like.


Let's see how they work.
The empty list, Is just empty bracket.
A list with one element, let's say a letter a in it, would look like this.
A list with two letters would look like this.
A list can have numbers.
A list can have strings.
And it can have all of these things.
Let's define a list of letters.
it gives us this list named lis.
And it's equal to the letters a through f.
If I type lis, you'll see that I get that list back.
Let's talk about how the items of a list are accessed.
This is item zero, this is item one, this is item two, and so on.
And notice that Python starts with item zero, not item one.
So zero, one, two, three, four, five.
That's the way these are accessed.
Let's take a look at how to pull an element out.
If you want item 0, you type lis.
If you want item 1, you type lis.
you can use the len function, the length function.
And it'll tell you that there's six, there's three, four, five, six.
Now, what if we wanted to get the last element of the list?
Well you might be tempted to ask for the following.
But let's see if that would work.
the last item of this list is item five, not item six.
So this won't work, but I can say item five and get it.
There is a simpler way and that is that I can type -1.
this is first one at the end of the list.
And the next to the last one will be lis[-2].
And so on, let me repeat the list.
through four back into it this way.
three but it will not print four.
it'll do three but it will not do four, which is the e.
Let's see that, zero, one, two.
Three, there's the third one.
I want to get everything from item three on to the end, I can do that.
And not put an ending spot.
I want to get everything up to, but not including three, I can do that.
Zero, one, two, here's three.
It's d, it's not there.
called append and I can, in this case, add g on in this manner.
You see g is now added on to the end of the list.
We can ask whether something is in the list.
So I'm going to ask if d in lis.
I can make that assertion.
Python will tell me whether that's true or false.
If I make the assertion that x is in the list, it'll tell me that it's false.
see whether I get true or false.
Now let's look at a function that makes use of the list.
First of all I'll go over here and click on, in that cell, and execute it.
Who_is_there is the name of the function.
And I'll give it a simple list with just a lion in it.
And it prints, there's a lion.
There's no horse in the list and the list has one item.
Let's take a look at the code If bear's in the list, it'll do something.
But there's no bear in the list.
There's only lions in the list.
If lion is in the list, then it'll print there's a lion.
If they both are there, it'll print something.
that's not in the list.
And now let's look at this horse not in list.
only a lion's in the list, so this is true.
If this is true, then it'll print there's no horse in the list, and it does.
the list has a length of list items, and there's one item.
Put that in the list.
Now again the lion's in the list, so it prints there is a lion.
iris in list then, there are flowers.
Well, iris is in the list so it'll print flowers.
If it had seen daisy it would of print flowers too.
There's still no horse in the list so it prints that, and now there are two items.
Let's put daisy in the list.
Now the lion is still there.
So it's still checks the other line and prints there is a lion.
If daisy is in the list, and it is, it'll print there are flowers.
It would've also printed it because iris is also in the list.
iris is in the list, there are at least two flowers and it prints that.
now the length of the list has three items.
If we put horse in the list.
not in the list is no longer true, horse is in fact in the list.
So this if statement is not true, so we'll not write there is no horse in the list.
make sure you understand how all those ifs work.
Let me point out that we didn't have to type the list directly into the argument.
Let me find a few lists here, I'll show what I mean.
has a lion and a daisy in it, and lbf, that list has a lion, a bear, and an iris.
and there are flowers, because iris is there.
There's no horse in the list, and the list has three items.


Welcome to PromoDunia – Your online destination for shopping deals, recharge offers, travel deals, movie offers, and many more other. We are here to provide you best discounted deals from third party.
PromoDunia is one of those unique sites which publish best selected offers by which you can get more and more benefit and save your money. Our goal is to achieve the trust of our visitors.
Completed B.tech under specialization of Computer Science & Engineering. He started the journey of PromoDunia in July 2015 with a goal to provide best deals and offers on E-commerce and still working hard to get more and more customer satisfaction.


text:
Imam, worshipper shot, many abducted as bandits attack mosque and villages in Katsina
Bandits have attacked a mosque in Maigamji village along Funtua-Dandume road, Funtua Local Government Area of Katsina State.
A former councillor of Maigamji ward in Funtua LGA of Katsina, Alhaji Lawal Maigamji, said the bandits stomed the mosque during Isha'i prayer on Saturday, December 3, 2022, and opened fire on two people, including the Imam.
He identified those shot as Malam Yusha'u, the Imam, and Hussaini Jamo, a worshipper, adding that they are both receiving treatment at a hospital in Funtua.
"They surrounded the mosque when Ishaa'i congregational prayer was being conducted, after shooting Imam Yusha'u and Hussaini Jamo, they abducted 18 people and made away with them into the bush," Lawal Maigamji said.
He added that four of the abducted victims escaped from their captors while in transit.
In a related development, at least 31 people were reportedly abducted in Karare and Kokiya villages of Batsari Local Government Area of Katsina State in the early hours of Friday.
The terrorists, which were said to number about 40 riding on motorcycles, invaded the village where they killed one person and abducted the people including women and children.
Daily Trust gathered that some of the abductees were students heading to the Government Day Secondary School, Karare from Kokiya village.
As of the time of compiling this report, residents of Karare and Kokiya villages were yet to ascertain the number of abducted victims.
Some residents who spoke to our reporter in Katsina expressed worry over the increasing spate of kidnappings for ransom, cattle rustlings and heinous killings of innocent people.
The chairman of Batsari Local Government area, Yusuf Yanji, who confirmed the kidnapping of of some residents, however, refuted the allegations of the students' abduction, saying the story was unfounded.
Three teenagers charged with murder of 16-year-old Nigerian boy and one other in London
NDLEA declares notorious Abuja drug lord, 'Ibrahim Bendel' wanted


text:
Los Angeles rolls out downtown bike-sharing program
LOS ANGELES - Los Angeles rolled out a downtown bicycle-sharing program Thursday, offering rentals at dozens of locations with hopes to expand region wide.
The city is a relative late-comer to bike sharing, which encourages residents and visitors alike to choose two wheels over four when taking shorter trips in densely populated areas.
Visalia administrators seek public comment
Mayor Eric Garcetti joined dozens of cyclists for a ceremony in Grand Park to kick off the $11 million program, approved a year ago by the City Council.
An agreement between the city and Los Angeles County's Metropolitan Transportation Authority creates up to 65 bike-sharing stations. Riders can pick up a bike from a kiosk, hop on, and then leave it near their destination for someone else to use.
The city agreed to cover around 65 percent of operating costs, but it hopes to offset it through user fees and by selling advertising.
Those fees vary from a 30-day pass for $20, with rentals of longer than 30 minutes costing more, to a walk-up fee of $3.50 for half an hour.
If the program is successful, it could grow beyond the downtown core. A similar program began in Santa Monica last November.
Sierra Bicycle Werks rolls out rentals


These Merino wool bottoms will keep you warm when you are out fishing. Made from Total Easy Care (TEC) - treated Merino wool, which makes them extra soft. Wool has excellent insulation properties even when wet and is naturally odour resistant.
Made from 200g 70% itch-free Merino wool.


Does anyone remember a fast-food-type restaurant named Rax that used to be on Route 30 near George Street, I think where the McDonald's was before it moved across the street?
Anyway, my mom used to take me to Rax all the time. But not only have I never heard of or seen another Rax, no one I talk to around here remembers this one.
With the wonders of the Internet, I did find this Wikipedia entry on Rax, which seems to indicate the chain met with rather sad circumstances. On the bright side, however, when I leave next week for a two-week vacation driving across the country, I might be able to hit one in the midwest.
Yes I remember Rax restaurant on the Golden Strip in Williamsport, PA. Enjoyed their salad bar. Did have lovely atmosphere and reasonably priced. Wondered why they closed up? Friends and us use to eat there on the weekends.


One of Neil Diamond's most famous songs ''We're coming to America,'' sets the tone for visitors ready to experience the holiday of a lifetime in this awe-inspiring country which will definitely leave its mark on you that's for sure.
Come and explore America's 50 states with USA holidays and honeymoons. America is awash with so many popular destinations – all brimming with life including New York where you will be able to splurge on the decadent on Fifth Avenue or stand atop the Statue of Liberty and gaze out at spectacular views of this sprawling city, while Boston, one of the oldest cities in the United States is definitely worth a visit, famous for being the home of the 35th President of the United States, John F. Kennedy. Checkout our amazing cheap all-inclusive USA holidays from Ireland. As the saying goes, ''Whatever happens in Vegas, stays in Vegas,'' and this is a true interpretation of what you should expect to discover here in this bustling playground. Try your luck on the tables or how about a helicopter trip to the Grand Canyon? Nothing beats a trip to Las Vegas. The stunning waterfont, Golden Gate Bridge, Fisherman's Wharf and the famous cable car will make a holiday to San Francisco very memorable indeed, so book that cheap holiday package to the USA today, while Chicago which is majestically located on Lake Michigan is a treat for any visitor. Famed for its iconic skyline, its architecture and its museums it is not to be missed. Orlando is the perfect family holiday destination. Famous for its theme parks it is a world renowned destination. It will certainly make your holiday dreams come true.
History lovers will be able to explore the length and breadth of Dallas, the Texan city and retrace the steps of JFK's last few hours by visiting Dealey Plaza and touring the impressive Sixth Floor Museum. Seattle which is located on the Pacific Northwest is an extraordinary city to visit. The iconic Space Needle in the heart of the city is where you will be able to enjoy unparalleled views while the Pike Place Market which overlooks Elliott Bay is a wonderful place to explore when in Seattle.
Take in some of America's enthralling attractions with a great American road trip which will bring you to some of the country's most acclaimed and iconic sights.
Come and enjoy the great American experience.
Check out our Holiday & Honeymoon destinations in the USA!


Through a combination of custom html and CSS, I have designed e-mail campaigns for several of my clients. E-newsletter creation from scratch as well as customization via the e-newsletter provider's platform. Designed for Vertical Response, Constant Contact and Mail Chimp.